acrn-kernel/net/ethtool
Andy Roulin e847c7675e ethtool: reset #lanes when lanes is omitted
If the number of lanes was forced and then subsequently the user
omits this parameter, the ksettings->lanes is reset. The driver
should then reset the number of lanes to the device's default
for the specified speed.

However, although the ksettings->lanes is set to 0, the mod variable
is not set to true to indicate the driver and userspace should be
notified of the changes.

The consequence is that the same ethtool operation will produce
different results based on the initial state.

If the initial state is:
$ ethtool swp1 | grep -A 3 'Speed: '
        Speed: 500000Mb/s
        Lanes: 2
        Duplex: Full
        Auto-negotiation: on

then executing 'ethtool -s swp1 speed 50000 autoneg off' will yield:
$ ethtool swp1 | grep -A 3 'Speed: '
        Speed: 500000Mb/s
        Lanes: 2
        Duplex: Full
        Auto-negotiation: off

While if the initial state is:
$ ethtool swp1 | grep -A 3 'Speed: '
        Speed: 500000Mb/s
        Lanes: 1
        Duplex: Full
        Auto-negotiation: off

executing the same 'ethtool -s swp1 speed 50000 autoneg off' results in:
$ ethtool swp1 | grep -A 3 'Speed: '
        Speed: 500000Mb/s
        Lanes: 1
        Duplex: Full
        Auto-negotiation: off

This patch fixes this behavior. Omitting lanes will always results in
the driver choosing the default lane width for the chosen speed. In this
scenario, regardless of the initial state, the end state will be, e.g.,

$ ethtool swp1 | grep -A 3 'Speed: '
        Speed: 500000Mb/s
        Lanes: 2
        Duplex: Full
        Auto-negotiation: off

Fixes: 012ce4dd31 ("ethtool: Extend link modes settings uAPI with lanes")
Signed-off-by: Andy Roulin <aroulin@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/ac238d6b-8726-8156-3810-6471291dbc7f@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-04-04 18:57:10 -07:00
..
Makefile
bitset.c
bitset.h
cabletest.c
channels.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
coalesce.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
common.c
common.h
debug.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
eee.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
eeprom.c
features.c
fec.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
ioctl.c
linkinfo.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
linkmodes.c ethtool: reset #lanes when lanes is omitted 2023-04-04 18:57:10 -07:00
linkstate.c
mm.c net: ethtool: fix __ethtool_dev_mm_supported() implementation 2023-02-21 09:05:01 -08:00
module.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
netlink.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
netlink.h net: ethtool: extend ringparam set/get APIs for rx_push 2023-02-13 11:05:12 +00:00
pause.c ethtool: netlink: handle SET intro/outro in the common code 2023-01-27 12:24:31 +00:00
phc_vclocks.c
plca.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
privflags.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00
pse-pd.c ethtool: pse-pd: Fix double word in comments 2023-02-21 09:02:13 -08:00
rings.c net: ethtool: extend ringparam set/get APIs for rx_push 2023-02-13 11:05:12 +00:00
rss.c
stats.c net: ethtool: fix NULL pointer dereference in stats_prepare_data() 2023-01-25 09:56:31 +00:00
strset.c
tsinfo.c
tunnels.c
wol.c ethtool: netlink: convert commands to common SET 2023-01-27 12:24:32 +00:00