[ofw] [IBBUS] Change BFI --> HCA GUID binding from late to early in fdo_start()

Smith, Stan stan.smith at intel.com
Tue Mar 17 09:48:15 PDT 2009


Applied in svn.2034

Signed off by stan.smith at intel.com

Bind BFI (Bus Filter Instance) to HCA GUID in fdo_start() instead of waiting until PORT ADD event.

diff U3 C:/Documents and Settings/scsmith/Local Settings/Temp/bus_pnp.c-revBASE.svn001.tmp.c C:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/core/bus/kernel/bus_pnp.c
--- C:/Documents and Settings/scsmith/Local Settings/Temp/bus_pnp.c-revBASE.svn001.tmp.c        Tue Mar 17 09:10:59 2009
+++ C:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/core/bus/kernel/bus_pnp.c      Tue Mar 17 08:56:25 2009
@@ -447,11 +447,11 @@
                ASSERT( NT_SUCCESS( status ) );
        }

-       /* get MLX4_HCA verbs interface */
+       /* get HCA verbs interface */
        status = __get_ifc( p_dev_obj, &GUID_RDMA_INTERFACE_VERBS,
-               sizeof(RDMA_INTERFACE_VERBS),
-               VerbsVersion(VERBS_MAJOR_VER, VERBS_MINOR_VER),
-               p_ext, (PINTERFACE)&p_ext->hca_ifc );
+                                               sizeof(RDMA_INTERFACE_VERBS),
+                                               VerbsVersion(VERBS_MAJOR_VER, VERBS_MINOR_VER),
+                                               p_ext, (PINTERFACE)&p_ext->hca_ifc );
        if( !NT_SUCCESS( status ) )
        {
                BUS_TRACE_EXIT(BUS_DBG_PNP,
@@ -469,10 +469,11 @@
                return STATUS_UNSUCCESSFUL;
        }

-       BUS_PRINT(BUS_DBG_PNP,
-                               ("%s exit %x\n",p_bfi->whoami,status));
-       BUS_EXIT( BUS_DBG_PNP );
+       /* bind BFI to HCA by CA GUID */
+       p_bfi->ca_guid = ((const ci_interface_t*)&p_ext->hca_ifc.Verbs)->guid;

+       BUS_TRACE_EXIT(BUS_DBG_PNP, ("%s bound to CA guid %I64x\n",
+                                                                       p_bfi->whoami,p_bfi->ca_guid));
        return status;
 }

@@ -484,7 +485,6 @@
                OUT                             cl_irp_action_t* const  p_action )
 {
        bus_fdo_ext_t   *p_ext;
-       bus_filter_t    *p_bfi;

        BUS_ENTER( BUS_DBG_PNP );

@@ -516,8 +516,7 @@
        }

        /* remove port & iou managers */
-       p_bfi = p_ext->bus_filter;
-       CL_ASSERT( p_bfi );
+       CL_ASSERT( p_ext->bus_filter );

        //TODO: Fail outstanding I/O operations.

@@ -1435,6 +1434,7 @@

 /*
  * find a bus filter instance given an HCA guid.
+ * BFIs are bound to GUIDs in fdo_start().
  */

 bus_filter_t *
@@ -1474,81 +1474,6 @@
                                                                        ca_guid, -1, matched ) );
        }
 #endif
-       return matched;
-}
-
-
-/*
- * find/bind the specified ca_guid to a bus filter instance.
- * Called from PORT_ADD or IOU_ADD pnp callback routines with the ca_guid from
- * the pnp event record.
- * Assumption is a BFI slot has been allocated in add_device() although the
- * ca_guid was not known at that time; hence !ca_bound. When PNP generates an
- * 'ADD' event, the port_mgr/iou_mgr pnp callback routine calls here to match
- * the input ca_guid which caused the PNP event to the BFI instance by ca_guid.
- * In the 1st call after add_device() the BFI slot is allocated but not yet
- * bound to a CA guid. If the input ca_guid is not matched, then the 1st
- * allocated but not bound BFI slot is then 'bound' by setting
- * bfi->ca_guid = input ca_guid.
- */
-
-bus_filter_t *
-get_set_bfi_by_ca_guid( IN net64_t ca_guid )
-{
-       bus_filter_t    *p_bfi;
-       bus_filter_t    *matched=NULL;
-       boolean_t               ca_bound = FALSE;
-
-       if ( ca_guid == 0ULL )
-       {
-               matched = g_bus_filters;
-               BUS_PRINT( BUS_DBG_PNP, ("%s() ERR guid 0x%I64x -> bfi[0] %p\n",
-                                       __FUNCTION__, ca_guid, matched) );
-               CL_ASSERT( ca_guid );
-               return matched;
-       }
-
-       for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)
-       {
-               if ( !p_bfi->p_bus_ext )
-                       continue;
-
-               if ( ca_guid == p_bfi->ca_guid )
-               {
-                       matched = p_bfi;
-                       break;
-               }
-       }
-
-       /*
-        * if no match, find an 'allocated' bfi slot which does not have a bound CA.
-        * Bound == ca_guid != 0ULL.
-        */
-       if ( !matched )
-       {
-               lock_control_event();
-
-               for(p_bfi=g_bus_filters; p_bfi < &g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)
-               {
-                       if ( !p_bfi->p_bus_ext )
-                               continue;       // not allocated.
-
-                       if ( p_bfi->ca_guid == 0ULL )
-                       {
-                               ca_bound = TRUE;
-                               p_bfi->ca_guid = ca_guid;       // bind CA & this BFI slot; RTU.
-                               matched = p_bfi;
-                               break;
-                       }
-               }
-               unlock_control_event();
-       }
-
-       BUS_PRINT( BUS_DBG_PNP,
-                               ("%s()%sguid 0x%I64x @ bfi[%d] %p \n",
-                               __FUNCTION__, (ca_bound ? "SET ":" "), ca_guid,
-                               (matched ? (matched - g_bus_filters) : (-1)), matched ) );
-
        return matched;
 }


diff U3 Z:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/core/bus/kernel/bus_driver.h F:/openIB-windows-svn/latest/gen1/trunk/core/bus/kernel/bus_driver.h
--- Z:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/core/bus/kernel/bus_driver.h   Mon Mar 09 09:48:09 2009
+++ F:/openIB-windows-svn/latest/gen1/trunk/core/bus/kernel/bus_driver.h        Wed Mar 11 17:13:15 2009
@@ -123,8 +123,8 @@
        /* Number of references on the CI interface. */
        atomic32_t                              n_ci_ifc_ref;
        /* HCA interface stuff */
-       RDMA_INTERFACE_VERBS            hca_ifc;
-       boolean_t                                       hca_ifc_taken;
+       RDMA_INTERFACE_VERBS    hca_ifc;
+       boolean_t                               hca_ifc_taken;

        struct _bus_filter_instance *bus_filter;

@@ -293,7 +293,6 @@
 extern int get_bfi_count( void );
 extern bus_filter_t *get_bfi_by_obj( IN int obj_type, IN cl_obj_t *p_obj );
 extern bus_filter_t *get_bfi_by_ca_guid( IN net64_t ca_guid );
-extern bus_filter_t *get_set_bfi_by_ca_guid( IN net64_t ca_guid );
 extern char *get_obj_state_str(cl_state_t state);

 inline VOID lock_control_event() {


diff U3 Z:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/core/bus/kernel/bus_driver.c F:/openIB-windows-svn/latest/gen1/trunk/core/bus/kernel/bus_driver.c
--- Z:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/core/bus/kernel/bus_driver.c   Thu Mar 12 09:57:54 2009
+++ F:/openIB-windows-svn/latest/gen1/trunk/core/bus/kernel/bus_driver.c        Thu Mar 12 10:08:18 2009
@@ -736,7 +736,9 @@
        if( g_al_dbg_flags & AL_DBG_ERR )
                g_al_dbg_flags |= CL_DBG_ERROR;

-//     bus_globals.dbg_lvl |= BUS_DBG_DRV | BUS_DBG_PNP;
+       // For manageable Debug output: Disable Enter/Exit macros in
+       //  bus_drv_ioctl(), bus_drv_open(), bus_drv_cleanup()
+       //bus_globals.dbg_lvl |= BUS_DBG_DRV | BUS_DBG_PNP;
 #endif

        BUS_TRACE(BUS_DBG_DRV ,

diff U3 Z:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/core/bus/kernel/bus_iou_mgr.c F:/openIB-windows-svn/latest/gen1/trunk/core/bus/kernel/bus_iou_mgr.c
--- Z:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/core/bus/kernel/bus_iou_mgr.c  Thu Mar 12 09:57:54 2009
+++ F:/openIB-windows-svn/latest/gen1/trunk/core/bus/kernel/bus_iou_mgr.c       Thu Mar 12 10:09:24 2009
@@ -676,7 +676,7 @@

        BUS_ENTER( BUS_DBG_PNP );

-       p_bfi = get_set_bfi_by_ca_guid( p_pnp_rec->ca_guid );
+       p_bfi = get_bfi_by_ca_guid( p_pnp_rec->ca_guid );
        if ( !p_bfi ) {
                BUS_TRACE_EXIT( BUS_DBG_PNP,("NULL p_bfi? ca_guid 0x%I64x\n",
                                                                        p_pnp_rec->ca_guid ) );


diff U3 C:/Documents and Settings/scsmith/Local Settings/Temp/bus_port_mgr.c-revBASE.svn001.tmp.c C:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/core/bus/kernel/bus_port_mgr.c
--- C:/Documents and Settings/scsmith/Local Settings/Temp/bus_port_mgr.c-revBASE.svn001.tmp.c   Tue Mar 17 09:13:29 2009
+++ C:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/trunk/core/bus/kernel/bus_port_mgr.c Tue Mar 17 09:00:06 2009
@@ -410,6 +410,7 @@
                                p_ext, p_ext->b_present, p_ext->b_reported_missing ) );
                        continue;
                }
+
                if( p_ext->h_ca && p_ext->hca_acquired )
                {
                        /* Invalidate bus relations for the HCA. */
@@ -755,7 +756,7 @@

        CL_ASSERT( p_pnp_rec->p_ca_attr->ca_guid );

-       p_bfi = get_set_bfi_by_ca_guid( p_pnp_rec->p_ca_attr->ca_guid );
+       p_bfi = get_bfi_by_ca_guid( p_pnp_rec->p_ca_attr->ca_guid );
        if ( !p_bfi ) {
                BUS_TRACE_EXIT( BUS_DBG_PNP,("NULL p_bfi? ca_guid 0x%I64x\n",
                                                                p_pnp_rec->p_ca_attr->ca_guid ) );
@@ -1856,7 +1857,8 @@

        BUS_TRACE( BUS_DBG_PNP, ("Query i/f for %s: PDO %p (=%p),ext %p, present %d, missing %d, hibernated %d .\n",
                p_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_ext->pdo.cl_ext.p_self_do,
-               p_dev_obj, p_ext, p_ext->pdo.b_present, p_ext->pdo.b_reported_missing, p_ext->pdo.b_hibernating ) );
+               p_dev_obj, p_ext, p_ext->pdo.b_present, p_ext->pdo.b_reported_missing,
+               p_ext->pdo.b_hibernating ) );

        /* Get the interface. */
        status = cl_fwd_query_ifc(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: bus_driver.h.patch
Type: application/octet-stream
Size: 1092 bytes
Desc: bus_driver.h.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090317/2279552e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bus_driver.c.patch
Type: application/octet-stream
Size: 787 bytes
Desc: bus_driver.c.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090317/2279552e/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bus_iou_mgr.c.patch
Type: application/octet-stream
Size: 709 bytes
Desc: bus_iou_mgr.c.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090317/2279552e/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bus_port_mgr.c.patch
Type: application/octet-stream
Size: 1497 bytes
Desc: bus_port_mgr.c.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090317/2279552e/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bus_pnp.c.patch
Type: application/octet-stream
Size: 4136 bytes
Desc: bus_pnp.c.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090317/2279552e/attachment-0004.obj>


More information about the ofw mailing list