[IPoIB] Handle SA interaction failures during port activation
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 19 Apr 2006 20:38:22 +0000 (20:38 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 19 Apr 2006 20:38:22 +0000 (20:38 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@317 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/ipoib_adapter.c
ulp/ipoib/kernel/ipoib_adapter.h
ulp/ipoib/kernel/ipoib_port.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
index 066ce03..35cf017 100644 (file)
@@ -393,6 +393,9 @@ void
 ipoib_set_active(\r
        IN                              ipoib_adapter_t* const          p_adapter );\r
 \r
+void\r
+ipoib_set_inactive(\r
+       IN                              ipoib_adapter_t* const          p_adapter );\r
 \r
 ib_api_status_t\r
 ipoib_reset_adapter(\r
index dedc1d5..f501530 100644 (file)
@@ -4496,12 +4496,14 @@ __port_info_cb(
                NdisWriteErrorLogEntry( p_port->p_adapter->h_adapter,\r
                        EVENT_IPOIB_PORT_INFO_TIMEOUT, 0 );\r
                IPOIB_TRACE( IPOIB_DBG_INFO, ("Port info query timed out.\n") );\r
+               ipoib_set_inactive( p_port->p_adapter );\r
                break;\r
 \r
        case IB_REMOTE_ERROR:\r
                NdisWriteErrorLogEntry( p_port->p_adapter->h_adapter,\r
                        EVENT_IPOIB_PORT_INFO_REJECT, 0 );\r
                IPOIB_TRACE( IPOIB_DBG_INFO, ("Port info query rejected by SA.\n") );\r
+               ipoib_set_inactive( p_port->p_adapter );\r
                break;\r
 \r
        default:\r
@@ -4509,6 +4511,7 @@ __port_info_cb(
                        EVENT_IPOIB_QUERY_PORT_INFO, 1, p_query_rec->status );\r
                /* Hopefully we'll get an SM change event that will restart things. */\r
                IPOIB_TRACE( IPOIB_DBG_INFO, ("Port info query failed.\n") );\r
+               ipoib_set_inactive( p_port->p_adapter );\r
        }\r
 \r
        /* Return the response MAD to AL. */\r
@@ -4640,8 +4643,7 @@ __bcast_get_cb(
        default:\r
                NdisWriteErrorLogEntry( p_port->p_adapter->h_adapter,\r
                        EVENT_IPOIB_BCAST_GET, 1, p_query_rec->status );\r
-               /* Flag the adapter as hung. */\r
-               p_port->p_adapter->hung = TRUE;\r
+               ipoib_set_inactive( p_port->p_adapter );\r
        }\r
 \r
        /* Return the response MAD to AL. */\r
@@ -4885,8 +4887,7 @@ __bcast_cb(
                {\r
                        NdisWriteErrorLogEntry( p_port->p_adapter->h_adapter,\r
                                EVENT_IPOIB_BCAST_JOIN, 1, p_mcast_rec->status );\r
-                       /* Flag the adapter as hung. */\r
-                       p_port->p_adapter->hung = TRUE;\r
+                       ipoib_set_inactive( p_port->p_adapter );\r
                }\r
 \r
                cl_obj_deref( &p_port->obj );\r
@@ -5152,8 +5153,7 @@ __mcast_cb(
                IPOIB_TRACE( IPOIB_DBG_ERROR,\r
                        ("Multicast join request failed with status %s.\n",\r
                        p_port->p_adapter->p_ifc->get_err_str( p_mcast_rec->status )) );\r
-               /* Flag the adapter as hung. */\r
-               p_port->p_adapter->hung = TRUE;\r
+               ipoib_set_inactive( p_port->p_adapter );\r
                cl_obj_deref( &p_port->obj );\r
                IPOIB_EXIT( IPOIB_DBG_MCAST );\r
                return;\r