Skip to content

Commit cb39d8f

Browse files
ddvladSasha Levin
authored andcommitted
net/mlx5: HWS, make sure the uplink is the last destination
[ Upstream commit b833582 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 9eac703 commit cb39d8f

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
@@ -1361,8 +1361,8 @@ mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx,
13611361
struct mlx5hws_cmd_set_fte_attr fte_attr = {0};
13621362
struct mlx5hws_cmd_forward_tbl *fw_island;
13631363
struct mlx5hws_action *action;
1364-
u32 i /*, packet_reformat_id*/;
1365-
int ret;
1364+
int ret, last_dest_idx = -1;
1365+
u32 i;
13661366

13671367
if (num_dest <= 1) {
13681368
mlx5hws_err(ctx, "Action must have multiple dests\n");
@@ -1392,11 +1392,8 @@ mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx,
13921392
dest_list[i].destination_id = dests[i].dest->dest_obj.obj_id;
13931393
fte_attr.action_flags |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
13941394
fte_attr.ignore_flow_level = ignore_flow_level;
1395-
/* ToDo: In SW steering we have a handling of 'go to WIRE'
1396-
* destination here by upper layer setting 'is_wire_ft' flag
1397-
* if the destination is wire.
1398-
* This is because uplink should be last dest in the list.
1399-
*/
1395+
if (dests[i].is_wire_ft)
1396+
last_dest_idx = i;
14001397
break;
14011398
case MLX5HWS_ACTION_TYP_VPORT:
14021399
dest_list[i].destination_type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
@@ -1420,6 +1417,9 @@ mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx,
14201417
}
14211418
}
14221419

1420+
if (last_dest_idx != -1)
1421+
swap(dest_list[last_dest_idx], dest_list[num_dest - 1]);
1422+
14231423
fte_attr.dests_num = num_dest;
14241424
fte_attr.dests = dest_list;
14251425

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
@@ -211,6 +211,7 @@ struct mlx5hws_action_dest_attr {
211211
struct mlx5hws_action *dest;
212212
/* Optional reformat action */
213213
struct mlx5hws_action *reformat;
214+
bool is_wire_ft;
214215
};
215216

216217
/**

0 commit comments

Comments
 (0)