[1/5] net/mlx5: fix the table flags of mirror action

Message ID 20250617133933.313443-1-getelson@nvidia.com (mailing list archive)
State Superseded
Delegated to: Raslan Darawsheh
Headers
Series [1/5] net/mlx5: fix the table flags of mirror action |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Gregory Etelson June 17, 2025, 1:39 p.m. UTC
From: Bing Zhao <bingz@nvidia.com>

The HWS mirror action is created with STCs based on the flags. In the
past, there was a single type of FDB domain. After introducing the
unified FDB feature, there are 4 types of tables in FDB domain,
including FDB, FDB_RX, FDB_TX and FDB_UNIFIED. More STCs will be
allocated when the new FDB flags are set.

Without specifying the group ID, the default 0 would be used to
determine the table type. Since only the old FDB type was supported
on the root table. The flag was set wrongly and the STCs for other
FDB sub-types were not allocated.

When using this mirror action to create a flow in the unified FDB,
there are some errors:

  1. If there is no other action STC allocated before, the offsets
     of old FDB and unified FDB will be the same. But the value of
     the mirror is zero. The mirror action is not really applied even
     if no error is observed when pulling the result.
  2. If there is some other action STC allocated before, the offset
     0 will reflact that action but not the mirror itself. An error
     will be observed for the rule insertion.

Since the mirror is only supported in HWS non-root tables, setting
the group to some non-zero value will make STCs be allocated and
used properly.

Fixes: 8daf5794077f ("net/mlx5: support FDB unified domain")
Cc: ophirmu@nvidia.com

Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon June 26, 2025, 3:28 p.m. UTC | #1
26/06/2025 09:59, Gregory Etelson:
> Support SAMPLE flow action in the non-template API. 
> 
> Bing Zhao (1):
>   net/mlx5: fix the table flags of mirror action
> 
> Gregory Etelson (3):
>   net/mlx5: add a stand alone function for mirror creation
>   net/mlx5: add functions for non template sample action
>   net/mlx5: support non-template SAMPLE flow action

Applied, thanks.

Note: UINT32_WIDTH was replaced with 32 to help with Alpine musl.
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index af2e7a84a5..a8a3f3872a 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -14803,7 +14803,7 @@  flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
 	enum mlx5_indirect_list_type list_type;
 	struct rte_flow_action_list_handle *handle;
 	struct mlx5_priv *priv = dev->data->dev_private;
-	const struct mlx5_flow_template_table_cfg table_cfg = {
+	struct mlx5_flow_template_table_cfg table_cfg = {
 		.external = true,
 		.attr = {
 			.flow_attr = {
@@ -14840,6 +14840,11 @@  flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
 	}
 	switch (list_type) {
 	case MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR:
+		/*
+		 * Mirror action is only supported in HWS group. Setting group to
+		 * non-zero will ensure that the action resources are allocated correctly.
+		 */
+		table_cfg.attr.flow_attr.group = 1;
 		handle = mlx5_hw_mirror_handle_create(dev, &table_cfg,
 						      actions, error);
 		break;