Commit 3d7cadae authored by Aya Levin's avatar Aya Levin Committed by Saeed Mahameed

net/mlx5e: ethtool, Fix analysis of speed setting

When setting speed to 100G via ethtool (AN is set to off), only 25G*4 is
configured while the user, who has an advanced HW which supports
extended PTYS, expects also 50G*2 to be configured.
With this patch, when extended PTYS mode is available, configure
PTYS via extended fields.

Fixes: 4b95840a ("net/mlx5e: Fix matching of speed to PRM link modes")
Signed-off-by: default avatarAya Levin <ayal@mellanox.com>
Reviewed-by: default avatarEran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 6d485e5e
...@@ -1027,18 +1027,11 @@ static bool ext_link_mode_requested(const unsigned long *adver) ...@@ -1027,18 +1027,11 @@ static bool ext_link_mode_requested(const unsigned long *adver)
return bitmap_intersects(modes, adver, __ETHTOOL_LINK_MODE_MASK_NBITS); return bitmap_intersects(modes, adver, __ETHTOOL_LINK_MODE_MASK_NBITS);
} }
static bool ext_speed_requested(u32 speed) static bool ext_requested(u8 autoneg, const unsigned long *adver, bool ext_supported)
{
#define MLX5E_MAX_PTYS_LEGACY_SPEED 100000
return !!(speed > MLX5E_MAX_PTYS_LEGACY_SPEED);
}
static bool ext_requested(u8 autoneg, const unsigned long *adver, u32 speed)
{ {
bool ext_link_mode = ext_link_mode_requested(adver); bool ext_link_mode = ext_link_mode_requested(adver);
bool ext_speed = ext_speed_requested(speed);
return autoneg == AUTONEG_ENABLE ? ext_link_mode : ext_speed; return autoneg == AUTONEG_ENABLE ? ext_link_mode : ext_supported;
} }
int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
...@@ -1065,8 +1058,8 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, ...@@ -1065,8 +1058,8 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
autoneg = link_ksettings->base.autoneg; autoneg = link_ksettings->base.autoneg;
speed = link_ksettings->base.speed; speed = link_ksettings->base.speed;
ext = ext_requested(autoneg, adver, speed),
ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
ext = ext_requested(autoneg, adver, ext_supported);
if (!ext_supported && ext) if (!ext_supported && ext)
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment