mlxsw: Only advertise link modes supported by both driver and device
authorAmit Cohen <amcohen@nvidia.com>
Sat, 24 Oct 2020 13:37:31 +0000 (16:37 +0300)
committerJakub Kicinski <kuba@kernel.org>
Mon, 26 Oct 2020 23:45:50 +0000 (16:45 -0700)
commit1601559be3e4213148b4cb4a1abe672b00bf4f67
treefd2bc5c86344f330562ae2f9ed33c5b9696e03ef
parent522ee51e677112e2baf135b26c1a03a77a7b4454
mlxsw: Only advertise link modes supported by both driver and device

During port creation the driver instructs the device to advertise all
the supported link modes queried from the device.

Since cited commit not all the link modes supported by the device are
supported by the driver. This can result in the device negotiating a
link mode that is not recognized by the driver causing ethtool to show
an unsupported speed:

$ ethtool swp1
...
Speed: Unknown!

This is especially problematic when the netdev is enslaved to a bond, as
the bond driver uses unknown speed as an indication that the link is
down:

[13048.900895] net_ratelimit: 86 callbacks suppressed
[13048.900902] t_bond0: (slave swp52): failed to get link speed/duplex
[13048.912160] t_bond0: (slave swp49): failed to get link speed/duplex

Fix this by making sure that only link modes that are supported by both
the device and the driver are advertised.

Fixes: b97cd891268d ("mlxsw: Remove 56G speed support")
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c