netlink: settings: Enable link modes advertisement according to lanes
When user space does not pass link modes to advertise (via
'ETHTOOL_A_LINKMODES_OURS'), but enables auto-negotiation (via
'ETHTOOL_A_LINKMODES_AUTONEG'), the kernel will instruct the underlying
device driver to advertise link modes according to passed speed (via
'ETHTOOL_A_LINKMODES_SPEED'), duplex (via 'ETHTOOL_A_LINKMODES_DUPLEX')
or lanes (via 'ETHTOOL_A_LINKMODES_LANES').
It is not currently possible to have ethtool instruct the kernel to
perform advertisement solely based on lanes, as ethtool incorrectly
instructs the kernel to simply advertise all the "real" link modes [1].
This is caused by ethtool treating both of these commands as equivalent:
# ethtool -s swp1 autoneg on
# ethtool -s swp1 autoneg on lanes 1
Address this by having ethtool recognize that it should not advertise
all the "real" link modes when only "lanes" parameter is specified.
Before:
# ethtool -s swp1 autoneg on lanes 1
# ethtool swp1
[...]
Advertised link modes: 1000baseT/Full
10000baseT/Full
1000baseKX/Full
10000baseKR/Full
10000baseR_FEC
40000baseKR4/Full
40000baseCR4/Full
40000baseSR4/Full
40000baseLR4/Full
25000baseCR/Full
25000baseKR/Full
25000baseSR/Full
50000baseCR2/Full
50000baseKR2/Full
100000baseKR4/Full
100000baseSR4/Full
100000baseCR4/Full
100000baseLR4_ER4/Full
[...]
After:
# ethtool -s swp1 autoneg on lanes 1
# ethtool swp1
[...]
Advertised link modes: 1000baseT/Full
10000baseT/Full
1000baseKX/Full
10000baseKR/Full
10000baseR_FEC
25000baseCR/Full
25000baseKR/Full
25000baseSR/Full
10000baseCR/Full
10000baseSR/Full
10000baseLR/Full
10000baseER/Full
50000baseKR/Full
50000baseSR/Full
50000baseCR/Full
50000baseLR_ER_FR/Full
50000baseDR/Full
[1]
# ethtool --debug 0xff -s swp1 autoneg on lanes 1
[...]
sending genetlink packet (96 bytes):
msg length 96 ethool ETHTOOL_MSG_LINKMODES_SET
ETHTOOL_MSG_LINKMODES_SET
ETHTOOL_A_LINKMODES_HEADER
ETHTOOL_A_HEADER_DEV_NAME = "swp1"
ETHTOOL_A_LINKMODES_AUTONEG = on
ETHTOOL_A_LINKMODES_LANES = 1
ETHTOOL_A_LINKMODES_OURS
ETHTOOL_A_BITSET_SIZE = 93
ETHTOOL_A_BITSET_VALUE = 20:10:9a:87 ff:5d:f0:ff e7:03:00:00
ETHTOOL_A_BITSET_MASK = 20:10:9a:87 ff:5d:f0:ff e7:03:00:00
[...]
Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
Tested-by: Maksym Yaremchuk <maksymy@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
1 file changed