Skip to content

Commit cf9a862

Browse files
mosheshemesh2kuba-moo
authored andcommitted
net/mlx5: Prevent flow steering mode changes in switchdev mode
Changing flow steering modes is not allowed when eswitch is in switchdev mode. This fix ensures that any steering mode change, including to firmware steering, is correctly blocked while eswitch mode is switchdev. Fixes: e890acd ("net/mlx5: Add devlink flow_steering_mode parameter") Signed-off-by: Moshe Shemesh <[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 26e42ec commit cf9a862

File tree

1 file changed

+7
-8
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,6 +3734,13 @@ static int mlx5_fs_mode_validate(struct devlink *devlink, u32 id,
37343734
char *value = val.vstr;
37353735
u8 eswitch_mode;
37363736

3737+
eswitch_mode = mlx5_eswitch_mode(dev);
3738+
if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) {
3739+
NL_SET_ERR_MSG_FMT_MOD(extack,
3740+
"Changing fs mode is not supported when eswitch offloads enabled.");
3741+
return -EOPNOTSUPP;
3742+
}
3743+
37373744
if (!strcmp(value, "dmfs"))
37383745
return 0;
37393746

@@ -3759,14 +3766,6 @@ static int mlx5_fs_mode_validate(struct devlink *devlink, u32 id,
37593766
return -EINVAL;
37603767
}
37613768

3762-
eswitch_mode = mlx5_eswitch_mode(dev);
3763-
if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) {
3764-
NL_SET_ERR_MSG_FMT_MOD(extack,
3765-
"Moving to %s is not supported when eswitch offloads enabled.",
3766-
value);
3767-
return -EOPNOTSUPP;
3768-
}
3769-
37703769
return 0;
37713770
}
37723771

0 commit comments

Comments
 (0)