From: Bing Zhao <bi...@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: ophi...@nvidia.com

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

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;
-- 
2.48.1

Reply via email to