From a54073a0601037823f53bbd54b67abe2ed8dca09 Mon Sep 17 00:00:00 2001 From: songyanchao Date: Tue, 2 Apr 2024 10:28:37 +0000 Subject: 🐞 fix: Fix mbuf leak in shmdev tx node. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix mbuf leak in shmdev tx node. --- service/src/node_shmdev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/service/src/node_shmdev.c b/service/src/node_shmdev.c index 6142d15..6e2d3cf 100644 --- a/service/src/node_shmdev.c +++ b/service/src/node_shmdev.c @@ -177,14 +177,19 @@ uint16_t shmdev_tx_node_process(struct rte_graph * graph, struct rte_node * node while (nr_pkts) { unsigned int nr_mbufs_this_batch = (nr_pkts > RTE_GRAPH_BURST_SIZE) ? RTE_GRAPH_BURST_SIZE : nr_pkts; - vdev_dispatch(shm_dev_desc, graph->id, mbufs, nr_mbufs_this_batch, 0); + int ret = vdev_dispatch(shm_dev_desc, graph->id, mbufs, nr_mbufs_this_batch, 0); + if (unlikely(ret < 0)) + { + /* these mbufs should be dropped */ + rte_node_enqueue(graph, node, 0, (void **)mbufs, nr_mbufs_this_batch); + } nr_pkts -= nr_mbufs_this_batch; mbufs += nr_mbufs_this_batch; /* retrieve the backpressure packets */ struct rte_mbuf * rt_mbufs[RTE_GRAPH_BURST_SIZE]; - int ret = vdev_rt_pkts_retrieve(shm_dev_desc, graph->id, rt_mbufs, RTE_GRAPH_BURST_SIZE); + ret = vdev_rt_pkts_retrieve(shm_dev_desc, graph->id, rt_mbufs, RTE_GRAPH_BURST_SIZE); /* these packet to pkt drop node */ if (unlikely(ret > 0)) -- cgit v1.2.3