Skip to content

Commit 875d7c1

Browse files
Shahar Shitritkuba-moo
authored andcommitted
net/mlx5e: Fix number of lanes to UNKNOWN when using data_rate_oper
When the link is up, either eth_proto_oper or ext_eth_proto_oper typically reports the active link protocol, from which both speed and number of lanes can be retrieved. However, in certain cases, such as when a NIC is connected via a non-standard cable, the firmware may not report the protocol. In such scenarios, the speed can still be obtained from the data_rate_oper field in PTYS register. Since data_rate_oper provides only speed information and lacks lane details, it is incorrect to derive the number of lanes from it. This patch corrects the behavior by setting the number of lanes to UNKNOWN instead of incorrectly using MAX_LANES when relying on data_rate_oper. Fixes: 7e95979 ("net/mlx5e: Enable lanes configuration when auto-negotiation is off") Signed-off-by: Shahar Shitrit <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Mark Bloch <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent aa9c44b commit 875d7c1

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include "en/fs_ethtool.h"
4444

4545
#define LANES_UNKNOWN 0
46-
#define MAX_LANES 8
4746

4847
void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv,
4948
struct ethtool_drvinfo *drvinfo)
@@ -1098,10 +1097,8 @@ static void get_link_properties(struct net_device *netdev,
10981097
speed = info->speed;
10991098
lanes = info->lanes;
11001099
duplex = DUPLEX_FULL;
1101-
} else if (data_rate_oper) {
1100+
} else if (data_rate_oper)
11021101
speed = 100 * data_rate_oper;
1103-
lanes = MAX_LANES;
1104-
}
11051102

11061103
out:
11071104
link_ksettings->base.duplex = duplex;

0 commit comments

Comments
 (0)