Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netdevsim: don't overwrite read only ethtool parms

Ethtool ring feature has _max_pending attributes read-only.
Set only read-write attributes in nsim_set_ringparam.

This patch is useful, if netdevsim device is set-up using NetworkManager,
because NetworkManager sends 0 as MAX values, as it is pointless to
retrieve them in extra call, because they should be read-only. Then,
the device is left in incosistent state (value > MAX).

Fixes: a7fc6db099b5 ("netdevsim: support ethtool ring and coalesce settings")
Signed-off-by: Filip Pokryvka <fpokryvk@redhat.com>
Link: https://lore.kernel.org/r/20211210175032.411872-1-fpokryvk@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Filip Pokryvka and committed by
Jakub Kicinski
ee60e626 94f2a444

+4 -1
+4 -1
drivers/net/netdevsim/ethtool.c
··· 77 77 { 78 78 struct netdevsim *ns = netdev_priv(dev); 79 79 80 - memcpy(&ns->ethtool.ring, ring, sizeof(ns->ethtool.ring)); 80 + ns->ethtool.ring.rx_pending = ring->rx_pending; 81 + ns->ethtool.ring.rx_jumbo_pending = ring->rx_jumbo_pending; 82 + ns->ethtool.ring.rx_mini_pending = ring->rx_mini_pending; 83 + ns->ethtool.ring.tx_pending = ring->tx_pending; 81 84 return 0; 82 85 } 83 86