From: Dariusz Sosnowski <dsosnowski@nvidia.com>
To: Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
Suanming Mou <suanmingm@nvidia.com>,
Matan Azrad <matan@nvidia.com>
Cc: <dev@dpdk.org>, Raslan Darawsheh <rasland@nvidia.com>
Subject: [PATCH 2/5] net/mlx5/hws: support counter from DevX bulk on root
Date: Tue, 4 Nov 2025 18:46:09 +0100 [thread overview]
Message-ID: <20251104174612.1341962-3-dsosnowski@nvidia.com> (raw)
In-Reply-To: <20251104174612.1341962-1-dsosnowski@nvidia.com>
This patch adds support for using flow counters with offsets
within a DevX bulk, in flow rules on root table, in HWS layer.
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr.h | 14 ++++++++++++++
drivers/net/mlx5/hws/mlx5dr_action.c | 19 ++++++++++---------
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 58526fc08e..c13316305f 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -738,6 +738,20 @@ mlx5dr_action_create_counter(struct mlx5dr_context *ctx,
struct mlx5dr_devx_obj *obj,
uint32_t flags);
+/* Check if counter action on root table is supported.
+ *
+ * @return true if counter action on root table is supported.
+ */
+static inline bool
+mlx5dr_action_counter_root_is_supported(void)
+{
+#ifdef HAVE_MLX5DV_FLOW_ACTION_COUNTERS_DEVX_WITH_OFFSET
+ return true;
+#else
+ return false;
+#endif
+}
+
/* Create direct rule reformat action.
*
* @param[in] ctx
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index d765d57a8f..1be66629e5 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -832,16 +832,11 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
attr[i].type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
attr[i].action = action->flow_action;
break;
-#ifdef HAVE_IBV_FLOW_DEVX_COUNTERS
+#ifdef HAVE_MLX5DV_FLOW_ACTION_COUNTERS_DEVX_WITH_OFFSET
case MLX5DR_ACTION_TYP_CTR:
- attr[i].type = MLX5DV_FLOW_ACTION_COUNTERS_DEVX;
- attr[i].obj = action->devx_obj;
-
- if (rule_actions[i].counter.offset) {
- DR_LOG(ERR, "Counter offset not supported over root");
- rte_errno = ENOTSUP;
- return rte_errno;
- }
+ attr[i].type = MLX5DV_FLOW_ACTION_COUNTERS_DEVX_WITH_OFFSET;
+ attr[i].bulk_obj.obj = action->devx_obj;
+ attr[i].bulk_obj.offset = rule_actions[i].counter.offset;
break;
#endif
default:
@@ -1712,6 +1707,12 @@ mlx5dr_action_create_counter(struct mlx5dr_context *ctx,
return NULL;
}
+ if (mlx5dr_action_is_root_flags(flags) &&
+ !mlx5dr_action_counter_root_is_supported()) {
+ rte_errno = ENOTSUP;
+ return NULL;
+ }
+
action = mlx5dr_action_create_generic(ctx, flags, MLX5DR_ACTION_TYP_CTR);
if (!action)
return NULL;
--
2.39.5
next prev parent reply other threads:[~2025-11-04 17:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 17:46 [PATCH 0/5] net/mlx5: support count and age actions on root group Dariusz Sosnowski
2025-11-04 17:46 ` [PATCH 1/5] common/mlx5: detect DevX counters support in rdma-core Dariusz Sosnowski
2025-11-04 17:46 ` Dariusz Sosnowski [this message]
2025-11-04 17:46 ` [PATCH 3/5] net/mlx5: rework root group checks in table create Dariusz Sosnowski
2025-11-04 17:46 ` [PATCH 4/5] net/mlx5: improve error reporting on masked indirect actions Dariusz Sosnowski
2025-11-04 17:46 ` [PATCH 5/5] net/mlx5: support count and age on root group Dariusz Sosnowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251104174612.1341962-3-dsosnowski@nvidia.com \
--to=dsosnowski@nvidia.com \
--cc=bingz@nvidia.com \
--cc=dev@dpdk.org \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=rasland@nvidia.com \
--cc=suanmingm@nvidia.com \
--cc=viacheslavo@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).