aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-10-04 15:28:12 +0200
committerDave Barach <openvpp@barachs.net>2019-10-06 12:50:39 +0000
commitdf213385d391f21d99eaeaf066f0130a20f7ccde (patch)
tree1c997fb43d372ab7cebfae4f9bc4d841135c64f8
parentde0302cabf2d67bc045e843d2d01216bf7252cf0 (diff)
rdma: prevent loopback of broadcast packets
TX queues must be created before RX queues on Mellanox cards in order to not receive our own broadcast packets. Type: fix Change-Id: I32ae25a47d819f715feda621a5ecddcf4efd71ba Signed-off-by: Benoît Ganne <bganne@cisco.com>
-rw-r--r--src/plugins/rdma/device.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/rdma/device.c b/src/plugins/rdma/device.c
index d68bfaa1cf7..32b7ea55006 100644
--- a/src/plugins/rdma/device.c
+++ b/src/plugins/rdma/device.c
@@ -534,16 +534,21 @@ rdma_dev_init (vlib_main_t * vm, rdma_device_t * rd, u32 rxq_size,
ethernet_mac_address_generate (rd->hwaddr.bytes);
+ /*
+ * /!\ WARNING /!\ creation order is important
+ * We *must* create TX queues *before* RX queues, otherwise we will receive
+ * the broacast packets we sent
+ */
+ for (i = 0; i < tm->n_vlib_mains; i++)
+ if ((err = rdma_txq_init (vm, rd, i, txq_size)))
+ return err;
+
for (i = 0; i < rxq_num; i++)
if ((err = rdma_rxq_init (vm, rd, i, rxq_size)))
return err;
if ((err = rdma_rxq_finalize (vm, rd)))
return err;
- for (i = 0; i < tm->n_vlib_mains; i++)
- if ((err = rdma_txq_init (vm, rd, i, txq_size)))
- return err;
-
if ((rd->mr = ibv_reg_mr (rd->pd, (void *) bm->buffer_mem_start,
bm->buffer_mem_size,
IBV_ACCESS_LOCAL_WRITE)) == 0)