]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[IPoIB_NDIS6_CM] The patch prevents race with BSOD when NDIS call receive callback...
authorStan Smith <stan.smith@intel.com>
Thu, 7 Oct 2010 19:51:42 +0000 (19:51 +0000)
committerStan Smith <stan.smith@intel.com>
Thu, 7 Oct 2010 19:51:42 +0000 (19:51 +0000)
some ipoib global objects are under destruction (like p_adapter ->p_port).
It was tested by night regression run on IPoIB driver

Adding shutter_shut for Adapter Reset flow

Signed-off by: Alexander Naslednikov (xalex at mellanox.co.il)

git-svn-id: svn://openib.tc.cornell.edu/gen1@2963 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

branches/WOF2-3/ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.cpp
branches/WOF2-3/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp
trunk/ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.cpp
trunk/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp

index 217b8df74b6ddf2b88a5d5faaa133922db74a1af..a7f846c325becdd59efc9c405cbb70bbcb22caa2 100644 (file)
@@ -992,6 +992,8 @@ ipoib_reset_adapter(
                h_pnp = p_adapter->h_pnp;\r
                p_adapter->h_pnp  = NULL;\r
                status = p_adapter->p_ifc->dereg_pnp( h_pnp, __ipoib_pnp_dereg );\r
+               // Wait until NDIS will return all indicated NBLs that were received\r
+               shutter_shut( &p_adapter->recv_shutter );\r
                if( status == IB_SUCCESS )\r
                        status = IB_NOT_DONE;\r
        }\r
index 1b7a37b3a65cbca40f466dba21e3b43113ddf0f8..db092b70633e89ea1f35ac07d709483496252bcf 100644 (file)
@@ -830,11 +830,15 @@ __port_init(
        IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_OBJ,\r
                ("ref type %d ref_cnt %d\n", ref_init, p_port->obj.ref_cnt) );\r
 #endif\r
-       // The port is started as paused and NDIS calls latter to ipoib_restart. We\r
-       // shut the recv_shuter for now and alive it on ipoib_restart. We did\r
-       // it in this way since MpInitializeInternal also calls in reset and than\r
-       // we need to set the rec ref count to 1 //TODO !!!!!!!!!!1\r
-       //\r
+       /* The steps of the initialization are as depicted below:\r
+        I.     adapter_init() calls shutter_init(), the shutter counter is set to 0\r
+       II.     ipoib_pnp_cb() calls to ipoib_port_init() that calls to __port_init() that SHOULD set shutter counter to -MAX_OPERATIONS\r
+               That is, the code below should call to shutter_shut()\r
+       III.NDIS calls to ipoib_restart() that calls to shutter_alive. Now, shutter_counter is again 0.\r
+       IV.     NDIS call to ipoib_pause() that sets the adapter to pause state, calls to shutter_shut. \r
+               Now, the counter is again equals to -MAX_OPERATIONS\r
+       V.      NDIS calls to ipoib_restart that calls to shutter_alive. Shutter counter is 0 and we can start working\r
+       */\r
        \r
        if ( p_adapter->ipoib_state == IPOIB_INIT) {\r
                IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_RECV,\r
index 217b8df74b6ddf2b88a5d5faaa133922db74a1af..a7f846c325becdd59efc9c405cbb70bbcb22caa2 100644 (file)
@@ -992,6 +992,8 @@ ipoib_reset_adapter(
                h_pnp = p_adapter->h_pnp;\r
                p_adapter->h_pnp  = NULL;\r
                status = p_adapter->p_ifc->dereg_pnp( h_pnp, __ipoib_pnp_dereg );\r
+               // Wait until NDIS will return all indicated NBLs that were received\r
+               shutter_shut( &p_adapter->recv_shutter );\r
                if( status == IB_SUCCESS )\r
                        status = IB_NOT_DONE;\r
        }\r
index 1b7a37b3a65cbca40f466dba21e3b43113ddf0f8..db092b70633e89ea1f35ac07d709483496252bcf 100644 (file)
@@ -830,11 +830,15 @@ __port_init(
        IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_OBJ,\r
                ("ref type %d ref_cnt %d\n", ref_init, p_port->obj.ref_cnt) );\r
 #endif\r
-       // The port is started as paused and NDIS calls latter to ipoib_restart. We\r
-       // shut the recv_shuter for now and alive it on ipoib_restart. We did\r
-       // it in this way since MpInitializeInternal also calls in reset and than\r
-       // we need to set the rec ref count to 1 //TODO !!!!!!!!!!1\r
-       //\r
+       /* The steps of the initialization are as depicted below:\r
+        I.     adapter_init() calls shutter_init(), the shutter counter is set to 0\r
+       II.     ipoib_pnp_cb() calls to ipoib_port_init() that calls to __port_init() that SHOULD set shutter counter to -MAX_OPERATIONS\r
+               That is, the code below should call to shutter_shut()\r
+       III.NDIS calls to ipoib_restart() that calls to shutter_alive. Now, shutter_counter is again 0.\r
+       IV.     NDIS call to ipoib_pause() that sets the adapter to pause state, calls to shutter_shut. \r
+               Now, the counter is again equals to -MAX_OPERATIONS\r
+       V.      NDIS calls to ipoib_restart that calls to shutter_alive. Shutter counter is 0 and we can start working\r
+       */\r
        \r
        if ( p_adapter->ipoib_state == IPOIB_INIT) {\r
                IPOIB_PRINT( TRACE_LEVEL_INFORMATION, IPOIB_DBG_RECV,\r