mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
net/mlx5e: ethtool, Fix restriction of autoneg with 56G
[ Upstream commit b1c0aca3d3ddeebeec57ada9c2df9ed647939249 ]
Prior to this patch, configuring speed to 50G with autoneg off over
devices supporting 50G per lane failed.
Support for 50G per lane introduced a new set of link-modes, on which
driver always performed a speed validation as if only legacy link-modes
were configured. Fix driver speed validation to force setting autoneg
over 56G only if in legacy link-mode.
Fixes: 3d7cadae51
("net/mlx5e: ethtool, Fix analysis of speed setting")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Eran Ben Elisha <eranbe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
39e86d3ca4
commit
dd7cce96dd
@ -1007,6 +1007,22 @@ static int mlx5e_get_link_ksettings(struct net_device *netdev,
|
|||||||
return mlx5e_ethtool_get_link_ksettings(priv, link_ksettings);
|
return mlx5e_ethtool_get_link_ksettings(priv, link_ksettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mlx5e_speed_validate(struct net_device *netdev, bool ext,
|
||||||
|
const unsigned long link_modes, u8 autoneg)
|
||||||
|
{
|
||||||
|
/* Extended link-mode has no speed limitations. */
|
||||||
|
if (ext)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if ((link_modes & MLX5E_PROT_MASK(MLX5E_56GBASE_R4)) &&
|
||||||
|
autoneg != AUTONEG_ENABLE) {
|
||||||
|
netdev_err(netdev, "%s: 56G link speed requires autoneg enabled\n",
|
||||||
|
__func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static u32 mlx5e_ethtool2ptys_adver_link(const unsigned long *link_modes)
|
static u32 mlx5e_ethtool2ptys_adver_link(const unsigned long *link_modes)
|
||||||
{
|
{
|
||||||
u32 i, ptys_modes = 0;
|
u32 i, ptys_modes = 0;
|
||||||
@ -1100,13 +1116,9 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
|
|||||||
link_modes = autoneg == AUTONEG_ENABLE ? ethtool2ptys_adver_func(adver) :
|
link_modes = autoneg == AUTONEG_ENABLE ? ethtool2ptys_adver_func(adver) :
|
||||||
mlx5e_port_speed2linkmodes(mdev, speed, !ext);
|
mlx5e_port_speed2linkmodes(mdev, speed, !ext);
|
||||||
|
|
||||||
if ((link_modes & MLX5E_PROT_MASK(MLX5E_56GBASE_R4)) &&
|
err = mlx5e_speed_validate(priv->netdev, ext, link_modes, autoneg);
|
||||||
autoneg != AUTONEG_ENABLE) {
|
if (err)
|
||||||
netdev_err(priv->netdev, "%s: 56G link speed requires autoneg enabled\n",
|
|
||||||
__func__);
|
|
||||||
err = -EINVAL;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
link_modes = link_modes & eproto.cap;
|
link_modes = link_modes & eproto.cap;
|
||||||
if (!link_modes) {
|
if (!link_modes) {
|
||||||
|
Loading…
Reference in New Issue
Block a user