Thread (18 messages) 18 messages, 3 authors, 2026-03-17

RE: [Intel-wired-lan] [PATCH net-next v9 2/7] net: core: Introduce callback ndo_set_rx_mode_async

From: Loktionov, Aleksandr <hidden>
Date: 2026-03-16 07:29:37
Also in: intel-wired-lan, lkml, virtualization

quoted hunk ↗ jump to hunk
-----Original Message-----
From: Intel-wired-lan <redacted> On Behalf
Of I Viswanath
Sent: Saturday, March 14, 2026 7:28 PM
To: stfomichev@gmail.com; horms@kernel.org; edumazet@google.com;
pabeni@redhat.com; andrew+netdev@lunn.ch; kuba@kernel.org;
davem@davemloft.net; eperezma@redhat.com; xuanzhuo@linux.alibaba.com;
jasowang@redhat.com; mst@redhat.com; Kitszel, Przemyslaw
[off-list ref]; Nguyen, Anthony L
[off-list ref]; Keller, Jacob E
[off-list ref]; ronak.doshi@broadcom.com;
pcnet32@frontier.com
Cc: bcm-kernel-feedback-list@broadcom.com; netdev@vger.kernel.org;
virtualization@lists.linux.dev; intel-wired-lan@lists.osuosl.org;
linux-kernel@vger.kernel.org; I Viswanath
[off-list ref]
Subject: [Intel-wired-lan] [PATCH net-next v9 2/7] net: core:
Introduce callback ndo_set_rx_mode_async

The set_rx_mode callback is invoked under the addr_lock spinlock which
makes it illegal to sleep. This means set_rx_mode is prone to sleep-
in-atomic bugs as drivers have a tendency to do the I/O directly in
the callback.

This problem can be avoided if set_rx_mode were done in 2 stages:
snapshot and commit. A handful of drivers implement this idea by
implementing the rx_mode update as work and scheduling it in the
set_rx_mode callback.

Implement this idea in net/core as this is not driver specific. To
facilitate this transition, a new async callback set_rx_mode_async is
introduced.

When this callback is provided, the set_rx_mode callback customizes
the snapshot creation and the work behaviour as required while the
set_rx_mode_async callback is run async as work and commits the
prepared snapshot.

Apart from this, the drivers need to be updated to have all the RX
mode updates pass through the netif_set_rx_mode helper to ensure
correctness.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: I Viswanath <redacted>
---
 include/linux/netdevice.h |  94 +++++++++++++-
 include/net/netdev_lock.h |   8 ++
 net/core/dev.c            | 251
+++++++++++++++++++++++++++++++++++++-
 3 files changed, 347 insertions(+), 6 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6d426dc66af9..a69377068f4a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1068,7 +1068,36 @@ enum netif_async_state {
 	NETIF_ASYNC_INACTIVE
 };
...
--
2.47.3
Reviewed-by: Aleksandr Loktionov <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help