]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/mlx5: fs, rename packet reformat struct member action
authorMoshe Shemesh <moshe@nvidia.com>
Wed, 16 Oct 2024 17:36:16 +0000 (20:36 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Mon, 21 Oct 2024 11:26:17 +0000 (13:26 +0200)
As preparation for HW Steering support, rename packet reformat struct
member action to fs_dr_action, to distinguish from fs_hws_action which
will be added. Add a pointer where needed to keep code line shorter and
more readable.

Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c

index 964937f17cf54b12f86b0d32d088f7b36da98d48..195f1cbd0a3428bc8388994e711d959146d3da35 100644 (file)
@@ -73,7 +73,7 @@ struct mlx5_pkt_reformat {
        int reformat_type; /* from mlx5_ifc */
        enum mlx5_flow_resource_owner owner;
        union {
-               struct mlx5_fs_dr_action action;
+               struct mlx5_fs_dr_action fs_dr_action;
                u32 id;
        };
 };
index 833cb68c744f2e81c768c5b3e65a064b979d4295..8dd412454c9749057d6e7b1ae38ce728496909c3 100644 (file)
@@ -256,6 +256,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
 {
        struct mlx5dr_domain *domain = ns->fs_dr_domain.dr_domain;
        struct mlx5dr_action_dest *term_actions;
+       struct mlx5_pkt_reformat *pkt_reformat;
        struct mlx5dr_match_parameters params;
        struct mlx5_core_dev *dev = ns->dev;
        struct mlx5dr_action **fs_dr_actions;
@@ -332,18 +333,19 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
        if (fte->act_dests.action.action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT) {
                bool is_decap;
 
-               if (fte->act_dests.action.pkt_reformat->owner == MLX5_FLOW_RESOURCE_OWNER_FW) {
+               pkt_reformat = fte->act_dests.action.pkt_reformat;
+               if (pkt_reformat->owner == MLX5_FLOW_RESOURCE_OWNER_FW) {
                        err = -EINVAL;
                        mlx5dr_err(domain, "FW-owned reformat can't be used in SW rule\n");
                        goto free_actions;
                }
 
-               is_decap = fte->act_dests.action.pkt_reformat->reformat_type ==
+               is_decap = pkt_reformat->reformat_type ==
                           MLX5_REFORMAT_TYPE_L3_TUNNEL_TO_L2;
 
                if (is_decap)
                        actions[num_actions++] =
-                               fte->act_dests.action.pkt_reformat->action.dr_action;
+                               pkt_reformat->fs_dr_action.dr_action;
                else
                        delay_encap_set = true;
        }
@@ -395,8 +397,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
        }
 
        if (delay_encap_set)
-               actions[num_actions++] =
-                       fte->act_dests.action.pkt_reformat->action.dr_action;
+               actions[num_actions++] = pkt_reformat->fs_dr_action.dr_action;
 
        /* The order of the actions below is not important */
 
@@ -458,9 +459,11 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
                                term_actions[num_term_actions].dest = tmp_action;
 
                                if (dst->dest_attr.vport.flags &
-                                   MLX5_FLOW_DEST_VPORT_REFORMAT_ID)
+                                   MLX5_FLOW_DEST_VPORT_REFORMAT_ID) {
+                                       pkt_reformat = dst->dest_attr.vport.pkt_reformat;
                                        term_actions[num_term_actions].reformat =
-                                               dst->dest_attr.vport.pkt_reformat->action.dr_action;
+                                               pkt_reformat->fs_dr_action.dr_action;
+                               }
 
                                num_term_actions++;
                                break;
@@ -671,7 +674,7 @@ static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns
        }
 
        pkt_reformat->owner = MLX5_FLOW_RESOURCE_OWNER_SW;
-       pkt_reformat->action.dr_action = action;
+       pkt_reformat->fs_dr_action.dr_action = action;
 
        return 0;
 }
@@ -679,7 +682,7 @@ static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns
 static void mlx5_cmd_dr_packet_reformat_dealloc(struct mlx5_flow_root_namespace *ns,
                                                struct mlx5_pkt_reformat *pkt_reformat)
 {
-       mlx5dr_action_destroy(pkt_reformat->action.dr_action);
+       mlx5dr_action_destroy(pkt_reformat->fs_dr_action.dr_action);
 }
 
 static int mlx5_cmd_dr_modify_header_alloc(struct mlx5_flow_root_namespace *ns,
@@ -836,7 +839,7 @@ int mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat
        case MLX5_REFORMAT_TYPE_L2_TO_L2_TUNNEL:
        case MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL:
        case MLX5_REFORMAT_TYPE_INSERT_HDR:
-               return mlx5dr_action_get_pkt_reformat_id(pkt_reformat->action.dr_action);
+               return mlx5dr_action_get_pkt_reformat_id(pkt_reformat->fs_dr_action.dr_action);
        }
        return -EOPNOTSUPP;
 }