patch 'net/mlx5: fix counters resource leak' has been queued to stable release 25.11.1

Kevin Traynor ktraynor at redhat.com
Thu Feb 26 14:09:10 CET 2026


Hi,

FYI, your patch has been queued to stable release 25.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/02/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/5ae7102bc4e9b9f804a568a34cf08f4829be2707

Thanks.

Kevin

---
>From 5ae7102bc4e9b9f804a568a34cf08f4829be2707 Mon Sep 17 00:00:00 2001
From: Bing Zhao <bingz at nvidia.com>
Date: Mon, 5 Jan 2026 09:05:58 +0200
Subject: [PATCH] net/mlx5: fix counters resource leak

[ upstream commit 7e14fd5b20006c51afe47c323cf8f29958121155 ]

The counters that are used to record the dropped packets (including
hairpin) are created firstly. Then the counter objects are provided
to the command to create the Rx queues, and they are used for the
global drop and hairpin queues drop statistics. One counter can be
associated with more than one queue in hairpin case.

So the reference count of a counter will be increased once attached
to a queue. When closing the device, the queues and counters should
be destroyed in the reverse order. The queues should be destroyed
firstly in order to decrease the reference count of attached counter
properlly. Then the counter can be recycled successfully. Or else the
resource will be leaked before the application quits when doing port
attach / detach rerepeatedly.

Fixes: f0c0731b6d40 ("net/mlx5: add counters for hairpin drop")

Signed-off-by: Bing Zhao <bingz at nvidia.com>
Acked-by: Suanming Mou <suanmingm at nvidia.com>
---
 drivers/net/mlx5/mlx5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index decf540c51..bde4d01e48 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -2405,5 +2405,4 @@ mlx5_dev_close(struct rte_eth_dev *dev)
 	}
 #endif
-	mlx5_q_counters_destroy(dev);
 	if (priv->rxq_privs != NULL) {
 		/* XXX race condition if mlx5_rx_burst() is still running. */
@@ -2426,4 +2425,5 @@ mlx5_dev_close(struct rte_eth_dev *dev)
 	if (priv->drop_queue.hrxq)
 		mlx5_drop_action_destroy(dev);
+	mlx5_q_counters_destroy(dev);
 	mlx5_mprq_free_mp(dev);
 	mlx5_os_free_shared_dr(priv);
-- 
2.53.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-02-26 10:16:49.792036702 +0000
+++ 0068-net-mlx5-fix-counters-resource-leak.patch	2026-02-26 10:16:46.995459430 +0000
@@ -1 +1 @@
-From 7e14fd5b20006c51afe47c323cf8f29958121155 Mon Sep 17 00:00:00 2001
+From 5ae7102bc4e9b9f804a568a34cf08f4829be2707 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 7e14fd5b20006c51afe47c323cf8f29958121155 ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org



More information about the stable mailing list