[IPoIB] Fix NDIS WHQL 1c_Reset test failures.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 15 Mar 2006 00:03:33 +0000 (00:03 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 15 Mar 2006 00:03:33 +0000 (00:03 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@245 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/ipoib_adapter.c
ulp/ipoib/kernel/ipoib_adapter.h
ulp/ipoib/kernel/ipoib_driver.c
ulp/ipoib/kernel/ipoib_port.c

index 7e90b6d..1ff47f5 100644 (file)
@@ -212,7 +212,8 @@ ipoib_start_adapter(
 \r
        IPOIB_ENTER( IPOIB_DBG_INIT );\r
 \r
-       status = __ipoib_pnp_reg( p_adapter, IB_PNP_FLAG_REG_SYNC );\r
+       status = __ipoib_pnp_reg( p_adapter,\r
+               IB_PNP_FLAG_REG_SYNC | IB_PNP_FLAG_REG_COMPLETE );\r
 \r
        IPOIB_EXIT( IPOIB_DBG_INIT );\r
        return status;\r
@@ -371,6 +372,9 @@ __ipoib_pnp_reg(
        IPOIB_ENTER( IPOIB_DBG_INIT );\r
 \r
        CL_ASSERT( !p_adapter->h_pnp );\r
+       CL_ASSERT( !p_adapter->registering );\r
+\r
+       p_adapter->registering = TRUE;\r
 \r
        /* Register for PNP events. */\r
        cl_memclr( &pnp_req, sizeof(pnp_req) );\r
@@ -384,6 +388,7 @@ __ipoib_pnp_reg(
        status = p_adapter->p_ifc->reg_pnp( p_adapter->h_al, &pnp_req, &p_adapter->h_pnp );\r
        if( status != IB_SUCCESS )\r
        {\r
+               p_adapter->registering = FALSE;\r
                IPOIB_TRACE_EXIT( IPOIB_DBG_ERROR,\r
                        ("ib_reg_pnp returned %s\n", \r
                        p_adapter->p_ifc->get_err_str( status )) );\r
@@ -573,8 +578,10 @@ __ipoib_pnp_cb(
 \r
        case IB_PNP_PORT_INIT:\r
        case IB_PNP_PORT_ARMED:\r
+               status = IB_SUCCESS;\r
+               break;\r
+\r
        case IB_PNP_PORT_DOWN:\r
-               /* Leave multicast groups. */\r
                CL_ASSERT( p_pnp_rec->context );\r
 \r
                cl_obj_lock( &p_adapter->obj );\r
@@ -583,9 +590,8 @@ __ipoib_pnp_cb(
                cl_obj_unlock( &p_adapter->obj );\r
                status = IB_SUCCESS;\r
 \r
-               switch( old_state )\r
+               if( !p_adapter->registering /*&& old_state == IB_PNP_PORT_ACTIVE*/ )\r
                {\r
-               case IB_PNP_PORT_ACTIVE:\r
                        NdisMIndicateStatus( p_adapter->h_adapter,\r
                                NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0 );\r
                        NdisMIndicateStatusComplete( p_adapter->h_adapter );\r
@@ -593,25 +599,30 @@ __ipoib_pnp_cb(
                        IPOIB_TRACE( IPOIB_DBG_INFO, ("Link DOWN!\n") );\r
 \r
                        ipoib_port_down( p_adapter->p_port );\r
-                       break;\r
-\r
-               case IB_PNP_PORT_ADD:\r
-                       /* If we were initializing, we might have pended some OIDs. */\r
-                       ipoib_resume_oids( p_adapter );\r
-                       NdisMIndicateStatus( p_adapter->h_adapter,\r
-                               NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0 );\r
-                       NdisMIndicateStatusComplete( p_adapter->h_adapter );\r
-                       break;\r
-\r
-               default:\r
-                       break;\r
                }\r
                break;\r
 \r
        case IB_PNP_REG_COMPLETE:\r
-               if( p_adapter->hung )\r
+               if( p_adapter->registering )\r
                {\r
-                       p_adapter->hung = FALSE;\r
+                       p_adapter->registering = FALSE;\r
+                       cl_obj_lock( &p_adapter->obj );\r
+                       old_state = p_adapter->state;\r
+                       cl_obj_unlock( &p_adapter->obj );\r
+\r
+                       if( old_state == IB_PNP_PORT_DOWN )\r
+                       {\r
+                               /* If we were initializing, we might have pended some OIDs. */\r
+                               ipoib_resume_oids( p_adapter );\r
+                               NdisMIndicateStatus( p_adapter->h_adapter,\r
+                                       NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0 );\r
+                               NdisMIndicateStatusComplete( p_adapter->h_adapter );\r
+                       }\r
+               }\r
+\r
+               if( p_adapter->reset && p_adapter->state != IB_PNP_PORT_ACTIVE )\r
+               {\r
+                       p_adapter->reset = FALSE;\r
                        NdisMResetComplete(\r
                                p_adapter->h_adapter, NDIS_STATUS_SUCCESS, TRUE );\r
                }\r
@@ -719,6 +730,9 @@ ipoib_reset_adapter(
 \r
        IPOIB_ENTER( IPOIB_DBG_INIT );\r
 \r
+       p_adapter->hung = FALSE;\r
+       p_adapter->reset = TRUE;\r
+\r
        if( p_adapter->h_pnp )\r
        {\r
                status = p_adapter->p_ifc->dereg_pnp(\r
@@ -772,16 +786,12 @@ __ipoib_pnp_dereg(
        if( p_port )\r
                ipoib_port_destroy( p_port );\r
 \r
-       /* Complete any pending OIDs. */\r
-       ipoib_resume_oids( p_adapter );\r
-       ipoib_dereg_addrs( p_adapter );\r
-\r
        if( state != IB_PNP_PORT_REMOVE )\r
        {\r
                status = __ipoib_pnp_reg( p_adapter, IB_PNP_FLAG_REG_COMPLETE );\r
                if( status != IB_SUCCESS )\r
                {\r
-                       p_adapter->hung = FALSE;\r
+                       p_adapter->reset = FALSE;\r
                        IPOIB_TRACE( IPOIB_DBG_ERROR,\r
                                ("__ipoib_pnp_reg returned %s\n",\r
                                p_adapter->p_ifc->get_err_str( status )) );\r
@@ -791,7 +801,7 @@ __ipoib_pnp_dereg(
        }\r
        else\r
        {\r
-               p_adapter->hung = FALSE;\r
+               p_adapter->reset = FALSE;\r
                NdisMResetComplete(\r
                        p_adapter->h_adapter, NDIS_STATUS_SUCCESS, TRUE );\r
                status = IB_SUCCESS;\r
@@ -929,6 +939,13 @@ ipoib_set_active(
                NdisMIndicateStatusComplete( p_adapter->h_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
index 3a1849a..d516c9d 100644 (file)
@@ -135,6 +135,8 @@ typedef struct _ipoib_adapter
 \r
        ib_pnp_event_t                  state;\r
        boolean_t                               hung;\r
+       boolean_t                               reset;\r
+       boolean_t                               registering;\r
 \r
        boolean_t                               pending_query;\r
        pending_oid_t                   query_oid;\r
index 4047adb..d0cfd95 100644 (file)
@@ -723,6 +723,14 @@ ipoib_check_for_hang(
        IPOIB_ENTER( IPOIB_DBG_INIT );\r
        CL_ASSERT( adapter_context );\r
        p_adapter = (ipoib_adapter_t*)adapter_context;\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
        return (p_adapter->hung? TRUE:FALSE);\r
 }\r
index fe757a4..dedc1d5 100644 (file)
@@ -2484,7 +2484,7 @@ __send_mgr_destroy(
        {\r
                p_packet = IPOIB_PACKET_FROM_LIST_ITEM( p_item );\r
                NdisMSendComplete( p_port->p_adapter->h_adapter, p_packet,\r
-                       NDIS_STATUS_REQUEST_ABORTED );\r
+                       NDIS_STATUS_RESET_IN_PROGRESS );\r
        }\r
 \r
        IPOIB_EXIT( IPOIB_DBG_SEND );\r