Skip to content

Commit a189ac7

Browse files
mosheshemesh2gregkh
authored andcommitted
net/mlx5: Prevent flow steering mode changes in switchdev mode
[ Upstream commit cf9a862 ] 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 <moshe@nvidia.com> Signed-off-by: Mark Bloch <mbloch@nvidia.com> Link: https://patch.msgid.link/20250825143435.598584-9-mbloch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4b67894 commit a189ac7

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
@@ -3706,6 +3706,13 @@ static int mlx5_fs_mode_validate(struct devlink *devlink, u32 id,
37063706
char *value = val.vstr;
37073707
u8 eswitch_mode;
37083708

3709+
eswitch_mode = mlx5_eswitch_mode(dev);
3710+
if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) {
3711+
NL_SET_ERR_MSG_FMT_MOD(extack,
3712+
"Changing fs mode is not supported when eswitch offloads enabled.");
3713+
return -EOPNOTSUPP;
3714+
}
3715+
37093716
if (!strcmp(value, "dmfs"))
37103717
return 0;
37113718

@@ -3731,14 +3738,6 @@ static int mlx5_fs_mode_validate(struct devlink *devlink, u32 id,
37313738
return -EINVAL;
37323739
}
37333740

3734-
eswitch_mode = mlx5_eswitch_mode(dev);
3735-
if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) {
3736-
NL_SET_ERR_MSG_FMT_MOD(extack,
3737-
"Moving to %s is not supported when eswitch offloads enabled.",
3738-
value);
3739-
return -EOPNOTSUPP;
3740-
}
3741-
37423741
return 0;
37433742
}
37443743

0 commit comments

Comments
 (0)