patch 'net/mlx5: report HWS counter pool allocation failure' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:05:50 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.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 12/08/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/f570c4843302b0b3d81ed8487284373f15c3ca23
Thanks.
Kevin
---
>From f570c4843302b0b3d81ed8487284373f15c3ca23 Mon Sep 17 00:00:00 2001
From: Maayan Kashani <mkashani at nvidia.com>
Date: Mon, 9 Nov 2026 14:57:40 +0200
Subject: [PATCH] net/mlx5: report HWS counter pool allocation failure
[ upstream commit fdab5a20fda8379b5de765f473499e16cf763ebc ]
Non-template HWS pre-allocates half of the device counter capacity
from hugepage memory. When that allocation fails, the PMD replaced
the specific error with "counters pool not initialized".
Log the failing allocation and return the original error. Document
that this pre-allocation can exhaust hugepages, and that the
application can reserve more hugepages or configure fewer counters.
Fixes: 4d368e1da3a4 ("net/mlx5: support flow counter action for HWS")
Signed-off-by: Maayan Kashani <mkashani at nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
doc/guides/nics/mlx5.rst | 9 +++++++++
drivers/net/mlx5/mlx5_flow_hw.c | 11 ++++-------
drivers/net/mlx5/mlx5_hws_cnt.c | 20 ++++++++++++++++++--
3 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index d8713e6e7d..557fae6469 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -2854,4 +2854,13 @@ With :ref:`HW steering <mlx5_hws>`:
- DOCA >= 3.2.0 for drivers/libraries provided by NVIDIA.
+#. The synchronous flow API pre-allocates half of the NIC counter capacity
+ from hugepage memory when the first ``COUNT`` action is created.
+ Other allocations, such as large mbuf pools, can use up the hugepage heap first.
+ Counter creation then fails.
+
+ Reserve more hugepages, or call ``rte_flow_configure()`` with a smaller ``nb_counters``
+ before creating the first ``COUNT`` action.
+ An explicit configuration allocates only the requested number of counters.
+
.. _mlx5_age:
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index d44890aaa0..556406f572 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -12991,11 +12991,8 @@ flow_hw_action_handle_validate(struct rte_eth_dev *dev, uint32_t queue,
break;
case RTE_FLOW_ACTION_TYPE_COUNT:
- if (!priv->hws_cpool) {
- if (flow_hw_allocate_actions(dev, MLX5_FLOW_ACTION_COUNT,
- error))
- return rte_flow_error_set
- (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
- NULL, "counters pool not initialized");
- }
+ if (!priv->hws_cpool)
+ return flow_hw_allocate_actions(dev,
+ MLX5_FLOW_ACTION_COUNT,
+ error);
break;
case RTE_FLOW_ACTION_TYPE_CONNTRACK:
diff --git a/drivers/net/mlx5/mlx5_hws_cnt.c b/drivers/net/mlx5/mlx5_hws_cnt.c
index 8192310d9c..66e47e0d99 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.c
+++ b/drivers/net/mlx5/mlx5_hws_cnt.c
@@ -32,6 +32,9 @@ __hws_cnt_id_load(struct mlx5_hws_cnt_pool *cpool)
cnt_arr = mlx5_malloc(MLX5_MEM_ANY | MLX5_MEM_ZERO,
cnt_num * sizeof(cnt_id_t), 0, SOCKET_ID_ANY);
- if (cnt_arr == NULL)
+ if (cnt_arr == NULL) {
+ DRV_LOG(ERR, "Failed to allocate counter ID array: %zu bytes.",
+ cnt_num * sizeof(cnt_id_t));
return -ENOMEM;
+ }
/*
* Counter ID order is important for tracking the max number of in used
@@ -292,4 +295,6 @@ mlx5_hws_cnt_raw_data_alloc(struct mlx5_dev_ctx_shared *sh, uint32_t n,
SOCKET_ID_ANY);
if (mng->raw == NULL) {
+ DRV_LOG(ERR, "Failed to allocate raw counter memory: %zu bytes.",
+ sz);
rte_flow_error_set(error, ENOMEM,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
@@ -472,4 +477,7 @@ mlx5_hws_cnt_pool_init(struct mlx5_dev_ctx_shared *sh,
0, SOCKET_ID_ANY);
if (cntp->pool == NULL) {
+ DRV_LOG(ERR,
+ "Failed to allocate counter pool: %zu bytes for %" PRIu64 " counters.",
+ sizeof(struct mlx5_hws_cnt) * (size_t)cnt_num, cnt_num);
rte_flow_error_set(error, ENOMEM,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
@@ -777,6 +785,10 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
}
ret = __hws_cnt_id_load(cpool);
- if (ret != 0)
+ if (ret != 0) {
+ rte_flow_error_set(error, ENOMEM,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+ "failed to allocate counter ID array");
goto error;
+ }
/*
* Bump query gen right after pool create so the
@@ -809,4 +821,8 @@ success:
error:
MLX5_ASSERT(ret);
+ DRV_LOG(ERR, "Port %u failed to create counter pool for %u counters: %s",
+ dev->data->port_id, nb_counters,
+ (error != NULL && error->message != NULL) ?
+ error->message : "unspecified error");
mlx5_hws_cnt_pool_destroy(priv->sh, cpool);
priv->hws_cpool = NULL;
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:51.191990580 +0000
+++ 0424-net-mlx5-report-HWS-counter-pool-allocation-failure.patch 2026-12-03 12:52:39.329938813 +0000
@@ -1 +1 @@
-From fdab5a20fda8379b5de765f473499e16cf763ebc Mon Sep 17 00:00:00 2001
+From f570c4843302b0b3d81ed8487284373f15c3ca23 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit fdab5a20fda8379b5de765f473499e16cf763ebc ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -26 +27 @@
-index 779a228485..8f4d6f328f 100644
+index d8713e6e7d..557fae6469 100644
@@ -29 +30 @@
-@@ -2991,4 +2991,13 @@ With :ref:`HW steering <mlx5_hws>`:
+@@ -2854,4 +2854,13 @@ With :ref:`HW steering <mlx5_hws>`:
@@ -44 +45 @@
-index fe25b9b3ba..6e6bf07799 100644
+index d44890aaa0..556406f572 100644
@@ -47 +48 @@
-@@ -12769,11 +12769,8 @@ flow_hw_action_handle_validate(struct rte_eth_dev *dev, uint32_t queue,
+@@ -12991,11 +12991,8 @@ flow_hw_action_handle_validate(struct rte_eth_dev *dev, uint32_t queue,
@@ -64 +65 @@
-index d6f713fd9b..c2aa75c865 100644
+index 8192310d9c..66e47e0d99 100644
@@ -78 +79 @@
-@@ -291,4 +294,6 @@ mlx5_hws_cnt_raw_data_alloc(struct mlx5_dev_ctx_shared *sh, uint32_t n,
+@@ -292,4 +295,6 @@ mlx5_hws_cnt_raw_data_alloc(struct mlx5_dev_ctx_shared *sh, uint32_t n,
@@ -85 +86 @@
-@@ -470,4 +475,7 @@ mlx5_hws_cnt_pool_init(struct mlx5_dev_ctx_shared *sh,
+@@ -472,4 +477,7 @@ mlx5_hws_cnt_pool_init(struct mlx5_dev_ctx_shared *sh,
@@ -93 +94 @@
-@@ -774,6 +782,10 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
+@@ -777,6 +785,10 @@ mlx5_hws_cnt_pool_create(struct rte_eth_dev *dev,
@@ -105 +106 @@
-@@ -806,4 +818,8 @@ success:
+@@ -809,4 +821,8 @@ success:
More information about the stable
mailing list