Once an Rx mbuf is handed to the application, its software ring entry
still references it until the slot is refilled. On device stop, all
referenced mbufs are freed, including the one now owned by the
application.
Clear the ring entry when the mbuf is taken.
Fixes: 11b5c7daf019 ("raw/ntb: add enqueue and dequeue functions")
Cc: [email protected]
Signed-off-by: Raghavendra Ningoji <[email protected]>
---
drivers/raw/ntb/ntb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index 87a35c796c..d4c2de60bd 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -694,6 +694,7 @@ ntb_dequeue_bufs(struct rte_rawdev *dev,
for (i = 0; i < nb_segs; i++) {
rx_item = rxq->rx_used_ring + rxq->last_used;
rxm_t = sw_ring[rxq->last_used].mbuf;
+ sw_ring[rxq->last_used].mbuf = NULL;
rxm_t->data_len = rx_item->len;
rxm_t->data_off = RTE_PKTMBUF_HEADROOM;
rxm_t->port = rxq->port_id;
--
2.34.1