All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] netdevsim: don't overwrite read only ethtool parms
@ 2021-12-10 17:50 Filip Pokryvka
  2021-12-11  5:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Filip Pokryvka @ 2021-12-10 17:50 UTC (permalink / raw)
  To: netdev
  Cc: Jakub Kicinski, David S . Miller, Antonio Cardace,
	Michal Kubecek, Filip Pokryvka

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>
---
 drivers/net/netdevsim/ethtool.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/netdevsim/ethtool.c b/drivers/net/netdevsim/ethtool.c
index b03a0513e..2e7c1cc16 100644
--- a/drivers/net/netdevsim/ethtool.c
+++ b/drivers/net/netdevsim/ethtool.c
@@ -77,7 +77,10 @@ static int nsim_set_ringparam(struct net_device *dev,
 {
 	struct netdevsim *ns = netdev_priv(dev);
 
-	memcpy(&ns->ethtool.ring, ring, sizeof(ns->ethtool.ring));
+	ns->ethtool.ring.rx_pending = ring->rx_pending;
+	ns->ethtool.ring.rx_jumbo_pending = ring->rx_jumbo_pending;
+	ns->ethtool.ring.rx_mini_pending = ring->rx_mini_pending;
+	ns->ethtool.ring.tx_pending = ring->tx_pending;
 	return 0;
 }
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] netdevsim: don't overwrite read only ethtool parms
  2021-12-10 17:50 [PATCH net] netdevsim: don't overwrite read only ethtool parms Filip Pokryvka
@ 2021-12-11  5:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-11  5:30 UTC (permalink / raw)
  To: Filip Pokryvka; +Cc: netdev, kuba, davem, acardace, mkubecek

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 10 Dec 2021 18:50:32 +0100 you wrote:
> 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).
> 
> [...]

Here is the summary with links:
  - [net] netdevsim: don't overwrite read only ethtool parms
    https://git.kernel.org/netdev/net/c/ee60e626d536

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-11  5:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 17:50 [PATCH net] netdevsim: don't overwrite read only ethtool parms Filip Pokryvka
2021-12-11  5:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.