Skip to content

Commit b833582

Browse files
ddvladkuba-moo
authored andcommitted
net/mlx5: HWS, make sure the uplink is the last destination
When there are more than one destinations, we create a FW flow table and provide it with all the destinations. FW requires to have wire as the last destination in the list (if it exists), otherwise the operation fails with FW syndrome. This patch fixes the destination array action creation: if it contains a wire destination, it is moved to the end. Fixes: 504e536 ("net/mlx5: HWS, added actions handling") Signed-off-by: Vlad Dogaru <[email protected]> Reviewed-by: Yevgeny Kliteynik <[email protected]> Signed-off-by: Mark Bloch <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b5e3c76 commit b833582

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,8 +1370,8 @@ mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx,
13701370
struct mlx5hws_cmd_set_fte_attr fte_attr = {0};
13711371
struct mlx5hws_cmd_forward_tbl *fw_island;
13721372
struct mlx5hws_action *action;
1373-
u32 i /*, packet_reformat_id*/;
1374-
int ret;
1373+
int ret, last_dest_idx = -1;
1374+
u32 i;
13751375

13761376
if (num_dest <= 1) {
13771377
mlx5hws_err(ctx, "Action must have multiple dests\n");
@@ -1401,11 +1401,8 @@ mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx,
14011401
dest_list[i].destination_id = dests[i].dest->dest_obj.obj_id;
14021402
fte_attr.action_flags |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
14031403
fte_attr.ignore_flow_level = ignore_flow_level;
1404-
/* ToDo: In SW steering we have a handling of 'go to WIRE'
1405-
* destination here by upper layer setting 'is_wire_ft' flag
1406-
* if the destination is wire.
1407-
* This is because uplink should be last dest in the list.
1408-
*/
1404+
if (dests[i].is_wire_ft)
1405+
last_dest_idx = i;
14091406
break;
14101407
case MLX5HWS_ACTION_TYP_VPORT:
14111408
dest_list[i].destination_type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
@@ -1429,6 +1426,9 @@ mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx,
14291426
}
14301427
}
14311428

1429+
if (last_dest_idx != -1)
1430+
swap(dest_list[last_dest_idx], dest_list[num_dest - 1]);
1431+
14321432
fte_attr.dests_num = num_dest;
14331433
fte_attr.dests = dest_list;
14341434

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,9 @@ static int mlx5_fs_fte_get_hws_actions(struct mlx5_flow_root_namespace *ns,
966966
switch (attr->type) {
967967
case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
968968
dest_action = mlx5_fs_get_dest_action_ft(fs_ctx, dst);
969+
if (dst->dest_attr.ft->flags &
970+
MLX5_FLOW_TABLE_UPLINK_VPORT)
971+
dest_actions[num_dest_actions].is_wire_ft = true;
969972
break;
970973
case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM:
971974
dest_action = mlx5_fs_get_dest_action_table_num(fs_ctx,

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ struct mlx5hws_action_dest_attr {
213213
struct mlx5hws_action *dest;
214214
/* Optional reformat action */
215215
struct mlx5hws_action *reformat;
216+
bool is_wire_ft;
216217
};
217218

218219
/**

0 commit comments

Comments
 (0)