Skip to content

Commit 8da6fe2

Browse files
jialiu02Saeed Mahameed
authored andcommitted
net/mlx5: Add core support for double vlan push/pop steering action
As newer firmware supports double push/pop in a single FTE, we add core bits and extend vlan action logic for it. Signed-off-by: Jianbo Liu <[email protected]> Reviewed-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 5e022dd commit 8da6fe2

File tree

6 files changed

+29
-10
lines changed

6 files changed

+29
-10
lines changed

drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ TRACE_EVENT(mlx5_fs_del_fg,
138138
{MLX5_FLOW_CONTEXT_ACTION_MOD_HDR, "MOD_HDR"},\
139139
{MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH, "VLAN_PUSH"},\
140140
{MLX5_FLOW_CONTEXT_ACTION_VLAN_POP, "VLAN_POP"},\
141+
{MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2, "VLAN_PUSH_2"},\
142+
{MLX5_FLOW_CONTEXT_ACTION_VLAN_POP_2, "VLAN_POP_2"},\
141143
{MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO, "NEXT_PRIO"}
142144

143145
TRACE_EVENT(mlx5_fs_set_fte,

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw,
7070
flow_act.action &= ~(MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH |
7171
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP);
7272
else if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) {
73-
flow_act.vlan.ethtype = ntohs(attr->vlan_proto);
74-
flow_act.vlan.vid = attr->vlan_vid;
75-
flow_act.vlan.prio = attr->vlan_prio;
73+
flow_act.vlan[0].ethtype = ntohs(attr->vlan_proto);
74+
flow_act.vlan[0].vid = attr->vlan_vid;
75+
flow_act.vlan[0].prio = attr->vlan_prio;
7676
}
7777

7878
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {

drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,15 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
349349

350350
vlan = MLX5_ADDR_OF(flow_context, in_flow_context, push_vlan);
351351

352-
MLX5_SET(vlan, vlan, ethtype, fte->action.vlan.ethtype);
353-
MLX5_SET(vlan, vlan, vid, fte->action.vlan.vid);
354-
MLX5_SET(vlan, vlan, prio, fte->action.vlan.prio);
352+
MLX5_SET(vlan, vlan, ethtype, fte->action.vlan[0].ethtype);
353+
MLX5_SET(vlan, vlan, vid, fte->action.vlan[0].vid);
354+
MLX5_SET(vlan, vlan, prio, fte->action.vlan[0].prio);
355+
356+
vlan = MLX5_ADDR_OF(flow_context, in_flow_context, push_vlan_2);
357+
358+
MLX5_SET(vlan, vlan, ethtype, fte->action.vlan[1].ethtype);
359+
MLX5_SET(vlan, vlan, vid, fte->action.vlan[1].vid);
360+
MLX5_SET(vlan, vlan, prio, fte->action.vlan[1].prio);
355361

356362
in_match_value = MLX5_ADDR_OF(flow_context, in_flow_context,
357363
match_value);

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,9 @@ static bool check_conflicting_actions(u32 action1, u32 action2)
14641464
MLX5_FLOW_CONTEXT_ACTION_DECAP |
14651465
MLX5_FLOW_CONTEXT_ACTION_MOD_HDR |
14661466
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP |
1467-
MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH))
1467+
MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH |
1468+
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP_2 |
1469+
MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2))
14681470
return true;
14691471

14701472
return false;

include/linux/mlx5/fs.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,16 @@ struct mlx5_fs_vlan {
152152
u8 prio;
153153
};
154154

155+
#define MLX5_FS_VLAN_DEPTH 2
156+
155157
struct mlx5_flow_act {
156158
u32 action;
157159
bool has_flow_tag;
158160
u32 flow_tag;
159161
u32 encap_id;
160162
u32 modify_id;
161163
uintptr_t esp_id;
162-
struct mlx5_fs_vlan vlan;
164+
struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH];
163165
struct ib_counters *counters;
164166
};
165167

include/linux/mlx5/mlx5_ifc.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ struct mlx5_ifc_flow_table_prop_layout_bits {
337337
u8 reserved_at_9[0x1];
338338
u8 pop_vlan[0x1];
339339
u8 push_vlan[0x1];
340-
u8 reserved_at_c[0x14];
340+
u8 reserved_at_c[0x1];
341+
u8 pop_vlan_2[0x1];
342+
u8 push_vlan_2[0x1];
343+
u8 reserved_at_f[0x11];
341344

342345
u8 reserved_at_20[0x2];
343346
u8 log_max_ft_size[0x6];
@@ -2386,6 +2389,8 @@ enum {
23862389
MLX5_FLOW_CONTEXT_ACTION_MOD_HDR = 0x40,
23872390
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP = 0x80,
23882391
MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH = 0x100,
2392+
MLX5_FLOW_CONTEXT_ACTION_VLAN_POP_2 = 0x400,
2393+
MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2 = 0x800,
23892394
};
23902395

23912396
struct mlx5_ifc_vlan_bits {
@@ -2416,7 +2421,9 @@ struct mlx5_ifc_flow_context_bits {
24162421

24172422
u8 modify_header_id[0x20];
24182423

2419-
u8 reserved_at_100[0x100];
2424+
struct mlx5_ifc_vlan_bits push_vlan_2;
2425+
2426+
u8 reserved_at_120[0xe0];
24202427

24212428
struct mlx5_ifc_fte_match_param_bits match_value;
24222429

0 commit comments

Comments
 (0)