]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
add provider and proxy support for GUID across platform
authorArlin Davis <arlin.r.davis@intel.com>
Fri, 5 Sep 2014 15:07:04 +0000 (08:07 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Fri, 5 Sep 2014 15:07:04 +0000 (08:07 -0700)
Signed-off-by: Arlin Davis <arlin.r.davis@intel.com>
dapl/openib_common/util.c
dapl/openib_mcm/device.c
dapl/openib_scm/device.c
dapl/openib_ucm/device.c
dapl/svc/mpxyd.c

index 76478243e532abf897b404b8c90558bb8067d9b6..d253f6ec33082ab75d187b491656bc7fd654dca7 100644 (file)
@@ -411,14 +411,14 @@ DAT_RETURN dapls_ib_query_hca(IN DAPL_HCA * hca_ptr,
                hca_ptr->ib_trans.na.dev = ia_attr->adapter_name;
                hca_ptr->ib_trans.na.mtu = dapl_ib_mtu_str(hca_ptr->ib_trans.mtu);
                hca_ptr->ib_trans.na.port = dapl_ib_port_str(port_attr.state);
-               hca_ptr->ib_trans.guid = ntohll(ibv_get_device_guid(hca_ptr->ib_trans.ib_dev));
+               if (!hca_ptr->ib_trans.guid)
+                       hca_ptr->ib_trans.guid = ntohll(ibv_get_device_guid(hca_ptr->ib_trans.ib_dev));
                sprintf(hca_ptr->ib_trans.guid_str, "%04x:%04x:%04x:%04x",
                        (unsigned) (hca_ptr->ib_trans.guid >> 48) & 0xffff,
                        (unsigned) (hca_ptr->ib_trans.guid >> 32) & 0xffff,
                        (unsigned) (hca_ptr->ib_trans.guid >> 16) & 0xffff,
                        (unsigned) (hca_ptr->ib_trans.guid >>  0) & 0xffff);
 #ifdef _OPENIB_MCM_
-               hca_ptr->ib_trans.sys_guid = dev_attr.sys_image_guid; /* network order */
                if (hca_ptr->ib_trans.self.node)
                        hca_ptr->ib_trans.na.mode = "PROXY";
                else
index b60ba1c4f32882ac2ec17febe25642829234bec5..9fdbe0b35438968b434dc8eedacae7e802aeff0d 100644 (file)
@@ -199,18 +199,21 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_NAME hca_name,
                return DAT_INTERNAL_ERROR;
        }
        dapl_log(DAPL_DBG_TYPE_UTIL, " open_hca %p: %d devices found\n", hca_ptr, nd);
+       hca_ptr->ib_trans.ib_dev = NULL;
        for (i = 0; i < nd; ++i) {
-               if (!strcmp(dev_list[i]->name, hca_name)) {
+               if (!hca_ptr->ib_trans.guid &&
+                   dev_list[i]->transport_type == IBV_TRANSPORT_IB)
+                       hca_ptr->ib_trans.guid = ibv_get_device_guid(dev_list[i]);
+
+               if (!strcmp(dev_list[i]->name, hca_name))
                        hca_ptr->ib_trans.ib_dev = dev_list[i];
-                       goto found;
-               }
+       }
+       if (hca_ptr->ib_trans.ib_dev == NULL) {
+               dapl_log(DAPL_DBG_TYPE_ERR, " open_hca: device %s not found\n", hca_name);
+               dat_status = DAT_PROVIDER_NOT_FOUND;
+               goto err;
        }
 
-       dapl_log(DAPL_DBG_TYPE_ERR, " open_hca: device %s not found\n", hca_name);
-       dat_status = DAT_PROVIDER_NOT_FOUND;
-       goto err;
-
-found:
        hca_ptr->ib_hca_handle = ibv_open_device(hca_ptr->ib_trans.ib_dev);
        if (!hca_ptr->ib_hca_handle) {
                dapl_log(DAPL_DBG_TYPE_ERR,
index a35ab691f0bc27539cdcb1abfaea478d0e61e1c7..aaea6863f7353c2a0a924d04b835235b79e5ffbd 100644 (file)
@@ -274,7 +274,7 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_NAME hca_name,
 {
        struct ibv_device **dev_list;
        struct ibv_port_attr port_attr;
-       int i;
+       int i, nd = 0;
        DAT_RETURN dat_status = DAT_SUCCESS;
 
        dapl_log(DAPL_DBG_TYPE_UTIL, " open_hca: %s %s - %p in %s\n",
@@ -289,25 +289,28 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_NAME hca_name,
        }
 
         /* Get list of all IB devices, find match, open */
-       dev_list = ibv_get_device_list(NULL);
+       dev_list = ibv_get_device_list(&nd);
        if (!dev_list) {
                dapl_log(DAPL_DBG_TYPE_ERR,
                         " open_hca: ibv_get_device_list() failed\n",
                         hca_name);
                return DAT_INTERNAL_ERROR;
        }
+       hca_ptr->ib_trans.ib_dev = NULL;
+       for (i = 0; i < nd; ++i) {
+               if (!hca_ptr->ib_trans.guid &&
+                   dev_list[i]->transport_type == IBV_TRANSPORT_IB)
+                       hca_ptr->ib_trans.guid = ibv_get_device_guid(dev_list[i]);
 
-       for (i = 0; dev_list[i]; ++i) {
-               hca_ptr->ib_trans.ib_dev = dev_list[i];
-               if (!strcmp(ibv_get_device_name(hca_ptr->ib_trans.ib_dev),
-                           hca_name))
-                       goto found;
+               if (!strcmp(dev_list[i]->name, hca_name))
+                       hca_ptr->ib_trans.ib_dev = dev_list[i];
+       }
+       if (hca_ptr->ib_trans.ib_dev == NULL) {
+               dapl_log(DAPL_DBG_TYPE_ERR, " open_hca: device %s not found\n", hca_name);
+               dat_status = DAT_PROVIDER_NOT_FOUND;
+               goto err;
        }
-       dapl_log(DAPL_DBG_TYPE_ERR,
-                " open_hca: device %s not found\n", hca_name);
-       goto err;
 
-found:
        dapl_dbg_log(DAPL_DBG_TYPE_UTIL, " open_hca: Found dev %s %016llx\n",
                     ibv_get_device_name(hca_ptr->ib_trans.ib_dev),
                     (unsigned long long)
index c6b45468d1c9ff99e03e3aebc82f8c626864e5f4..75d730618675bc71082a9e5908da154af5c98676 100644 (file)
@@ -216,17 +216,21 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_NAME hca_name,
                         hca_name);
                return DAT_INTERNAL_ERROR;
        }
-
+       hca_ptr->ib_trans.ib_dev = NULL;
        for (i = 0; i < nd; ++i) {
-               if (!strcmp(dev_list[i]->name, hca_name)) {
+               if (!hca_ptr->ib_trans.guid &&
+                   dev_list[i]->transport_type == IBV_TRANSPORT_IB)
+                       hca_ptr->ib_trans.guid = ibv_get_device_guid(dev_list[i]);
+
+               if (!strcmp(dev_list[i]->name, hca_name))
                        hca_ptr->ib_trans.ib_dev = dev_list[i];
-                       goto found;
-               }
        }
-       dapl_log(DAPL_DBG_TYPE_ERR, " open_hca: %s not found\n", hca_name);
-       dat_status = DAT_PROVIDER_NOT_FOUND;
-       goto err;
-found:
+       if (hca_ptr->ib_trans.ib_dev == NULL) {
+               dapl_log(DAPL_DBG_TYPE_ERR, " open_hca: device %s not found\n", hca_name);
+               dat_status = DAT_PROVIDER_NOT_FOUND;
+               goto err;
+       }
+
        hca_ptr->ib_hca_handle = ibv_open_device(hca_ptr->ib_trans.ib_dev);
        if (!hca_ptr->ib_hca_handle) {
                dapl_log(DAPL_DBG_TYPE_ERR,
index 4f228bce54e3c1cb6854d982240803cb9faa832f..bdc68967988a31ac230dc559ea214a9df9ed9aa3 100644 (file)
@@ -196,6 +196,15 @@ static struct ibv_context *open_ib_device(struct mcm_ib_dev *md, char *name, int
        }
 
        for (i=0; i < ibcnt; ++i) {
+               /* system GUID set to first IB device GUID */
+               if (!system_guid && iblist[i]->transport_type == IBV_TRANSPORT_IB) {
+                       system_guid = ibv_get_device_guid(iblist[i]);
+                       mlog(0, "System GUID == %04x:%04x:%04x:%04x\n",
+                               (unsigned) (system_guid >> 48) & 0xffff,
+                               (unsigned) (system_guid >> 32) & 0xffff,
+                               (unsigned) (system_guid >> 16) & 0xffff,
+                               (unsigned) (system_guid >>  0) & 0xffff);
+               }
                if (!strcmp(iblist[i]->name, name)) {
                        ibctx = ibv_open_device(iblist[i]);
                        if (!ibctx) {
@@ -219,14 +228,6 @@ static struct ibv_context *open_ib_device(struct mcm_ib_dev *md, char *name, int
                                        mlog(0," ERR ibdev %s numa_node at "
                                             "%s/device/numa_node unreadable\n",
                                              name, md->ibdev->ibdev_path);
-
-                               if (!system_guid) /* first time, set system guid */
-#ifdef MPXYD_LOCAL_SUPPORT
-                                       system_guid = ibv_get_device_guid(md->ibdev);
-#else
-                                       system_guid = rand();
-#endif
-
                                break;
                        }
                }