[IBBUS] force last HCA to remain until IBAL has shutdown, then release IF reference...
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 19 May 2009 19:38:17 +0000 (19:38 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 19 May 2009 19:38:17 +0000 (19:38 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2189 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/bus/kernel/bus_pnp.c

index dc4da56..fc9da4e 100644 (file)
@@ -576,7 +576,10 @@ fdo_release_resources(
                p_ext->p_iou_mgr = NULL;\r
        }\r
 \r
-       if ( ic > 0 && p_ext->hca_ifc_taken ) {\r
+       /* if not last HCA then release IFC reference, otherwise release IFC after\r
+        * IBAL has shutdown; keep the HCA present until IBAL is terminated.\r
+        */\r
+       if ( ic > 1 && p_ext->hca_ifc_taken ) {\r
                p_ext->hca_ifc.InterfaceHeader.InterfaceDereference(\r
                        p_ext->hca_ifc.InterfaceHeader.Context);\r
                p_ext->hca_ifc_taken = FALSE;\r
@@ -614,7 +617,7 @@ fdo_release_resources(
        al_cleanup();\r
        cl_thread_suspend(50);  /* allow time for AL's async procs to run to exit */\r
 \r
-       ASSERT( !gp_async_proc_mgr && !gp_async_pnp_mgr && !gp_al_mgr );\r
+       CL_ASSERT( !gp_async_proc_mgr && !gp_async_pnp_mgr && !gp_al_mgr );\r
 \r
        /* AL needs the HCA to stick around until AL cleanup has completed.\r
         * Now that it's done, let the HCA fade away.\r
@@ -749,6 +752,8 @@ al_ref_ifc(
 \r
        p_ext = p_dev_obj->DeviceExtension;\r
 \r
+       CL_ASSERT( p_ext->n_al_ifc_ref >= 0 );\r
+\r
        cl_atomic_inc( &p_ext->n_al_ifc_ref );\r
        ObReferenceObject( p_dev_obj );\r
 \r
@@ -766,14 +771,10 @@ al_deref_ifc(
 \r
        p_ext = p_dev_obj->DeviceExtension;\r
 \r
+       CL_ASSERT( p_ext->n_al_ifc_ref > 0 );\r
        cl_atomic_dec( &p_ext->n_al_ifc_ref );\r
        ObDereferenceObject( p_dev_obj );\r
 \r
-       CL_ASSERT(p_ext->bus_filter);\r
-       BUS_PRINT( BUS_DBG_PNP, ("%s CA_guid %I64x al_ifc_ref %d\n",\r
-                                       p_ext->bus_filter->whoami, p_ext->bus_filter->ca_guid,\r
-                                       p_ext->n_al_ifc_ref) );\r
-\r
        BUS_EXIT( BUS_DBG_PNP );\r
 }\r
 \r
@@ -788,6 +789,7 @@ al_ref_ci_ifc(
 \r
        p_ext = p_dev_obj->DeviceExtension;\r
 \r
+       CL_ASSERT( p_ext->n_ci_ifc_ref >= 0 );\r
        cl_atomic_inc( &p_ext->n_ci_ifc_ref );\r
        ObReferenceObject( p_dev_obj );\r
 \r
@@ -805,13 +807,11 @@ al_deref_ci_ifc(
 \r
        p_ext = p_dev_obj->DeviceExtension;\r
 \r
+       CL_ASSERT( p_ext->n_ci_ifc_ref > 0 );\r
+\r
        cl_atomic_dec( &p_ext->n_ci_ifc_ref );\r
        ObDereferenceObject( p_dev_obj );\r
 \r
-       CL_ASSERT(p_ext->bus_filter);\r
-       BUS_PRINT( BUS_DBG_PNP, ("%s CA_guid %I64x ci_ifc_ref %d\n",\r
-                                               p_ext->bus_filter->whoami, p_ext->bus_filter->ca_guid,\r
-                                               p_ext->n_ci_ifc_ref) );\r
 \r
        BUS_EXIT( BUS_DBG_PNP );\r
 }\r