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

From: Loktionov, Aleksandr

Date: Mon Mar 16 2026 - 03:29:50 EST




> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf
> Of I Viswanath
> Sent: Saturday, March 14, 2026 7:28 PM
> To: stfomichev@xxxxxxxxx; horms@xxxxxxxxxx; edumazet@xxxxxxxxxx;
> pabeni@xxxxxxxxxx; andrew+netdev@xxxxxxx; kuba@xxxxxxxxxx;
> davem@xxxxxxxxxxxxx; eperezma@xxxxxxxxxx; xuanzhuo@xxxxxxxxxxxxxxxxx;
> jasowang@xxxxxxxxxx; mst@xxxxxxxxxx; Kitszel, Przemyslaw
> <przemyslaw.kitszel@xxxxxxxxx>; Nguyen, Anthony L
> <anthony.l.nguyen@xxxxxxxxx>; Keller, Jacob E
> <jacob.e.keller@xxxxxxxxx>; ronak.doshi@xxxxxxxxxxxx;
> pcnet32@xxxxxxxxxxxx
> Cc: bcm-kernel-feedback-list@xxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx;
> virtualization@xxxxxxxxxxxxxxx; intel-wired-lan@xxxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; I Viswanath
> <viswanathiyyappan@xxxxxxxxx>
> 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@xxxxxxxxxx>
> Signed-off-by: I Viswanath <viswanathiyyappan@xxxxxxxxx>
> ---
> 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 <aleksandr.loktionov@xxxxxxxxx>