[PATCH v2 1/9] net/ixgbe: fix Tx mbuf leak on queue stop

Anurag Mandal anurag.mandal at intel.com
Tue Dec 1 11:55:12 CET 2026


Since the common scalar Tx path frees mbufs during
descriptor cleanup, ci_txq_release_all_mbufs() only
frees the entries between last_desc_cleaned + 1 and
tx_tail - 1 for non-vector queues, and then clears
the whole software ring.

ixgbe pmd does not use the common scalar Tx path.
Its full-featured Tx function frees an mbuf only
when the ring slot is reused, and its simple Tx
function never updates last_desc_cleaned.
Once the ring has wrapped, completed (full-featured)
or in-flight (simple) mbufs outside that window are
dropped without being freed.
Up to a ring of mbufs is leaked per Tx queue on every
queue stop, port stop and queue release, which
exhausts the mempool after repeated stop/start cycles.

Free every non-NULL software ring entry for the scalar
paths, as was done earlier.
The vector path keeps using the common helper.

Fixes: bfe024981f41 ("net/intel: optimize for fast-free hint")
Cc: stable at dpdk.org

Signed-off-by: Anurag Mandal <anurag.mandal at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 drivers/net/intel/ixgbe/ixgbe_rxtx.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/net/intel/ixgbe/ixgbe_rxtx.c b/drivers/net/intel/ixgbe/ixgbe_rxtx.c
index 1901811883..49295b5dc8 100644
--- a/drivers/net/intel/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/intel/ixgbe/ixgbe_rxtx.c
@@ -2482,11 +2482,33 @@ ixgbe_tx_free_swring(struct ci_tx_queue *txq)
 		rte_free(txq->sw_ring);
 }
 
+static void __rte_cold
+ixgbe_tx_queue_release_mbufs(struct ci_tx_queue *txq)
+{
+	uint16_t i;
+
+	if (txq->use_vec_entry) {
+		ci_txq_release_all_mbufs(txq, false);
+		return;
+	}
+
+	if (txq->sw_ring == NULL)
+		return;
+
+	/* scalar paths only overwrite or NULL an entry after freeing it */
+	for (i = 0; i < txq->nb_tx_desc; i++) {
+		if (txq->sw_ring[i].mbuf != NULL) {
+			rte_pktmbuf_free_seg(txq->sw_ring[i].mbuf);
+			txq->sw_ring[i].mbuf = NULL;
+		}
+	}
+}
+
 static void __rte_cold
 ixgbe_tx_queue_release(struct ci_tx_queue *txq)
 {
 	if (txq != NULL && txq->ops != NULL) {
-		ci_txq_release_all_mbufs(txq, false);
+		ixgbe_tx_queue_release_mbufs(txq);
 		txq->ops->free_swring(txq);
 		rte_free(txq->rs_last_id);
 		rte_memzone_free(txq->mz);
@@ -3465,7 +3487,7 @@ ixgbe_dev_clear_queues(struct rte_eth_dev *dev)
 		struct ci_tx_queue *txq = dev->data->tx_queues[i];
 
 		if (txq != NULL) {
-			ci_txq_release_all_mbufs(txq, false);
+			ixgbe_tx_queue_release_mbufs(txq);
 			txq->ops->reset(txq);
 			dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
 		}
@@ -5754,7 +5776,7 @@ ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 	}
 
 	if (txq->ops != NULL) {
-		ci_txq_release_all_mbufs(txq, false);
+		ixgbe_tx_queue_release_mbufs(txq);
 		txq->ops->reset(txq);
 	}
 	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
-- 
2.25.1



More information about the stable mailing list