Skip to content

Commit 1715f0a

Browse files
mosheshemesh2Paolo Abeni
authored andcommitted
net/mlx5: fs, rename packet reformat struct member action
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 <[email protected]> Signed-off-by: Moshe Shemesh <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent f0ac620 commit 1715f0a

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

drivers/net/ethernet/mellanox/mlx5/core/fs_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct mlx5_pkt_reformat {
7373
int reformat_type; /* from mlx5_ifc */
7474
enum mlx5_flow_resource_owner owner;
7575
union {
76-
struct mlx5_fs_dr_action action;
76+
struct mlx5_fs_dr_action fs_dr_action;
7777
u32 id;
7878
};
7979
};

drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
256256
{
257257
struct mlx5dr_domain *domain = ns->fs_dr_domain.dr_domain;
258258
struct mlx5dr_action_dest *term_actions;
259+
struct mlx5_pkt_reformat *pkt_reformat;
259260
struct mlx5dr_match_parameters params;
260261
struct mlx5_core_dev *dev = ns->dev;
261262
struct mlx5dr_action **fs_dr_actions;
@@ -332,18 +333,19 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
332333
if (fte->act_dests.action.action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT) {
333334
bool is_decap;
334335

335-
if (fte->act_dests.action.pkt_reformat->owner == MLX5_FLOW_RESOURCE_OWNER_FW) {
336+
pkt_reformat = fte->act_dests.action.pkt_reformat;
337+
if (pkt_reformat->owner == MLX5_FLOW_RESOURCE_OWNER_FW) {
336338
err = -EINVAL;
337339
mlx5dr_err(domain, "FW-owned reformat can't be used in SW rule\n");
338340
goto free_actions;
339341
}
340342

341-
is_decap = fte->act_dests.action.pkt_reformat->reformat_type ==
343+
is_decap = pkt_reformat->reformat_type ==
342344
MLX5_REFORMAT_TYPE_L3_TUNNEL_TO_L2;
343345

344346
if (is_decap)
345347
actions[num_actions++] =
346-
fte->act_dests.action.pkt_reformat->action.dr_action;
348+
pkt_reformat->fs_dr_action.dr_action;
347349
else
348350
delay_encap_set = true;
349351
}
@@ -395,8 +397,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
395397
}
396398

397399
if (delay_encap_set)
398-
actions[num_actions++] =
399-
fte->act_dests.action.pkt_reformat->action.dr_action;
400+
actions[num_actions++] = pkt_reformat->fs_dr_action.dr_action;
400401

401402
/* The order of the actions below is not important */
402403

@@ -458,9 +459,11 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
458459
term_actions[num_term_actions].dest = tmp_action;
459460

460461
if (dst->dest_attr.vport.flags &
461-
MLX5_FLOW_DEST_VPORT_REFORMAT_ID)
462+
MLX5_FLOW_DEST_VPORT_REFORMAT_ID) {
463+
pkt_reformat = dst->dest_attr.vport.pkt_reformat;
462464
term_actions[num_term_actions].reformat =
463-
dst->dest_attr.vport.pkt_reformat->action.dr_action;
465+
pkt_reformat->fs_dr_action.dr_action;
466+
}
464467

465468
num_term_actions++;
466469
break;
@@ -671,15 +674,15 @@ static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns
671674
}
672675

673676
pkt_reformat->owner = MLX5_FLOW_RESOURCE_OWNER_SW;
674-
pkt_reformat->action.dr_action = action;
677+
pkt_reformat->fs_dr_action.dr_action = action;
675678

676679
return 0;
677680
}
678681

679682
static void mlx5_cmd_dr_packet_reformat_dealloc(struct mlx5_flow_root_namespace *ns,
680683
struct mlx5_pkt_reformat *pkt_reformat)
681684
{
682-
mlx5dr_action_destroy(pkt_reformat->action.dr_action);
685+
mlx5dr_action_destroy(pkt_reformat->fs_dr_action.dr_action);
683686
}
684687

685688
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
836839
case MLX5_REFORMAT_TYPE_L2_TO_L2_TUNNEL:
837840
case MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL:
838841
case MLX5_REFORMAT_TYPE_INSERT_HDR:
839-
return mlx5dr_action_get_pkt_reformat_id(pkt_reformat->action.dr_action);
842+
return mlx5dr_action_get_pkt_reformat_id(pkt_reformat->fs_dr_action.dr_action);
840843
}
841844
return -EOPNOTSUPP;
842845
}

0 commit comments

Comments
 (0)