summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsongyanchao <[email protected]>2024-04-02 10:28:37 +0000
committer陆秋文 <[email protected]>2024-04-14 12:38:19 +0000
commit4ff22e7ad20fdb65cc26bc10400b67802df07b27 (patch)
tree87148833f78a693e859e33770ab14248849e615f
parent40ac816d10a9335c61090208116342bfa3fefd88 (diff)
🐞 fix: Fix mbuf leak in shmdev tx node.
Fix mbuf leak in shmdev tx node.
-rw-r--r--service/src/node_shmdev.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/service/src/node_shmdev.c b/service/src/node_shmdev.c
index de700bf..2a2aa38 100644
--- a/service/src/node_shmdev.c
+++ b/service/src/node_shmdev.c
@@ -132,14 +132,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))