patch 'net/mlx5: fix counter service cleanup on init failure' has been queued to stable release 23.11.5

Xueming Li xuemingl at nvidia.com
Thu Jun 26 14:00:43 CEST 2025


Hi,

FYI, your patch has been queued to stable release 23.11.5

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/28/25. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=904d50d76ad3e380603862c36874597bdafb9fb5

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 904d50d76ad3e380603862c36874597bdafb9fb5 Mon Sep 17 00:00:00 2001
From: Dariusz Sosnowski <dsosnowski at nvidia.com>
Date: Fri, 25 Apr 2025 21:41:05 +0200
Subject: [PATCH] net/mlx5: fix counter service cleanup on init failure
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 4d78ac5f3ef7c1ae3ae194423428c0f96e9994bc ]

When initializing the counter pool in mlx5_hws_cnt_pool_create(), the
background service thread was started before pool creation completed.
If pool creation failed after the thread was started, the error handling
path did not clean up the running thread, as it assumed no resources
needed cleanup if the pool was not created.

This patch moves the creation of the background service thread to the end
of the counter pool initialization, ensuring resources are released in the
correct order during rollback. It also adds a missing "goto error" in case
the service thread initialization fails.

Fixes: 4d368e1da3a4 ("net/mlx5: support flow counter action for HWS")

Signed-off-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
Acked-by: Bing Zhao <bingz at nvidia.com>
---
 drivers/net/mlx5/mlx5_hws_cnt.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_hws_cnt.c b/drivers/net/mlx5/mlx5_hws_cnt.c
index ca6fd51cc6..7e33568622 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.c
+++ b/drivers/net/mlx5/mlx5_hws_cnt.c
@@ -673,12 +673,6 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
 			goto error;
 		return cpool;
 	}
-	/* init cnt service if not. */
-	if (priv->sh->cnt_svc == NULL) {
-		ret = mlx5_hws_cnt_svc_init(priv->sh);
-		if (ret != 0)
-			goto error;
-	}
 	cparam.fetch_sz = HWS_CNT_CACHE_FETCH_DEFAULT;
 	cparam.preload_sz = HWS_CNT_CACHE_PRELOAD_DEFAULT;
 	cparam.q_num = nb_queue;
@@ -705,6 +699,12 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
 	ret = mlx5_hws_cnt_pool_action_create(priv, cpool);
 	if (ret != 0)
 		goto error;
+	/* init cnt service if not. */
+	if (priv->sh->cnt_svc == NULL) {
+		ret = mlx5_hws_cnt_svc_init(priv->sh);
+		if (ret)
+			goto error;
+	}
 	priv->sh->cnt_svc->refcnt++;
 	cpool->priv = priv;
 	rte_spinlock_lock(&priv->sh->cpool_lock);
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2025-06-26 19:59:18.844961283 +0800
+++ 0023-net-mlx5-fix-counter-service-cleanup-on-init-failure.patch	2025-06-26 19:59:17.270418049 +0800
@@ -1 +1 @@
-From 4d78ac5f3ef7c1ae3ae194423428c0f96e9994bc Mon Sep 17 00:00:00 2001
+From 904d50d76ad3e380603862c36874597bdafb9fb5 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 4d78ac5f3ef7c1ae3ae194423428c0f96e9994bc ]
@@ -18 +20,0 @@
-Cc: stable at dpdk.org
@@ -27 +29 @@
-index fd12bcd7ec..5c7c0041aa 100644
+index ca6fd51cc6..7e33568622 100644
@@ -30,3 +32,3 @@
-@@ -729,12 +729,6 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
- 		}
- 		goto success;
+@@ -673,12 +673,6 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
+ 			goto error;
+ 		return cpool;
@@ -36,2 +38,2 @@
--		ret = mlx5_hws_cnt_svc_init(priv->sh, error);
--		if (ret)
+-		ret = mlx5_hws_cnt_svc_init(priv->sh);
+-		if (ret != 0)
@@ -43,2 +45,3 @@
-@@ -769,6 +763,12 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
- 				   NULL, "failed to allocate counter actions");
+@@ -705,6 +699,12 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
+ 	ret = mlx5_hws_cnt_pool_action_create(priv, cpool);
+ 	if (ret != 0)
@@ -46 +48,0 @@
- 	}
@@ -49 +51 @@
-+		ret = mlx5_hws_cnt_svc_init(priv->sh, error);
++		ret = mlx5_hws_cnt_svc_init(priv->sh);


More information about the stable mailing list