> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf
> Of I Viswanath
> Sent: Saturday, March 14, 2026 7:28 PM
> To: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; Kitszel, Przemyslaw
> <[email protected]>; Nguyen, Anthony L
> <[email protected]>; Keller, Jacob E
> <[email protected]>; [email protected];
> [email protected]
> Cc: [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; I Viswanath
> <[email protected]>
> 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 <[email protected]>
> Signed-off-by: I Viswanath <[email protected]>
> ---
>  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 <[email protected]>

Reply via email to