netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: Restore napi threaded state only when it is enabled
@ 2025-07-21 23:36 Samiullah Khawaja
  2025-07-23  1:36 ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Samiullah Khawaja @ 2025-07-21 23:36 UTC (permalink / raw)
  To: Jakub Kicinski, David S . Miller , Eric Dumazet, Paolo Abeni,
	almasrymina, willemb
  Cc: netdev, skhawaja

Commit 2677010e7793 ("Add support to set NAPI threaded for individual
NAPI") added support to enable/disable threaded napi using netlink. This
also extended the napi config save/restore functionality to set the napi
threaded state. This breaks the netdev reset when threaded napi is
enabled at device level as the napi_restore_config tries to stop the
kthreads as napi->config->thread is false when threaded is enabled at
device level.

The napi_restore_config should only restore the napi threaded state when
threaded is enabled at NAPI level.

The issue can be reproduced on virtio-net device using qemu. To
reproduce the issue run following,

  echo 1 > /sys/class/net/threaded
  ethtool -L eth0 combined 1

Fixes: 2677010e7793 ("Add support to set NAPI threaded for individual NAPI")
Signed-off-by: Samiullah Khawaja <skhawaja@google.com>

---
 net/core/dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 621a639aeba1..1cab04b8f60a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7244,7 +7244,8 @@ static void napi_restore_config(struct napi_struct *n)
 		n->config->napi_id = n->napi_id;
 	}
 
-	WARN_ON_ONCE(napi_set_threaded(n, n->config->threaded));
+	if (n->config->threaded)
+		WARN_ON_ONCE(napi_set_threaded(n, n->config->threaded));
 }
 
 static void napi_save_config(struct napi_struct *n)

base-commit: c3886ccaadf8fdc2c91bfbdcdca36ccdc6ef8f70
-- 
2.50.0.727.gbf7dc18ff4-goog


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

end of thread, other threads:[~2025-07-29 19:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21 23:36 [PATCH net-next] net: Restore napi threaded state only when it is enabled Samiullah Khawaja
2025-07-23  1:36 ` Jakub Kicinski
2025-07-23  2:36   ` Samiullah Khawaja
2025-07-23 14:56     ` Jakub Kicinski
2025-07-29 19:30       ` Samiullah Khawaja

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).