Skip to content

Commit 03ebae1

Browse files
kliteynPaolo Abeni
authored andcommitted
net/mlx5: DR, use the right action structs for STEv3
Some actions in ConnectX-8 (STEv3) have different structure, and they are handled separately in ste_ctx_v3. This separate handling was missing two actions: INSERT_HDR and REMOVE_HDR, which broke SWS for Linux Bridge. This patch resolves the issue by introducing dedicated callbacks for the insert and remove header functions, with version-specific implementations for each STE variant. Fixes: 4d617b5 ("net/mlx5: DR, add support for ConnectX-8 steering") Signed-off-by: Yevgeny Kliteynik <[email protected]> Reviewed-by: Itamar Gozlan <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 1063ae0 commit 03ebae1

File tree

5 files changed

+79
-25
lines changed

5 files changed

+79
-25
lines changed

drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ struct mlx5dr_ste_ctx {
210210
void (*set_encap_l3)(u8 *hw_ste_p, u8 *frst_s_action,
211211
u8 *scnd_d_action, u32 reformat_id,
212212
int size);
213+
void (*set_insert_hdr)(u8 *hw_ste_p, u8 *d_action, u32 reformat_id,
214+
u8 anchor, u8 offset, int size);
215+
void (*set_remove_hdr)(u8 *hw_ste_p, u8 *s_action, u8 anchor,
216+
u8 offset, int size);
213217
/* Send */
214218
void (*prepare_for_postsend)(u8 *hw_ste_p, u32 ste_size);
215219
};

drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v1.c

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,10 @@ void dr_ste_v1_set_encap(u8 *hw_ste_p, u8 *d_action, u32 reformat_id, int size)
266266
dr_ste_v1_set_reparse(hw_ste_p);
267267
}
268268

269-
static void dr_ste_v1_set_insert_hdr(u8 *hw_ste_p, u8 *d_action,
270-
u32 reformat_id,
271-
u8 anchor, u8 offset,
272-
int size)
269+
void dr_ste_v1_set_insert_hdr(u8 *hw_ste_p, u8 *d_action,
270+
u32 reformat_id,
271+
u8 anchor, u8 offset,
272+
int size)
273273
{
274274
MLX5_SET(ste_double_action_insert_with_ptr_v1, d_action,
275275
action_id, DR_STE_V1_ACTION_ID_INSERT_POINTER);
@@ -286,9 +286,9 @@ static void dr_ste_v1_set_insert_hdr(u8 *hw_ste_p, u8 *d_action,
286286
dr_ste_v1_set_reparse(hw_ste_p);
287287
}
288288

289-
static void dr_ste_v1_set_remove_hdr(u8 *hw_ste_p, u8 *s_action,
290-
u8 anchor, u8 offset,
291-
int size)
289+
void dr_ste_v1_set_remove_hdr(u8 *hw_ste_p, u8 *s_action,
290+
u8 anchor, u8 offset,
291+
int size)
292292
{
293293
MLX5_SET(ste_single_action_remove_header_size_v1, s_action,
294294
action_id, DR_STE_V1_ACTION_ID_REMOVE_BY_SIZE);
@@ -584,11 +584,11 @@ void dr_ste_v1_set_actions_tx(struct mlx5dr_ste_ctx *ste_ctx,
584584
action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action);
585585
action_sz = DR_STE_ACTION_TRIPLE_SZ;
586586
}
587-
dr_ste_v1_set_insert_hdr(last_ste, action,
588-
attr->reformat.id,
589-
attr->reformat.param_0,
590-
attr->reformat.param_1,
591-
attr->reformat.size);
587+
ste_ctx->set_insert_hdr(last_ste, action,
588+
attr->reformat.id,
589+
attr->reformat.param_0,
590+
attr->reformat.param_1,
591+
attr->reformat.size);
592592
action_sz -= DR_STE_ACTION_DOUBLE_SZ;
593593
action += DR_STE_ACTION_DOUBLE_SZ;
594594
} else if (action_type_set[DR_ACTION_TYP_REMOVE_HDR]) {
@@ -597,10 +597,10 @@ void dr_ste_v1_set_actions_tx(struct mlx5dr_ste_ctx *ste_ctx,
597597
action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action);
598598
action_sz = DR_STE_ACTION_TRIPLE_SZ;
599599
}
600-
dr_ste_v1_set_remove_hdr(last_ste, action,
601-
attr->reformat.param_0,
602-
attr->reformat.param_1,
603-
attr->reformat.size);
600+
ste_ctx->set_remove_hdr(last_ste, action,
601+
attr->reformat.param_0,
602+
attr->reformat.param_1,
603+
attr->reformat.size);
604604
action_sz -= DR_STE_ACTION_SINGLE_SZ;
605605
action += DR_STE_ACTION_SINGLE_SZ;
606606
}
@@ -792,11 +792,11 @@ void dr_ste_v1_set_actions_rx(struct mlx5dr_ste_ctx *ste_ctx,
792792
action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action);
793793
action_sz = DR_STE_ACTION_TRIPLE_SZ;
794794
}
795-
dr_ste_v1_set_insert_hdr(last_ste, action,
796-
attr->reformat.id,
797-
attr->reformat.param_0,
798-
attr->reformat.param_1,
799-
attr->reformat.size);
795+
ste_ctx->set_insert_hdr(last_ste, action,
796+
attr->reformat.id,
797+
attr->reformat.param_0,
798+
attr->reformat.param_1,
799+
attr->reformat.size);
800800
action_sz -= DR_STE_ACTION_DOUBLE_SZ;
801801
action += DR_STE_ACTION_DOUBLE_SZ;
802802
allow_modify_hdr = false;
@@ -808,10 +808,10 @@ void dr_ste_v1_set_actions_rx(struct mlx5dr_ste_ctx *ste_ctx,
808808
allow_modify_hdr = true;
809809
allow_ctr = true;
810810
}
811-
dr_ste_v1_set_remove_hdr(last_ste, action,
812-
attr->reformat.param_0,
813-
attr->reformat.param_1,
814-
attr->reformat.size);
811+
ste_ctx->set_remove_hdr(last_ste, action,
812+
attr->reformat.param_0,
813+
attr->reformat.param_1,
814+
attr->reformat.size);
815815
action_sz -= DR_STE_ACTION_SINGLE_SZ;
816816
action += DR_STE_ACTION_SINGLE_SZ;
817817
}
@@ -2200,6 +2200,8 @@ static struct mlx5dr_ste_ctx ste_ctx_v1 = {
22002200
.set_pop_vlan = &dr_ste_v1_set_pop_vlan,
22012201
.set_rx_decap = &dr_ste_v1_set_rx_decap,
22022202
.set_encap_l3 = &dr_ste_v1_set_encap_l3,
2203+
.set_insert_hdr = &dr_ste_v1_set_insert_hdr,
2204+
.set_remove_hdr = &dr_ste_v1_set_remove_hdr,
22032205
/* Send */
22042206
.prepare_for_postsend = &dr_ste_v1_prepare_for_postsend,
22052207
};

drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v1.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ void dr_ste_v1_set_pop_vlan(u8 *hw_ste_p, u8 *s_action, u8 vlans_num);
156156
void dr_ste_v1_set_encap_l3(u8 *hw_ste_p, u8 *frst_s_action, u8 *scnd_d_action,
157157
u32 reformat_id, int size);
158158
void dr_ste_v1_set_rx_decap(u8 *hw_ste_p, u8 *s_action);
159+
void dr_ste_v1_set_insert_hdr(u8 *hw_ste_p, u8 *d_action, u32 reformat_id,
160+
u8 anchor, u8 offset, int size);
161+
void dr_ste_v1_set_remove_hdr(u8 *hw_ste_p, u8 *s_action, u8 anchor,
162+
u8 offset, int size);
159163
void dr_ste_v1_set_actions_tx(struct mlx5dr_ste_ctx *ste_ctx, struct mlx5dr_domain *dmn,
160164
u8 *action_type_set, u32 actions_caps, u8 *last_ste,
161165
struct mlx5dr_ste_actions_attr *attr, u32 *added_stes);

drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ static struct mlx5dr_ste_ctx ste_ctx_v2 = {
6969
.set_pop_vlan = &dr_ste_v1_set_pop_vlan,
7070
.set_rx_decap = &dr_ste_v1_set_rx_decap,
7171
.set_encap_l3 = &dr_ste_v1_set_encap_l3,
72+
.set_insert_hdr = &dr_ste_v1_set_insert_hdr,
73+
.set_remove_hdr = &dr_ste_v1_set_remove_hdr,
7274
/* Send */
7375
.prepare_for_postsend = &dr_ste_v1_prepare_for_postsend,
7476
};

drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v3.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,46 @@ static void dr_ste_v3_set_rx_decap(u8 *hw_ste_p, u8 *s_action)
7979
dr_ste_v1_set_reparse(hw_ste_p);
8080
}
8181

82+
static void dr_ste_v3_set_insert_hdr(u8 *hw_ste_p, u8 *d_action,
83+
u32 reformat_id, u8 anchor,
84+
u8 offset, int size)
85+
{
86+
MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action,
87+
action_id, DR_STE_V1_ACTION_ID_INSERT_POINTER);
88+
MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action,
89+
start_anchor, anchor);
90+
91+
/* The hardware expects here size and offset in words (2 byte) */
92+
MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action,
93+
size, size / 2);
94+
MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action,
95+
start_offset, offset / 2);
96+
97+
MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action,
98+
pointer, reformat_id);
99+
MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action,
100+
attributes, DR_STE_V1_ACTION_INSERT_PTR_ATTR_NONE);
101+
102+
dr_ste_v1_set_reparse(hw_ste_p);
103+
}
104+
105+
static void dr_ste_v3_set_remove_hdr(u8 *hw_ste_p, u8 *s_action,
106+
u8 anchor, u8 offset, int size)
107+
{
108+
MLX5_SET(ste_single_action_remove_header_size_v3, s_action,
109+
action_id, DR_STE_V1_ACTION_ID_REMOVE_BY_SIZE);
110+
MLX5_SET(ste_single_action_remove_header_size_v3, s_action,
111+
start_anchor, anchor);
112+
113+
/* The hardware expects here size and offset in words (2 byte) */
114+
MLX5_SET(ste_single_action_remove_header_size_v3, s_action,
115+
remove_size, size / 2);
116+
MLX5_SET(ste_single_action_remove_header_size_v3, s_action,
117+
start_offset, offset / 2);
118+
119+
dr_ste_v1_set_reparse(hw_ste_p);
120+
}
121+
82122
static int
83123
dr_ste_v3_set_action_decap_l3_list(void *data, u32 data_sz,
84124
u8 *hw_action, u32 hw_action_sz,
@@ -211,6 +251,8 @@ static struct mlx5dr_ste_ctx ste_ctx_v3 = {
211251
.set_pop_vlan = &dr_ste_v3_set_pop_vlan,
212252
.set_rx_decap = &dr_ste_v3_set_rx_decap,
213253
.set_encap_l3 = &dr_ste_v3_set_encap_l3,
254+
.set_insert_hdr = &dr_ste_v3_set_insert_hdr,
255+
.set_remove_hdr = &dr_ste_v3_set_remove_hdr,
214256
/* Send */
215257
.prepare_for_postsend = &dr_ste_v1_prepare_for_postsend,
216258
};

0 commit comments

Comments
 (0)