OSDN Git Service

net/mlx5: DR, Add ignore_flow_level support for multi-dest flow tables
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Sun, 4 Jul 2021 14:42:04 +0000 (17:42 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 26 Aug 2021 22:38:02 +0000 (15:38 -0700)
When creating an FTE, we might need to create multi-destination flow table,
which is eventually created by FW. In such case, this FW table should
include all the FTE properties as requested by the upper layer, including
the ability to point to another flow table with level lower or equal to
the current table - indicated by the "ignore_flow_level" property.

Signed-off-by: Chris Mi <cmi@nvidia.com>
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c
drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h

index dcaf0bb..f3327ee 100644 (file)
@@ -845,7 +845,8 @@ dec_ref:
 struct mlx5dr_action *
 mlx5dr_action_create_mult_dest_tbl(struct mlx5dr_domain *dmn,
                                   struct mlx5dr_action_dest *dests,
-                                  u32 num_of_dests)
+                                  u32 num_of_dests,
+                                  bool ignore_flow_level)
 {
        struct mlx5dr_cmd_flow_destination_hw_info *hw_dests;
        struct mlx5dr_action **ref_actions;
@@ -912,7 +913,8 @@ mlx5dr_action_create_mult_dest_tbl(struct mlx5dr_domain *dmn,
                                      num_of_dests,
                                      reformat_req,
                                      &action->dest_tbl->fw_tbl.id,
-                                     &action->dest_tbl->fw_tbl.group_id);
+                                     &action->dest_tbl->fw_tbl.group_id,
+                                     ignore_flow_level);
        if (ret)
                goto free_action;
 
index 54e1f54..5630728 100644 (file)
@@ -655,6 +655,7 @@ int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev,
        MLX5_SET(set_fte_in, in, table_type, ft->type);
        MLX5_SET(set_fte_in, in, table_id, ft->id);
        MLX5_SET(set_fte_in, in, flow_index, fte->index);
+       MLX5_SET(set_fte_in, in, ignore_flow_level, fte->ignore_flow_level);
        if (ft->vport) {
                MLX5_SET(set_fte_in, in, vport_number, ft->vport);
                MLX5_SET(set_fte_in, in, other_vport, 1);
index 7ccfd40..0d6f86e 100644 (file)
@@ -103,7 +103,8 @@ int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn,
                            int num_dest,
                            bool reformat_req,
                            u32 *tbl_id,
-                           u32 *group_id)
+                           u32 *group_id,
+                           bool ignore_flow_level)
 {
        struct mlx5dr_cmd_create_flow_table_attr ft_attr = {};
        struct mlx5dr_cmd_fte_info fte_info = {};
@@ -137,6 +138,7 @@ int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn,
        fte_info.dests_size = num_dest;
        fte_info.val = val;
        fte_info.dest_arr = dest;
+       fte_info.ignore_flow_level = ignore_flow_level;
 
        ret = mlx5dr_cmd_set_fte(dmn->mdev, 0, 0, &ft_info, *group_id, &fte_info);
        if (ret) {
index 4fd14e9..e45fbd6 100644 (file)
@@ -1337,6 +1337,7 @@ struct mlx5dr_cmd_fte_info {
        u32 *val;
        struct mlx5_flow_act action;
        struct mlx5dr_cmd_flow_destination_hw_info *dest_arr;
+       bool ignore_flow_level;
 };
 
 int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev,
@@ -1366,7 +1367,8 @@ int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn,
                            int num_dest,
                            bool reformat_req,
                            u32 *tbl_id,
-                           u32 *group_id);
+                           u32 *group_id,
+                           bool ignore_flow_level);
 void mlx5dr_fw_destroy_md_tbl(struct mlx5dr_domain *dmn, u32 tbl_id,
                              u32 group_id);
 #endif  /* _DR_TYPES_H_ */
index 6ea4a09..633c9ec 100644 (file)
@@ -490,9 +490,13 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
 
                actions[num_actions++] = term_actions->dest;
        } else if (num_term_actions > 1) {
+               bool ignore_flow_level =
+                       !!(fte->action.flags & FLOW_ACT_IGNORE_FLOW_LEVEL);
+
                tmp_action = mlx5dr_action_create_mult_dest_tbl(domain,
                                                                term_actions,
-                                                               num_term_actions);
+                                                               num_term_actions,
+                                                               ignore_flow_level);
                if (!tmp_action) {
                        err = -EOPNOTSUPP;
                        goto free_actions;
index fee37fa..c5a8b16 100644 (file)
@@ -95,7 +95,8 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain,
 struct mlx5dr_action *
 mlx5dr_action_create_mult_dest_tbl(struct mlx5dr_domain *dmn,
                                   struct mlx5dr_action_dest *dests,
-                                  u32 num_of_dests);
+                                  u32 num_of_dests,
+                                  bool ignore_flow_level);
 
 struct mlx5dr_action *mlx5dr_action_create_drop(void);