WSL2-Linux-Kernel/net/ethtool
Jakub Kicinski 00d0f31a1e net: ethtool: coalesce: try to make user settings stick twice
SET_COALESCE may change operation mode and parameters in one call.
Changing operation mode may cause the driver to reset the parameter
values to what is a reasonable default for new operation mode.

Since driver does not know which parameters come from user and which
are echoed back from ->get, driver may ignore the parameters when
switching operation modes.

This used to be inevitable for ioctl() but in netlink we know which
parameters are actually specified by the user.

We could inform which parameters were set by the user but this would
lead to a lot of code duplication in the drivers. Instead try to call
the drivers twice if both mode and params are changed. The set method
already checks if any params need updating so in case the driver did
the right thing the first time around - there will be no second call
to it's ->set method (only an extra call to ->get()).

For mlx5 for example before this patch we'd see:

 # ethtool -C eth0 adaptive-rx on  adaptive-tx on
 # ethtool -C eth0 adaptive-rx off adaptive-tx off \
		   tx-usecs 123 rx-usecs 123
 Adaptive RX: off  TX: off
 rx-usecs: 3
 rx-frames: 32
 tx-usecs: 16
 tx-frames: 32
 [...]

After the change:

 # ethtool -C eth0 adaptive-rx on  adaptive-tx on
 # ethtool -C eth0 adaptive-rx off adaptive-tx off \
		   tx-usecs 123 rx-usecs 123
 Adaptive RX: off  TX: off
 rx-usecs: 123
 rx-frames: 32
 tx-usecs: 123
 tx-frames: 32
 [...]

This only works for netlink, so it's a small discrepancy between
netlink and ioctl(). Since we anticipate most users to move to
netlink I believe it's worth making their lives easier.

Link: https://lore.kernel.org/r/20230420233302.944382-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-04-24 18:09:49 -07:00
..
Makefile
bitset.c
bitset.h
cabletest.c
channels.c
coalesce.c net: ethtool: coalesce: try to make user settings stick twice 2023-04-24 18:09:49 -07:00
common.c
common.h
debug.c
eee.c
eeprom.c
features.c
fec.c
ioctl.c
linkinfo.c
linkmodes.c ethtool: reset #lanes when lanes is omitted 2023-04-04 18:57:10 -07:00
linkstate.c
mm.c net: ethtool: mm: sanitize some UAPI configurations 2023-04-20 20:03:21 -07:00
module.c
netlink.c
netlink.h
pause.c
phc_vclocks.c
plca.c
privflags.c
pse-pd.c
rings.c
rss.c
stats.c
strset.c
tsinfo.c
tunnels.c
wol.c