From df213385d391f21d99eaeaf066f0130a20f7ccde Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Fri, 4 Oct 2019 15:28:12 +0200 Subject: rdma: prevent loopback of broadcast packets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/rdma/device.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') 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) -- cgit 1.2.3-korg