Skip to content

Commit ead8ac6

Browse files
Liran Ozliranoz12
authored andcommitted
issue: 1510731 Enhance IPoIB devices validation process
Extend verify_qp_creation() to create steering rule in for IPoIB devices. Signed-off-by: Liran Oz <[email protected]>
1 parent 33dec53 commit ead8ac6

File tree

3 files changed

+45
-7
lines changed

3 files changed

+45
-7
lines changed

src/vma/dev/net_device_val.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,20 +1555,26 @@ bool net_device_val::verify_qp_creation(const char* ifname, enum ibv_qp_type qp_
15551555

15561556
qp = vma_ibv_create_qp(p_ib_ctx->get_ibv_pd(), &qp_init_attr);
15571557
if (qp) {
1558-
success = true;
1559-
if (!priv_ibv_query_flow_tag_supported(qp, get_port_from_ifname(base_ifname))) {
1560-
p_ib_ctx->set_flow_tag_capability(true);
1561-
}
1562-
nd_logdbg("verified interface %s for flow tag capabilities : %s", ifname, p_ib_ctx->get_flow_tag_capability() ? "enabled" : "disabled");
1558+
if (qp_type == IBV_QPT_UD && priv_ibv_create_flow_supported(qp, get_port_from_ifname(base_ifname)) == -1) {
1559+
nd_logdbg("Create_ibv_flow failed on interface %s (errno=%d %m), Traffic will not be offloaded", ifname, errno);
1560+
goto qp_failure;
1561+
} else {
1562+
success = true;
1563+
if (qp_type == IBV_QPT_RAW_PACKET && !priv_ibv_query_flow_tag_supported(qp, get_port_from_ifname(base_ifname))) {
1564+
p_ib_ctx->set_flow_tag_capability(true);
15631565

1566+
}
1567+
nd_logdbg("verified interface %s for flow tag capabilities : %s", ifname, p_ib_ctx->get_flow_tag_capability() ? "enabled" : "disabled");
1568+
}
15641569
} else {
1565-
nd_logdbg("QP creation failed on interface %s (errno=%d %m), Traffic will not be offloaded \n", ifname, errno);
1570+
nd_logdbg("QP creation failed on interface %s (errno=%d %m), Traffic will not be offloaded", ifname, errno);
1571+
qp_failure:
15661572
int err = errno; //verify_raw_qp_privliges can overwrite errno so keep it before the call
15671573
if (validate_raw_qp_privliges() == 0) {
15681574
// MLNX_OFED raw_qp_privliges file exist with bad value
15691575
vlog_printf(VLOG_WARNING,"*******************************************************************************************************\n");
15701576
vlog_printf(VLOG_WARNING,"* Interface %s will not be offloaded.\n", ifname);
1571-
vlog_printf(VLOG_WARNING,"* Working in this mode might causes VMA malfunction over Ethernet interfaces\n");
1577+
vlog_printf(VLOG_WARNING,"* Working in this mode might causes VMA malfunction over Ethernet/InfiniBand interfaces\n");
15721578
vlog_printf(VLOG_WARNING,"* WARNING: the following steps will restart your network interface!\n");
15731579
vlog_printf(VLOG_WARNING,"* 1. \"echo options ib_uverbs disable_raw_qp_enforcement=1 > /etc/modprobe.d/ib_uverbs.conf\"\n");
15741580
vlog_printf(VLOG_WARNING,"* 2. Restart openibd or rdma service depending on your system configuration\n");

src/vma/util/verbs_extra.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,37 @@ int priv_ibv_query_flow_tag_supported(struct ibv_qp *qp, uint8_t port_num)
317317
return res;
318318
}
319319

320+
int priv_ibv_create_flow_supported(struct ibv_qp *qp, uint8_t port_num)
321+
{
322+
int res = -1;
323+
324+
struct __attribute__ ((packed)) {
325+
vma_ibv_flow_attr attr;
326+
vma_ibv_flow_spec_ipv4 ipv4;
327+
vma_ibv_flow_spec_tcp_udp tcp_udp;
328+
} cf_attr;
329+
330+
// Initialize
331+
memset(&cf_attr, 0, sizeof(cf_attr));
332+
cf_attr.attr.size = sizeof(cf_attr);
333+
cf_attr.attr.num_of_specs = 2;
334+
cf_attr.attr.type = VMA_IBV_FLOW_ATTR_NORMAL;
335+
cf_attr.attr.priority = 1; // almost highest priority, 0 is used for 5-tuple later
336+
cf_attr.attr.port = port_num;
337+
338+
ibv_flow_spec_ipv4_set(&cf_attr.ipv4, INADDR_LOOPBACK, INADDR_LOOPBACK); // L3 filter
339+
ibv_flow_spec_tcp_udp_set(&cf_attr.tcp_udp, true, 0, 0); // L4 filter
340+
341+
// Create flow
342+
vma_ibv_flow *ibv_flow = vma_ibv_create_flow(qp, &cf_attr.attr);
343+
if (ibv_flow) {
344+
res = 0;
345+
vma_ibv_destroy_flow(ibv_flow);
346+
}
347+
348+
return res;
349+
}
350+
320351
int vma_rdma_lib_reset() {
321352
#ifdef HAVE_RDMA_LIB_RESET
322353
vlog_printf(VLOG_DEBUG, "rdma_lib_reset called\n");

src/vma/util/verbs_extra.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ void priv_ibv_modify_cq_moderation(struct ibv_cq* cq, uint32_t period, uint32_t
111111

112112
#define FLOW_TAG_MASK ((1 << 20) -1)
113113
int priv_ibv_query_flow_tag_supported(struct ibv_qp *qp, uint8_t port_num);
114+
int priv_ibv_create_flow_supported(struct ibv_qp *qp, uint8_t port_num);
114115

115116
/* DEFINED_VERBS_VERSION:
116117
* 1 - Legacy Verbs API

0 commit comments

Comments
 (0)