aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-10-04 15:28:12 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-10-09 12:38:39 +0000
commit43b36af1fca4298d6c40f139aaf2462dd4747957 (patch)
tree93e4d9d514cbedcf624a28d8ea16c442a717d8e3
parent4787d18b19f505cf85f1e3120527b491c4014895 (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> (cherry picked from commit df213385d391f21d99eaeaf066f0130a20f7ccde)
-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)