[IBBUS] remove duplicate FDO extension fields [p_port_mgr,p_iou_mgr] and use same...
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 19 May 2009 20:07:23 +0000 (20:07 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 19 May 2009 20:07:23 +0000 (20:07 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2191 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/bus/kernel/bus_driver.h
core/bus/kernel/bus_iou_mgr.c
core/bus/kernel/bus_iou_mgr.h
core/bus/kernel/bus_pnp.c
core/bus/kernel/bus_port_mgr.c
core/bus/kernel/bus_port_mgr.h

index 7817284..08fc71f 100644 (file)
@@ -115,9 +115,6 @@ typedef struct _bus_fdo_ext
         */\r
        DEVICE_POWER_STATE              po_state[PowerSystemMaximum];\r
 \r
-       port_mgr_t                              *p_port_mgr;\r
-       iou_mgr_t                               *p_iou_mgr;\r
-\r
        /* Number of references on the upper interface. */\r
        atomic32_t                              n_al_ifc_ref;\r
        /* Number of references on the CI interface. */\r
index 4e9a120..8164369 100644 (file)
@@ -262,8 +262,7 @@ static const cl_vfptr_query_txt_t           vfptr_iou_query_txt = {
  */\r
 ib_api_status_t\r
 create_iou_mgr(\r
-       IN                              bus_filter_t*                           p_bfi,\r
-               OUT                     iou_mgr_t** const                       pp_iou_mgr )\r
+       IN                              bus_filter_t*                           p_bfi )\r
 {\r
        ib_api_status_t         status;\r
        cl_status_t                     cl_status;\r
@@ -284,7 +283,9 @@ create_iou_mgr(
 \r
        /* Construct the load service. */\r
        cl_obj_construct( &gp_iou_mgr->obj, AL_OBJ_TYPE_LOADER );\r
+\r
        p_bfi->p_iou_mgr_obj = &p_bfi->p_iou_mgr->obj; // save for destroy & free\r
+\r
        cl_mutex_construct( &gp_iou_mgr->pdo_mutex );\r
        cl_qlist_init( &gp_iou_mgr->iou_list );\r
 \r
@@ -318,8 +319,6 @@ create_iou_mgr(
                return status;\r
        }\r
 \r
-       *pp_iou_mgr = gp_iou_mgr;\r
-\r
        BUS_EXIT( BUS_DBG_PNP );\r
        return IB_SUCCESS;\r
 }\r
@@ -346,8 +345,8 @@ destroying_iou_mgr(
        }\r
        gp_iou_mgr = p_bfi->p_iou_mgr;\r
 \r
-       BUS_PRINT(BUS_DBG_PNP, ("%s obj %p port_mgr %p\n",\r
-                                                       p_bfi->whoami, p_obj, gp_iou_mgr));\r
+       BUS_PRINT(BUS_DBG_PNP, ("%s obj %p iou_mgr %p iou_mgr_obj %p\n",\r
+                                                       p_bfi->whoami, p_obj,gp_iou_mgr,&gp_iou_mgr->obj));\r
 \r
        CL_ASSERT( gp_iou_mgr == PARENT_STRUCT( p_obj, iou_mgr_t, obj ) );\r
 \r
@@ -381,11 +380,12 @@ free_iou_mgr(
        CL_ASSERT( p_obj );\r
        p_bfi = get_bfi_by_obj( BFI_IOU_MGR_OBJ, p_obj );\r
        if ( p_bfi == NULL ) {\r
-               BUS_PRINT( BUS_DBG_PNP, ("Unable to get p_bfi iou_obj %p?\n", p_obj) );\r
+               BUS_TRACE( BUS_DBG_ERROR, ("Unable to get p_bfi iou_obj %p?\n", p_obj) );\r
                return;\r
        }\r
        gp_iou_mgr = p_bfi->p_iou_mgr;\r
        if ( !gp_iou_mgr ) {\r
+               BUS_TRACE_EXIT( BUS_DBG_ERROR, ("%s <null> IOU mgr?\n",p_bfi->whoami) );\r
                // if create fails & then free is called, p_bfi->p_iou_mgr == NULL\r
                return;\r
        }\r
@@ -481,7 +481,7 @@ bus_reg_iou_pnp( IN bus_filter_t *p_bfi )
        if ( status == IB_SUCCESS )\r
        {\r
                /* Reference the load service on behalf of the ib_reg_pnp call. */\r
-               cl_obj_ref( &p_bfi->p_iou_mgr->obj );\r
+               cl_obj_ref( p_bfi->p_iou_mgr_obj );\r
        }\r
 \r
        return status;\r
@@ -650,8 +650,8 @@ __iou_was_hibernated(
        }\r
        else \r
        {\r
-               BUS_TRACE( BUS_DBG_PNP, ("%s Failed to find PDO for guid  %I64x .\n",\r
-                                       p_bfi->whoami, p_pnp_rec->pnp_rec.guid ) );\r
+               BUS_TRACE( BUS_DBG_PNP, ("%s Failed to find PDO for guid %I64x\n",\r
+                                                               p_bfi->whoami, p_pnp_rec->pnp_rec.guid ) );\r
                status = IB_NOT_FOUND;\r
        }\r
 \r
index bfe420f..debca84 100644 (file)
@@ -57,9 +57,7 @@ struct _bus_filter_instance;
 \r
 ib_api_status_t\r
 create_iou_mgr(\r
-               IN                      struct _bus_filter_instance*    p_bfi,\r
-               OUT                     iou_mgr_t** const                               pp_iou_mgr );\r
-\r
+               IN                      struct _bus_filter_instance*    p_bfi );\r
 \r
 NTSTATUS\r
 iou_mgr_get_bus_relations(\r
index fc9da4e..74de4f2 100644 (file)
@@ -425,7 +425,7 @@ fdo_start(
        unlock_control_event();\r
 \r
        /* Initialize the port manager. */\r
-       ib_status = create_port_mgr( p_ext->bus_filter, &p_ext->p_port_mgr );\r
+       ib_status = create_port_mgr( p_ext->bus_filter );\r
        if( ib_status != IB_SUCCESS )\r
        {\r
                BUS_TRACE_EXIT( BUS_DBG_ERROR, ("create_port_mgr returned %s.\n",\r
@@ -434,7 +434,7 @@ fdo_start(
        }\r
 \r
        /* Initialize the IOU manager. */\r
-       ib_status = create_iou_mgr( p_ext->bus_filter, &p_ext->p_iou_mgr );\r
+       ib_status = create_iou_mgr( p_ext->bus_filter );\r
        if( ib_status != IB_SUCCESS )\r
        {\r
                BUS_TRACE_EXIT( BUS_DBG_ERROR, ("create_iou_mgr returned %s.\n",\r
@@ -566,15 +566,12 @@ fdo_release_resources(
                        ib_get_err_str(ib_status)) );\r
        }\r
 \r
-       if ( p_ext->p_port_mgr && p_bfi->p_port_mgr ) {\r
-               cl_obj_destroy( &p_ext->p_port_mgr->obj );\r
-               p_ext->p_port_mgr = NULL;\r
-       }\r
+       if ( p_bfi->p_port_mgr )\r
+               cl_obj_destroy( p_bfi->p_port_mgr_obj );\r
+\r
+       if ( p_bfi->p_iou_mgr )\r
+               cl_obj_destroy( p_bfi->p_iou_mgr_obj );\r
 \r
-       if ( p_ext->p_iou_mgr && p_bfi->p_iou_mgr ) {\r
-               cl_obj_destroy( &p_ext->p_iou_mgr->obj );\r
-               p_ext->p_iou_mgr = NULL;\r
-       }\r
 \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
@@ -595,7 +592,7 @@ fdo_release_resources(
 \r
        /* if not last Buf Filter Instance, then exit, otherwise cleanup/shutdown */\r
        if ( ic > 0 ) {\r
-               BUS_TRACE( BUS_DBG_PNP, ("%d remaining BusFilters\n", ic ));\r
+               BUS_TRACE_EXIT( BUS_DBG_PNP, ("%d remaining BusFilters\n", ic ));\r
                return;\r
        }\r
 \r
index 9663f55..1b839c7 100644 (file)
@@ -254,8 +254,7 @@ static const cl_vfptr_query_txt_t           vfptr_port_query_txt = {
  */\r
 ib_api_status_t\r
 create_port_mgr(\r
-               IN                      bus_filter_t*                           p_bfi,\r
-               OUT                     port_mgr_t** const                      pp_port_mgr )\r
+               IN                      bus_filter_t*                           p_bfi )\r
 {\r
        ib_api_status_t         status;\r
        cl_status_t                     cl_status;\r
@@ -276,7 +275,9 @@ create_port_mgr(
 \r
        /* Construct the load service. */\r
        cl_obj_construct( &p_port_mgr->obj, AL_OBJ_TYPE_LOADER );\r
+\r
        p_bfi->p_port_mgr_obj = &p_port_mgr->obj;\r
+\r
        cl_mutex_construct( &p_port_mgr->pdo_mutex );\r
        cl_qlist_init( &p_port_mgr->port_list );\r
 \r
@@ -302,7 +303,7 @@ create_port_mgr(
        }\r
 \r
        /* Register for port PnP events */\r
-       status = bus_reg_port_pnp(p_bfi);\r
+       status = bus_reg_port_pnp( p_bfi );\r
        if( status != IB_SUCCESS )\r
        {\r
                BUS_TRACE_EXIT( BUS_DBG_ERROR,\r
@@ -311,8 +312,6 @@ create_port_mgr(
                return status;\r
        }\r
 \r
-       *pp_port_mgr = p_port_mgr;\r
-\r
        BUS_EXIT( BUS_DBG_PNP );\r
        return IB_SUCCESS;\r
 }\r
@@ -342,7 +341,6 @@ destroying_port_mgr(
        BUS_PRINT(BUS_DBG_PNP, ("%s obj %p port_mgr %p port_mgr_obj %p\n",\r
                        p_bfi->whoami,p_obj,p_port_mgr, p_bfi->p_port_mgr_obj) );\r
 \r
-       CL_ASSERT( (void*)p_bfi->p_port_mgr == (void*)p_bfi->p_port_mgr_obj );\r
        CL_ASSERT( p_port_mgr == PARENT_STRUCT( p_obj, port_mgr_t, obj ) );\r
 \r
        /* Deregister for port PnP events if this is the last Port manager. */\r
@@ -476,7 +474,7 @@ bus_reg_port_pnp( IN bus_filter_t *p_bfi )
        if ( status == IB_SUCCESS )\r
        {\r
                /* Reference this bus filter's port load service */\r
-               cl_obj_ref( &p_bfi->p_port_mgr->obj );\r
+               cl_obj_ref( p_bfi->p_port_mgr_obj );\r
        }\r
 \r
        return status;\r
@@ -1254,7 +1252,6 @@ port_mgr_port_remove(
                }                       \r
        }\r
 \r
-\r
        BUS_TRACE( BUS_DBG_PNP,\r
                ("Mark removing %s: PDO %p, ext %p, present %d, missing %d .\n",\r
                p_ext->cl_ext.vfptr_pnp_po->identity, p_ext->cl_ext.p_self_do, p_ext,\r
@@ -1473,7 +1470,7 @@ port_surprise_remove(
 \r
        p_ext = p_dev_obj->DeviceExtension;\r
        //\r
-       // Setting 2 folloeing flags seems like the right behaviour\r
+       // Setting 2 following flags seems like the right behaviour\r
        // according to DDK, but it causes \r
        // WHQL PnP SurpriseRemoval test to fail\r
        // So, as a work around, they are disabled for now.\r
index 1d0eb7f..c3cd60a 100644 (file)
@@ -57,8 +57,7 @@ struct _bus_filter_instance;
 \r
 ib_api_status_t\r
 create_port_mgr(\r
-       IN                              struct _bus_filter_instance     *p_bfi,\r
-               OUT                     port_mgr_t** const                      pp_port_mgr );\r
+       IN                              struct _bus_filter_instance     *p_bfi );\r
 \r
 \r
 NTSTATUS\r