Commit cf9a8627 authored by Moshe Shemesh's avatar Moshe Shemesh Committed by Jakub Kicinski
Browse files

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: e890acd5 ("net/mlx5: Add devlink flow_steering_mode parameter")
Signed-off-by: default avatarMoshe Shemesh <moshe@nvidia.com>
Signed-off-by: default avatarMark Bloch <mbloch@nvidia.com>
Link: https://patch.msgid.link/20250825143435.598584-9-mbloch@nvidia.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 26e42ec7
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -3734,6 +3734,13 @@ static int mlx5_fs_mode_validate(struct devlink *devlink, u32 id,
	char *value = val.vstr;
	u8 eswitch_mode;

	eswitch_mode = mlx5_eswitch_mode(dev);
	if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) {
		NL_SET_ERR_MSG_FMT_MOD(extack,
				       "Changing fs mode is not supported when eswitch offloads enabled.");
		return -EOPNOTSUPP;
	}

	if (!strcmp(value, "dmfs"))
		return 0;

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

	eswitch_mode = mlx5_eswitch_mode(dev);
	if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) {
		NL_SET_ERR_MSG_FMT_MOD(extack,
				       "Moving to %s is not supported when eswitch offloads enabled.",
				       value);
		return -EOPNOTSUPP;
	}

	return 0;
}