From: Rayane Boussanni <rboussanni@gmail.com>
To: dev@dpdk.org
Cc: dsosnowski@nvidia.com, rasland@nvidia.com,
Rayane Boussanni <rboussanni@gmail.com>
Subject: [PATCH v3] net/mlx5: add validation for indirect actions
Date: Thu, 14 May 2026 15:33:59 -0400 [thread overview]
Message-ID: <20260514193359.195017-1-rboussanni@gmail.com> (raw)
In-Reply-To: <20260417222104.66543-1-rboussanni@gmail.com>
This patch implements missing validation logic for RSS and Connection
Tracking (ConnTrack) indirect actions in the Hardware Steering (HWS)
flow engine.
Previously, these actions were accepted without being validated
against hardware capabilities, which could lead to unexpected behavior
when applying flow rules. The specialist validation functions
(mlx5_hw_validate_action_rss and mlx5_hw_validate_action_conntrack)
already existed but were not wired up to the indirect action handler.
The signature of flow_hw_validate_action_indirect was updated to
include the actions template attributes (attr), allowing it to pass
the necessary traffic direction context (ingress/egress/transfer)
to the underlying validation specialists. For indirect RSS, only the
template attributes are validated, as the RSS configuration itself is
already validated when the indirect action handle is created.
Reported-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Signed-off-by: Rayane Boussanni <rboussanni@gmail.com>
---
v3:
- Fix segfault reported by Dariusz Sosnowski when an actions template
references an indirect RSS action. v2 called
mlx5_hw_validate_action_rss() on the indirect path, which
dereferences action->conf as struct rte_flow_action_rss. For indirect
actions action->conf is an opaque action handle, not an RSS config.
Add bool is_indirect to mlx5_hw_validate_action_rss() so the indirect
path validates only the template attributes
(ingress/egress/transfer).
drivers/net/mlx5/mlx5_flow_hw.c | 36 ++++++++++++++++++++++++++++++---
1 file changed, 33 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index bca5b2769e..da5eb0bc42 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -349,6 +349,23 @@ mlx5_flow_ct_init(struct rte_eth_dev *dev,
static __rte_always_inline uint32_t flow_hw_tx_tag_regc_mask(struct rte_eth_dev *dev);
static __rte_always_inline uint32_t flow_hw_tx_tag_regc_value(struct rte_eth_dev *dev);
+static int
+mlx5_hw_validate_action_rss(struct rte_eth_dev *dev,
+ const struct rte_flow_action *template_action,
+ const struct rte_flow_action *template_mask,
+ const struct rte_flow_actions_template_attr *template_attr,
+ uint64_t action_flags,
+ bool is_indirect,
+ struct rte_flow_error *error);
+
+static int
+mlx5_hw_validate_action_conntrack(struct rte_eth_dev *dev,
+ const struct rte_flow_action *template_action,
+ const struct rte_flow_action *template_mask,
+ const struct rte_flow_actions_template_attr *template_attr,
+ uint64_t action_flags,
+ struct rte_flow_error *error);
+
static int flow_hw_async_create_validate(struct rte_eth_dev *dev,
const uint32_t queue,
const struct rte_flow_template_table *table,
@@ -6604,6 +6621,8 @@ flow_hw_validate_action_meter_mark(struct rte_eth_dev *dev,
* Pointer to the indirect action.
* @param[in] mask
* Pointer to the indirect action mask.
+ * @param[in] attr
+ * Pointer to the action template attributes.
* @param[in, out] action_flags
* Holds the actions detected until now.
* @param[in, out] fixed_cnt
@@ -6618,6 +6637,7 @@ static int
flow_hw_validate_action_indirect(struct rte_eth_dev *dev,
const struct rte_flow_action *action,
const struct rte_flow_action *mask,
+ const struct rte_flow_actions_template_attr *attr,
uint64_t *action_flags, bool *fixed_cnt,
struct rte_flow_error *error)
{
@@ -6637,11 +6657,17 @@ flow_hw_validate_action_indirect(struct rte_eth_dev *dev,
*action_flags |= MLX5_FLOW_ACTION_METER;
break;
case RTE_FLOW_ACTION_TYPE_RSS:
- /* TODO: Validation logic (same as flow_hw_actions_validate) */
+ ret = mlx5_hw_validate_action_rss(dev, action, mask, attr,
+ *action_flags, true, error);
+ if (ret < 0)
+ return ret;
*action_flags |= MLX5_FLOW_ACTION_RSS;
break;
case RTE_FLOW_ACTION_TYPE_CONNTRACK:
- /* TODO: Validation logic (same as flow_hw_actions_validate) */
+ ret = mlx5_hw_validate_action_conntrack(dev, action, mask, attr,
+ *action_flags, error);
+ if (ret < 0)
+ return ret;
*action_flags |= MLX5_FLOW_ACTION_CT;
break;
case RTE_FLOW_ACTION_TYPE_COUNT:
@@ -7139,6 +7165,7 @@ mlx5_hw_validate_action_rss(struct rte_eth_dev *dev,
const struct rte_flow_action *template_mask,
const struct rte_flow_actions_template_attr *template_attr,
__rte_unused uint64_t action_flags,
+ bool is_indirect,
struct rte_flow_error *error)
{
struct mlx5_priv *priv = dev->data->dev_private;
@@ -7148,6 +7175,8 @@ mlx5_hw_validate_action_rss(struct rte_eth_dev *dev,
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ATTR, NULL,
"RSS action supported for ingress only");
+ if (is_indirect)
+ return 0;
if (mask != NULL)
return mlx5_validate_action_rss(dev, template_action, error);
else
@@ -7352,6 +7381,7 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev,
case RTE_FLOW_ACTION_TYPE_INDIRECT:
ret = flow_hw_validate_action_indirect(dev, action,
mask,
+ attr,
&action_flags,
&fixed_cnt,
error);
@@ -7407,7 +7437,7 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev,
case RTE_FLOW_ACTION_TYPE_RSS:
ret = mlx5_hw_validate_action_rss(dev, action, mask,
attr, action_flags,
- error);
+ false, error);
if (ret)
return ret;
action_flags |= MLX5_FLOW_ACTION_RSS;
--
2.43.0
prev parent reply other threads:[~2026-05-14 19:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 15:01 [PATCH] net/mlx5: add validation for indirect actions Rayane Boussanni
2026-04-17 22:21 ` [PATCH v2] " Rayane Boussanni
2026-05-08 17:11 ` Dariusz Sosnowski
2026-05-14 19:33 ` Rayane Boussanni [this message]
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=20260514193359.195017-1-rboussanni@gmail.com \
--to=rboussanni@gmail.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=rasland@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.