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)
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
// 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
&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
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