diff options
| author | songyanchao <[email protected]> | 2024-04-02 10:28:37 +0000 |
|---|---|---|
| committer | songyanchao <[email protected]> | 2024-04-02 10:28:37 +0000 |
| commit | a54073a0601037823f53bbd54b67abe2ed8dca09 (patch) | |
| tree | 2a667fca4ff052bb7054378d0fbb587ace2827fa | |
| parent | 3a51336967fd8027e9ae4000bd81ce2443e9ba87 (diff) | |
🐞 fix: Fix mbuf leak in shmdev tx node.v4.8.1-20240402
Fix mbuf leak in shmdev tx node.
| -rw-r--r-- | service/src/node_shmdev.c | 9 |
1 files 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)) |
