From: Jeff Shaw Date: Thu, 17 Apr 2025 22:02:20 +0000 (-0700) Subject: memif: fix fib lookup in dma datapath X-Git-Tag: v25.10-rc0~76 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=e22e6cbbb29d3ecb618b495a6fdeedbadfa0e81d;p=vpp.git memif: fix fib lookup in dma datapath Packets received using the DMA datapath use the buffer template copied from the dma_info per-thread data. The sw_if_index[VLIB_TX] was not set in the vlib buffer template, so subsequent FIB lookups were done using table 0. This is incorrect if the interface is assigned to a different table. Fix the behavior by setting the sw_if_index[VLIB_TX] to ~0, so the FIB knows to use the table to which the interface is assigned, which is the same behavior as the non-DMA memif datapath. Type: fix Change-Id: I17bf9d21ef8a82c56ef839fbf2b611a633db7255 Signed-off-by: Jeff Shaw --- diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c index c28c52f13ff..ad8512ac81e 100644 --- a/src/plugins/memif/memif.c +++ b/src/plugins/memif/memif.c @@ -379,6 +379,12 @@ memif_connect (memif_if_t * mif) CLIB_CACHE_LINE_BYTES); vec_foreach (dma_info, mq->dma_info) { + vlib_buffer_t *bt = &dma_info->data.buffer_template; + + clib_memset (bt, 0, sizeof (*bt)); + bt->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID; + bt->total_length_not_including_first_buffer = 0; + vnet_buffer (bt)->sw_if_index[VLIB_TX] = (u32) ~0; vec_validate_aligned (dma_info->data.desc_data, pow2_mask (max_log2_ring_sz), CLIB_CACHE_LINE_BYTES);