net/mlx5e: Fix 50G per lane indication
Some released FW versions mistakenly don't set the capability that 50G
per lane link-modes are supported for VFs (ptys_extended_ethernet
capability bit). When the capability is unset, read
PTYS.ext_eth_proto_capability (always reliable).
If PTYS.ext_eth_proto_capability is valid (has a non-zero value)
conclude that the HCA supports 50G per lane. Otherwise, conclude that
the HCA doesn't support 50G per lane.
Fixes: a08b4ed137
("net/mlx5: Add support to ext_* fields introduced in Port Type and Speed register")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
Родитель
f4aebbfb56
Коммит
6a1cf4e443
|
@ -78,11 +78,26 @@ static const u32 mlx5e_ext_link_speed[MLX5E_EXT_LINK_MODES_NUMBER] = {
|
|||
[MLX5E_400GAUI_8] = 400000,
|
||||
};
|
||||
|
||||
bool mlx5e_ptys_ext_supported(struct mlx5_core_dev *mdev)
|
||||
{
|
||||
struct mlx5e_port_eth_proto eproto;
|
||||
int err;
|
||||
|
||||
if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet))
|
||||
return true;
|
||||
|
||||
err = mlx5_port_query_eth_proto(mdev, 1, true, &eproto);
|
||||
if (err)
|
||||
return false;
|
||||
|
||||
return !!eproto.cap;
|
||||
}
|
||||
|
||||
static void mlx5e_port_get_speed_arr(struct mlx5_core_dev *mdev,
|
||||
const u32 **arr, u32 *size,
|
||||
bool force_legacy)
|
||||
{
|
||||
bool ext = force_legacy ? false : MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
|
||||
bool ext = force_legacy ? false : mlx5e_ptys_ext_supported(mdev);
|
||||
|
||||
*size = ext ? ARRAY_SIZE(mlx5e_ext_link_speed) :
|
||||
ARRAY_SIZE(mlx5e_link_speed);
|
||||
|
@ -177,7 +192,7 @@ int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed)
|
|||
bool ext;
|
||||
int err;
|
||||
|
||||
ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
|
||||
ext = mlx5e_ptys_ext_supported(mdev);
|
||||
err = mlx5_port_query_eth_proto(mdev, 1, ext, &eproto);
|
||||
if (err)
|
||||
goto out;
|
||||
|
@ -205,7 +220,7 @@ int mlx5e_port_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed)
|
|||
int err;
|
||||
int i;
|
||||
|
||||
ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
|
||||
ext = mlx5e_ptys_ext_supported(mdev);
|
||||
err = mlx5_port_query_eth_proto(mdev, 1, ext, &eproto);
|
||||
if (err)
|
||||
return err;
|
||||
|
|
|
@ -54,7 +54,7 @@ int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed);
|
|||
int mlx5e_port_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed);
|
||||
u32 mlx5e_port_speed2linkmodes(struct mlx5_core_dev *mdev, u32 speed,
|
||||
bool force_legacy);
|
||||
|
||||
bool mlx5e_ptys_ext_supported(struct mlx5_core_dev *mdev);
|
||||
int mlx5e_port_query_pbmc(struct mlx5_core_dev *mdev, void *out);
|
||||
int mlx5e_port_set_pbmc(struct mlx5_core_dev *mdev, void *in);
|
||||
int mlx5e_port_query_priority2buffer(struct mlx5_core_dev *mdev, u8 *buffer);
|
||||
|
|
|
@ -200,7 +200,7 @@ static void mlx5e_ethtool_get_speed_arr(struct mlx5_core_dev *mdev,
|
|||
struct ptys2ethtool_config **arr,
|
||||
u32 *size)
|
||||
{
|
||||
bool ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
|
||||
bool ext = mlx5e_ptys_ext_supported(mdev);
|
||||
|
||||
*arr = ext ? ptys2ext_ethtool_table : ptys2legacy_ethtool_table;
|
||||
*size = ext ? ARRAY_SIZE(ptys2ext_ethtool_table) :
|
||||
|
@ -883,7 +883,7 @@ static void get_lp_advertising(struct mlx5_core_dev *mdev, u32 eth_proto_lp,
|
|||
struct ethtool_link_ksettings *link_ksettings)
|
||||
{
|
||||
unsigned long *lp_advertising = link_ksettings->link_modes.lp_advertising;
|
||||
bool ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
|
||||
bool ext = mlx5e_ptys_ext_supported(mdev);
|
||||
|
||||
ptys2ethtool_adver_link(lp_advertising, eth_proto_lp, ext);
|
||||
}
|
||||
|
@ -913,7 +913,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
|
|||
__func__, err);
|
||||
goto err_query_regs;
|
||||
}
|
||||
ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
|
||||
ext = !!MLX5_GET_ETH_PROTO(ptys_reg, out, true, eth_proto_capability);
|
||||
eth_proto_cap = MLX5_GET_ETH_PROTO(ptys_reg, out, ext,
|
||||
eth_proto_capability);
|
||||
eth_proto_admin = MLX5_GET_ETH_PROTO(ptys_reg, out, ext,
|
||||
|
@ -1066,7 +1066,7 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
|
|||
autoneg = link_ksettings->base.autoneg;
|
||||
speed = link_ksettings->base.speed;
|
||||
|
||||
ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
|
||||
ext_supported = mlx5e_ptys_ext_supported(mdev);
|
||||
ext = ext_requested(autoneg, adver, ext_supported);
|
||||
if (!ext_supported && ext)
|
||||
return -EOPNOTSUPP;
|
||||
|
|
Загрузка…
Ссылка в новой задаче