net/mlx5: Skip disabled vports when setting max TX speed

When setting vports max TX speed during LAG activation or bond state
changes, the code iterates over all eswitch vports. However, some
vports may not be enabled yet.

Skip vports that are not enabled to avoid sending FW commands for
uninitialized vports. Save the LAG aggregated speed in the vport
struct so it can be applied when the vport is enabled later.

Fixes: 50f1d188c5 ("net/mlx5: Propagate LAG effective max_tx_speed to vports")
Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260513063640.334132-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Or Har-Toov 2026-05-13 09:36:40 +03:00 committed by Jakub Kicinski
parent 8d0a5af8b1
commit c6df9a65cb
3 changed files with 27 additions and 0 deletions

View File

@ -908,6 +908,24 @@ static void esw_vport_cleanup(struct mlx5_eswitch *esw, struct mlx5_vport *vport
esw_vport_cleanup_acl(esw, vport);
}
static void mlx5_esw_vport_set_max_tx_speed(struct mlx5_eswitch *esw,
struct mlx5_vport *vport)
{
int ret;
if (!MLX5_CAP_ESW(esw->dev, esw_vport_state_max_tx_speed))
return;
ret = mlx5_modify_vport_max_tx_speed(esw->dev,
MLX5_VPORT_STATE_OP_MOD_ESW_VPORT,
vport->vport, true,
vport->agg_max_tx_speed);
if (ret)
mlx5_core_dbg(esw->dev,
"Failed to set vport %d speed %d, err=%d\n",
vport->vport, vport->agg_max_tx_speed, ret);
}
int mlx5_esw_vport_enable(struct mlx5_eswitch *esw, struct mlx5_vport *vport,
enum mlx5_eswitch_vport_event enabled_events)
{
@ -948,6 +966,9 @@ int mlx5_esw_vport_enable(struct mlx5_eswitch *esw, struct mlx5_vport *vport,
esw->enabled_vports++;
esw_debug(esw->dev, "Enabled VPORT(%d)\n", vport_num);
if (vport->agg_max_tx_speed)
mlx5_esw_vport_set_max_tx_speed(esw, vport);
done:
mutex_unlock(&esw->state_lock);
return ret;

View File

@ -247,6 +247,7 @@ struct mlx5_vport {
enum mlx5_eswitch_vport_event enabled_events;
int index;
struct mlx5_devlink_port *dl_port;
u32 agg_max_tx_speed;
};
struct mlx5_esw_indir_table;

View File

@ -1274,6 +1274,11 @@ static void mlx5_lag_modify_device_vports_speed(struct mlx5_core_dev *mdev,
if (vport->vport == MLX5_VPORT_UPLINK)
continue;
vport->agg_max_tx_speed = speed;
if (!vport->enabled)
continue;
ret = mlx5_modify_vport_max_tx_speed(mdev, op_mod,
vport->vport, true, speed);
if (ret)