[IBBUS] remove late binding of BFI to GUID in favor of early binding in fdo_start().
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 17 Mar 2009 16:16:06 +0000 (16:16 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 17 Mar 2009 16:16:06 +0000 (16:16 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2034 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

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

index 9856cc8..7ba8123 100644 (file)
@@ -736,7 +736,9 @@ __read_registry(
        if( g_al_dbg_flags & AL_DBG_ERR )\r
                g_al_dbg_flags |= CL_DBG_ERROR;\r
 \r
-//     bus_globals.dbg_lvl |= BUS_DBG_DRV | BUS_DBG_PNP;\r
+       // For manageable Debug output: Disable Enter/Exit macros in\r
+       //  bus_drv_ioctl(), bus_drv_open(), bus_drv_cleanup()\r
+       // bus_globals.dbg_lvl |= BUS_DBG_DRV | BUS_DBG_PNP | BUS_DBG_POWER;\r
 #endif\r
 \r
        BUS_TRACE(BUS_DBG_DRV ,\r
index 69ca23f..7817284 100644 (file)
@@ -123,8 +123,8 @@ typedef struct _bus_fdo_ext
        /* Number of references on the CI interface. */\r
        atomic32_t                              n_ci_ifc_ref;\r
        /* HCA interface stuff */\r
-       RDMA_INTERFACE_VERBS            hca_ifc;\r
-       boolean_t                                       hca_ifc_taken;\r
+       RDMA_INTERFACE_VERBS    hca_ifc;\r
+       boolean_t                               hca_ifc_taken;\r
 \r
        struct _bus_filter_instance *bus_filter;\r
 \r
@@ -293,7 +293,6 @@ extern int free_bfi( IN bus_filter_t *p_bfi );
 extern int get_bfi_count( void );\r
 extern bus_filter_t *get_bfi_by_obj( IN int obj_type, IN cl_obj_t *p_obj );\r
 extern bus_filter_t *get_bfi_by_ca_guid( IN net64_t ca_guid );\r
-extern bus_filter_t *get_set_bfi_by_ca_guid( IN net64_t ca_guid );\r
 extern char *get_obj_state_str(cl_state_t state);\r
 \r
 inline VOID lock_control_event() {\r
index c30e4e9..4e83785 100644 (file)
@@ -676,7 +676,7 @@ iou_mgr_iou_add(
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
-       p_bfi = get_set_bfi_by_ca_guid( p_pnp_rec->ca_guid );\r
+       p_bfi = get_bfi_by_ca_guid( p_pnp_rec->ca_guid );\r
        if ( !p_bfi ) {\r
                BUS_TRACE_EXIT( BUS_DBG_PNP,("NULL p_bfi? ca_guid 0x%I64x\n",\r
                                                                        p_pnp_rec->ca_guid ) );\r
index 0878c5c..dcb25e3 100644 (file)
@@ -447,11 +447,11 @@ fdo_start(
                ASSERT( NT_SUCCESS( status ) );\r
        }\r
 \r
-       /* get MLX4_HCA verbs interface */\r
+       /* get HCA verbs interface */\r
        status = __get_ifc( p_dev_obj, &GUID_RDMA_INTERFACE_VERBS,\r
-               sizeof(RDMA_INTERFACE_VERBS), \r
-               VerbsVersion(VERBS_MAJOR_VER, VERBS_MINOR_VER), \r
-               p_ext, (PINTERFACE)&p_ext->hca_ifc );\r
+                                               sizeof(RDMA_INTERFACE_VERBS), \r
+                                               VerbsVersion(VERBS_MAJOR_VER, VERBS_MINOR_VER), \r
+                                               p_ext, (PINTERFACE)&p_ext->hca_ifc );\r
        if( !NT_SUCCESS( status ) ) \r
        {\r
                BUS_TRACE_EXIT(BUS_DBG_PNP,\r
@@ -469,10 +469,11 @@ fdo_start(
                return STATUS_UNSUCCESSFUL;\r
        }\r
 \r
-       BUS_PRINT(BUS_DBG_PNP,\r
-                               ("%s exit %x\n",p_bfi->whoami,status));\r
-       BUS_EXIT( BUS_DBG_PNP );\r
+       /* bind BFI to HCA by CA GUID */\r
+       p_bfi->ca_guid = ((const ci_interface_t*)&p_ext->hca_ifc.Verbs)->guid;\r
 \r
+       BUS_TRACE_EXIT(BUS_DBG_PNP, ("%s bound to CA guid %I64x\n",\r
+                                                                       p_bfi->whoami,p_bfi->ca_guid));\r
        return status;\r
 }\r
 \r
@@ -484,7 +485,6 @@ fdo_query_remove(
                OUT                             cl_irp_action_t* const  p_action )\r
 {\r
        bus_fdo_ext_t   *p_ext;\r
-       bus_filter_t    *p_bfi;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
@@ -516,8 +516,7 @@ fdo_query_remove(
        }\r
 \r
        /* remove port & iou managers */        \r
-       p_bfi = p_ext->bus_filter;\r
-       CL_ASSERT( p_bfi );\r
+       CL_ASSERT( p_ext->bus_filter );\r
 \r
        //TODO: Fail outstanding I/O operations.\r
 \r
@@ -1435,6 +1434,7 @@ get_bfi_by_obj(IN int obj_type, IN cl_obj_t *p_obj )
 \r
 /*\r
  * find a bus filter instance given an HCA guid.\r
+ * BFIs are bound to GUIDs in fdo_start().\r
  */\r
 \r
 bus_filter_t *\r
@@ -1478,81 +1478,6 @@ get_bfi_by_ca_guid( IN net64_t ca_guid )
 }\r
 \r
 \r
-/*\r
- * find/bind the specified ca_guid to a bus filter instance.\r
- * Called from PORT_ADD or IOU_ADD pnp callback routines with the ca_guid from\r
- * the pnp event record.\r
- * Assumption is a BFI slot has been allocated in add_device() although the\r
- * ca_guid was not known at that time; hence !ca_bound. When PNP generates an\r
- * 'ADD' event, the port_mgr/iou_mgr pnp callback routine calls here to match\r
- * the input ca_guid which caused the PNP event to the BFI instance by ca_guid.\r
- * In the 1st call after add_device() the BFI slot is allocated but not yet \r
- * bound to a CA guid. If the input ca_guid is not matched, then the 1st\r
- * allocated but not bound BFI slot is then 'bound' by setting\r
- * bfi->ca_guid = input ca_guid.\r
- */\r
-\r
-bus_filter_t *\r
-get_set_bfi_by_ca_guid( IN net64_t ca_guid )\r
-{\r
-       bus_filter_t    *p_bfi;\r
-       bus_filter_t    *matched=NULL;\r
-       boolean_t               ca_bound = FALSE;\r
-\r
-       if ( ca_guid == 0ULL )\r
-       {\r
-               matched = g_bus_filters;\r
-               BUS_PRINT( BUS_DBG_PNP, ("%s() ERR guid 0x%I64x -> bfi[0] %p\n",\r
-                                       __FUNCTION__, ca_guid, matched) );\r
-               CL_ASSERT( ca_guid );\r
-               return matched;\r
-       }\r
-\r
-       for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
-       {\r
-               if ( !p_bfi->p_bus_ext )\r
-                       continue;\r
-\r
-               if ( ca_guid == p_bfi->ca_guid )\r
-               {\r
-                       matched = p_bfi;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       /*\r
-        * if no match, find an 'allocated' bfi slot which does not have a bound CA.\r
-        * Bound == ca_guid != 0ULL.\r
-        */\r
-       if ( !matched )\r
-       {\r
-               lock_control_event();\r
-\r
-               for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)\r
-               {\r
-                       if ( !p_bfi->p_bus_ext )\r
-                               continue;       // not allocated.\r
-\r
-                       if ( p_bfi->ca_guid == 0ULL )\r
-                       {\r
-                               ca_bound = TRUE;\r
-                               p_bfi->ca_guid = ca_guid;       // bind CA & this BFI slot; RTU.\r
-                               matched = p_bfi;\r
-                               break;\r
-                       }\r
-               }\r
-               unlock_control_event();\r
-       }\r
-\r
-       BUS_PRINT( BUS_DBG_PNP,\r
-                               ("%s()%sguid 0x%I64x @ bfi[%d] %p \n",\r
-                               __FUNCTION__, (ca_bound ? "SET ":" "), ca_guid,\r
-                               (matched ? (matched - g_bus_filters) : (-1)), matched ) );\r
-\r
-       return matched;\r
-}\r
-\r
-\r
 bus_filter_t *\r
 alloc_bfi( IN DRIVER_OBJECT  *p_driver_obj, OUT int *p_instance_count )\r
 {\r
index cc61343..ea823d6 100644 (file)
@@ -410,6 +410,7 @@ free_port_mgr(
                                p_ext, p_ext->b_present, p_ext->b_reported_missing ) );\r
                        continue;\r
                }\r
+\r
                if( p_ext->h_ca && p_ext->hca_acquired )\r
                {\r
                        /* Invalidate bus relations for the HCA. */\r
@@ -755,7 +756,7 @@ port_mgr_port_add(
 \r
        CL_ASSERT( p_pnp_rec->p_ca_attr->ca_guid );\r
 \r
-       p_bfi = get_set_bfi_by_ca_guid( p_pnp_rec->p_ca_attr->ca_guid );\r
+       p_bfi = get_bfi_by_ca_guid( p_pnp_rec->p_ca_attr->ca_guid );\r
        if ( !p_bfi ) {\r
                BUS_TRACE_EXIT( BUS_DBG_PNP,("NULL p_bfi? ca_guid 0x%I64x\n",\r
                                                                p_pnp_rec->p_ca_attr->ca_guid ) );\r
@@ -1856,7 +1857,8 @@ port_query_ipoib_ifc(
 \r
        BUS_TRACE( BUS_DBG_PNP, ("Query i/f for %s: PDO %p (=%p),ext %p, present %d, missing %d, hibernated %d .\n",\r
                p_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_ext->pdo.cl_ext.p_self_do, \r
-               p_dev_obj, p_ext, p_ext->pdo.b_present, p_ext->pdo.b_reported_missing, p_ext->pdo.b_hibernating ) );\r
+               p_dev_obj, p_ext, p_ext->pdo.b_present, p_ext->pdo.b_reported_missing,\r
+               p_ext->pdo.b_hibernating ) );\r
 \r
        /* Get the interface. */\r
        status = cl_fwd_query_ifc(\r