]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/rdma: fix RoCE v2 deafult value 12648/head
authorOren Duer <oren@mellanox.com>
Mon, 12 Dec 2016 13:35:59 +0000 (15:35 +0200)
committerAdir Lev <adirl@mellanox.com>
Fri, 23 Dec 2016 11:36:10 +0000 (11:36 +0000)
For backward compatibility, if no GID given or given GID is malformed,
use GID index 0.

Change-Id: I8c8ecbcfc0261e58c5a226ef6bc91297ec756182
Signed-off-by: Oren Duer <oren@mellanox.com> Adir Lev <adirl@mellanox.com>
Signed-off-by: Adir Lev <adirl@mellanox.com>
src/common/config_opts.h
src/msg/async/rdma/Infiniband.cc

index 5a6f54f7f20c5ffea4fda7e4517c00878da34586..6b7a90e500510a2ec1ec3690c9fa2a4a28674192 100644 (file)
@@ -224,7 +224,7 @@ OPTION(ms_async_rdma_receive_buffers, OPT_U32, 10240)
 OPTION(ms_async_rdma_port_num, OPT_U32, 1)
 OPTION(ms_async_rdma_polling_us, OPT_U32, 1000)
 OPTION(ms_async_rdma_local_gid, OPT_STR, "")       // GID format: "fe80:0000:0000:0000:7efe:90ff:fe72:6efe", no zero folding
-OPTION(ms_async_rdma_roce_ver, OPT_INT, 2)         // 2=RoCEv2, 1=RoCEv1.5, 0=RoCEv1
+OPTION(ms_async_rdma_roce_ver, OPT_INT, 1)         // 0=RoCEv1, 1=RoCEv2, 2=RoCEv1.5
 OPTION(ms_async_rdma_sl, OPT_INT, 3)               // in RoCE, this means PCP
 
 OPTION(ms_dpdk_port_id, OPT_INT, 0)
index 2913aa1ecc4f7547098c0fe0872502d326d08ca6..d81c338d2a2ebc95afaba4dd3144198eb62283b9 100644 (file)
@@ -49,7 +49,8 @@ Device::Device(CephContext *cct, ibv_device* d): device(d), device_attr(new ibv_
 Port::Port(CephContext *cct, struct ibv_context* ictxt, uint8_t ipn): ctxt(ictxt), port_num(ipn), port_attr(new ibv_port_attr) {\r
    union ibv_gid cgid;\r
    struct ibv_exp_gid_attr gid_attr;\r
-\r
+   bool malformed = false;\r
+
    int r = ibv_query_port(ctxt, port_num, port_attr);\r
    if (r == -1) {\r
      lderr(cct) << __func__  << " query port failed  " << cpp_strerror(errno) << dendl;\r
@@ -61,7 +62,7 @@ Port::Port(CephContext *cct, struct ibv_context* ictxt, uint8_t ipn): ctxt(ictxt
    // search for requested GID in GIDs table\r
    ldout(cct, 1) << __func__ << " looking for local GID " << (cct->_conf->ms_async_rdma_local_gid)\r
        << " of type " << (cct->_conf->ms_async_rdma_roce_ver) << dendl;\r
-   sscanf(cct->_conf->ms_async_rdma_local_gid.c_str(),\r
+   r = sscanf(cct->_conf->ms_async_rdma_local_gid.c_str(),\r
        "%02hhx%02hhx:%02hhx%02hhx:%02hhx%02hhx:%02hhx%02hhx"\r
        ":%02hhx%02hhx:%02hhx%02hhx:%02hhx%02hhx:%02hhx%02hhx",\r
      &cgid.raw[ 0], &cgid.raw[ 1],\r
@@ -73,6 +74,11 @@ Port::Port(CephContext *cct, struct ibv_context* ictxt, uint8_t ipn): ctxt(ictxt
      &cgid.raw[12], &cgid.raw[13],\r
      &cgid.raw[14], &cgid.raw[15]);\r
 \r
+   if (r != 16) {\r
+     ldout(cct, 1) << __func__ << " malformed or no GID supplied, using GID index 0" << dendl;\r
+     malformed = true;\r
+   }\r
+\r
    gid_attr.comp_mask = IBV_EXP_QUERY_GID_ATTR_TYPE;\r
 \r
    for (gid_idx = 0; gid_idx < port_attr->gid_tbl_len; gid_idx++) {\r
@@ -86,6 +92,8 @@ Port::Port(CephContext *cct, struct ibv_context* ictxt, uint8_t ipn): ctxt(ictxt
        lderr(cct) << __func__  << " query gid attributes of port " << port_num << " index " << gid_idx << " failed  " << cpp_strerror(errno) << dendl;\r
        ceph_abort();\r
      }\r
+\r
+     if (malformed) break; // stay with gid_idx=0\r
      if ( (gid_attr.type == cct->_conf->ms_async_rdma_roce_ver) &&\r
           (memcmp(&gid, &cgid, 16) == 0) ) {\r
        ldout(cct, 1) << __func__ << " found at index " << gid_idx << dendl;\r