]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
openib: new provider specific attribute - port GID
authorArlin Davis <arlin.r.davis@intel.com>
Fri, 29 Apr 2016 16:22:01 +0000 (09:22 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Fri, 29 Apr 2016 16:22:01 +0000 (09:22 -0700)
The IB GID is returned with IA query, provider specific
option for scm, ucm, cma, and mcm openib providers.
Includes subnet prefix and interface ID.

DAT_IB_GID = fe80:0000:0000:0000:0002:c903:0032:2f31

dtest -v can be used for testing example.

Signed-off-by: Arlin Davis <arlin.r.davis@intel.com>
dapl/openib_cma/dapl_ib_util.h
dapl/openib_common/dapl_ib_common.h
dapl/openib_common/util.c
dapl/openib_mcm/dapl_ib_util.h
dapl/openib_scm/dapl_ib_util.h
dapl/openib_ucm/dapl_ib_util.h

index 3738dc02d05757c8a11cb975a4d3de3f2df04cd9..b886832ae8860b2f3e6d1c7b6e851c5b7d686bf9 100755 (executable)
@@ -110,6 +110,7 @@ typedef struct _ib_hca_transport
        ib_cm_attr_t            ib_cm;  /* dev attr for QP and CM */
        uint64_t                guid;
        char                    guid_str[32];
+       char                    gid_str[48];
        ib_named_attr_t         na;
 #ifdef DAT_IB_COLLECTIVES
        /* Collective member device and address information */
index a2ff41c4b45bc9eb8cc372c44163e492aedb488e..78b89ead2c0bfb2e0a179d5bb358fb4ff329cbfd 100644 (file)
@@ -179,6 +179,7 @@ typedef struct _ib_named_attr
         const char *i_data;
         const char *f_add;
         const char *c_swap;
+        const char *gid;
 
 } ib_named_attr_t;
 
index 3cf3811e9b39106a46e4fb673a66e43429634d45..fb612f7b8dafa6c868a5eefd1d8efa1f0ec2dd85 100644 (file)
@@ -343,6 +343,18 @@ const char *dapl_ib_port_num_str(unsigned long num)
        }
 }
 
+const char *dapl_ib_gid_str(union ibv_gid *gid, char *str)
+{
+       sprintf(str, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
+               gid->raw[0], gid->raw[1], gid->raw[2], gid->raw[3],
+               gid->raw[4], gid->raw[5], gid->raw[6], gid->raw[7],
+               gid->raw[8], gid->raw[9], gid->raw[10],gid->raw[11],
+               gid->raw[12],gid->raw[13],gid->raw[14],gid->raw[15]);
+
+       return str;
+}
+
+
 /*
  * dapls_ib_query_hca
  *
@@ -370,6 +382,7 @@ DAT_RETURN dapls_ib_query_hca(IN DAPL_HCA * hca_ptr,
        ib_hca_transport_t *tp = &hca_ptr->ib_trans;
        struct ibv_device_attr dev_attr;
        struct ibv_port_attr port_attr;
+       union ibv_gid port_gid;
 
        /* local IP address of device, set during ia_open */
        if (ip_addr)
@@ -523,6 +536,10 @@ DAT_RETURN dapls_ib_query_hca(IN DAPL_HCA * hca_ptr,
                tp->na.mtu = dapl_ib_mtu_str(tp->ib_cm.mtu);
                tp->na.port = dapl_ib_port_str(port_attr.state);
                tp->na.port_num = dapl_ib_port_num_str(hca_ptr->port_num);
+               /* get gid and init named attribute */
+               ibv_query_gid(hca_ptr->ib_hca_handle, (uint8_t)hca_ptr->port_num, 0, &port_gid);
+               tp->na.gid = dapl_ib_gid_str(&port_gid, tp->gid_str);
+
                if (!tp->guid) {
 #ifdef _OPENIB_MCM_
                        if (MFO_EP(&hca_ptr->ib_trans.addr) && tp->self.node)
@@ -833,6 +850,9 @@ DAT_NAMED_ATTR ib_attrs[] = {
        {
         "DAT_IB_NODE_GUID", "xxxx:xxxx:xxxx:xxxx"}
        ,
+       {
+        "DAT_IB_GID", "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx"}
+       ,
        {
         "DAT_IB_TRANSPORT_MTU", "2048"}
        ,
@@ -924,6 +944,8 @@ void dapls_query_provider_specific_attr(IN DAPL_IA * ia_ptr,
                        ib_attrs[i].value = ia_ptr->hca_ptr->ib_trans.na.read;
                else if (!strcmp(ib_attrs[i].name, "DAT_IB_NODE_GUID"))
                        ib_attrs[i].value = ia_ptr->hca_ptr->ib_trans.guid_str;
+               else if (!strcmp(ib_attrs[i].name, "DAT_IB_GID"))
+                       ib_attrs[i].value = ia_ptr->hca_ptr->ib_trans.na.gid;
                else if (!strcmp(ib_attrs[i].name, "DAT_IB_TRANSPORT_MTU"))
                        ib_attrs[i].value = ia_ptr->hca_ptr->ib_trans.na.mtu;
                else if (!strcmp(ib_attrs[i].name, "DAT_IB_PORT_STATUS"))
index 89d3650071ef461eddf0066c11144bcd1cabaada..e2a00ae35363b5d19edc75d51ab492d4cd8002ef 100644 (file)
@@ -133,6 +133,7 @@ typedef struct _ib_hca_transport
        uint64_t                sys_guid;       /* system image guid, network order */
        uint64_t                guid;           /* host order */
        char                    guid_str[32];
+       char                    gid_str[48];
        char                    fam_str[8];
        char                    mod_str[8];
        char                    ver_str[8];
index ad5bc606530f8abbd049e3abe51d93ae8c4aa15c..d2473ae0b783e96d9d8042401afbfd839808fb20 100644 (file)
@@ -99,6 +99,7 @@ typedef struct _ib_hca_transport
        DAPL_SOCKET             scm[2];
        uint64_t                guid;
        char                    guid_str[32];
+       char                    gid_str[48];
        ib_named_attr_t         na;
 #ifdef DAT_IB_COLLECTIVES
        /* Collective member device and address information */
index 1abe1dc2660f7b8aadf083e7aa10f3f437a88162..89f3e703c9c83313f228367a57862ae7a8450fa3 100644 (file)
@@ -151,6 +151,7 @@ typedef struct _ib_hca_transport
        uint8_t                 *sid;  /* Sevice IDs, port space, bitarray? */
        uint64_t                guid;
        char                    guid_str[32];
+       char                    gid_str[48];
        ib_named_attr_t         na;
 #ifdef DAT_IB_COLLECTIVES
        /* Collective member device and address information */