Skip to content

Commit 2496057

Browse files
Eran Ben ElishaSaeed Mahameed
authored andcommitted
net/mlx5e: Do not use non-EXT link modes in EXT mode
On some old Firmwares, connector type value was not supported, and value read from FW was 0. For those, driver used link mode in order to set connector type in link_ksetting. After FW exposed the connector type, driver translated the value to ethtool definitions. However, as 0 is a valid value, before returning PORT_OTHER, driver run the check of link mode in order to maintain backward compatibility. Cited patch added support to EXT mode. With both features (connector type and EXT link modes) ,if connector_type read from FW is 0 and EXT mode is set, driver mistakenly compare EXT link modes to non-EXT link mode. Fixed that by skipping this comparison if we are in EXT mode, as connector type value is valid in this scenario. Fixes: 6a89737 ("net/mlx5: ethtool, Add ethtool support for 50Gbps per lane link modes") Signed-off-by: Eran Ben Elisha <[email protected]> Reviewed-by: Aya Levin <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 7510212 commit 2496057

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,9 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev,
708708

709709
static void ptys2ethtool_supported_advertised_port(struct ethtool_link_ksettings *link_ksettings,
710710
u32 eth_proto_cap,
711-
u8 connector_type)
711+
u8 connector_type, bool ext)
712712
{
713-
if (!connector_type || connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER) {
713+
if ((!connector_type && !ext) || connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER) {
714714
if (eth_proto_cap & (MLX5E_PROT_MASK(MLX5E_10GBASE_CR)
715715
| MLX5E_PROT_MASK(MLX5E_10GBASE_SR)
716716
| MLX5E_PROT_MASK(MLX5E_40GBASE_CR4)
@@ -842,9 +842,9 @@ static int ptys2connector_type[MLX5E_CONNECTOR_TYPE_NUMBER] = {
842842
[MLX5E_PORT_OTHER] = PORT_OTHER,
843843
};
844844

845-
static u8 get_connector_port(u32 eth_proto, u8 connector_type)
845+
static u8 get_connector_port(u32 eth_proto, u8 connector_type, bool ext)
846846
{
847-
if (connector_type && connector_type < MLX5E_CONNECTOR_TYPE_NUMBER)
847+
if ((connector_type || ext) && connector_type < MLX5E_CONNECTOR_TYPE_NUMBER)
848848
return ptys2connector_type[connector_type];
849849

850850
if (eth_proto &
@@ -945,9 +945,9 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
945945
eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap;
946946

947947
link_ksettings->base.port = get_connector_port(eth_proto_oper,
948-
connector_type);
948+
connector_type, ext);
949949
ptys2ethtool_supported_advertised_port(link_ksettings, eth_proto_admin,
950-
connector_type);
950+
connector_type, ext);
951951
get_lp_advertising(mdev, eth_proto_lp, link_ksettings);
952952

953953
if (an_status == MLX5_AN_COMPLETE)

0 commit comments

Comments
 (0)