[IPoIB] Handle SA interaction failures during port activation
[mirror/winof/.git] / ulp / ipoib / kernel / ipoib_adapter.c
index d4bfdd3..67ee872 100644 (file)
@@ -988,6 +988,51 @@ ipoib_set_active(
 }\r
 \r
 \r
+/*\r
+ * If something goes wrong after the port goes active, e.g.\r
+ *     - PortInfo query failure\r
+ *     - MC Join timeout\r
+ *     - etc\r
+ * Mark the port state as down, resume any pended OIDS, etc.\r
+ */\r
+void\r
+ipoib_set_inactive(\r
+       IN                              ipoib_adapter_t* const          p_adapter )\r
+{\r
+       ib_pnp_event_t  old_state;\r
+\r
+       IPOIB_ENTER( IPOIB_DBG_INIT );\r
+\r
+       cl_obj_lock( &p_adapter->obj );\r
+       old_state = p_adapter->state;\r
+       if( old_state != IB_PNP_PORT_REMOVE )\r
+               p_adapter->state = IB_PNP_PORT_DOWN;\r
+       cl_obj_unlock( &p_adapter->obj );\r
+\r
+       /*\r
+        * If we had a pending OID request for OID_GEN_LINK_SPEED,\r
+        * complete it now.\r
+        */\r
+       if( old_state == IB_PNP_PORT_INIT )\r
+       {\r
+               NdisMIndicateStatus( p_adapter->h_adapter,\r
+                       NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0 );\r
+               NdisMIndicateStatusComplete( p_adapter->h_adapter );\r
+\r
+               ipoib_resume_oids( p_adapter );\r
+       }\r
+\r
+       if( p_adapter->reset )\r
+       {\r
+               p_adapter->reset = FALSE;\r
+               NdisMResetComplete(\r
+                       p_adapter->h_adapter, NDIS_STATUS_SUCCESS, TRUE );\r
+       }\r
+\r
+       IPOIB_EXIT( IPOIB_DBG_INIT );\r
+}\r
+\r
+\r
 NDIS_STATUS\r
 ipoib_get_recv_stat(\r
        IN                              ipoib_adapter_t* const          p_adapter,\r