RE: [Intel-wired-lan] [PATCH net-next v2 03/13] net: introduce ndo_set_rx_mode_async and dev_rx_mode_work
From: Loktionov, Aleksandr
Date: Wed Mar 18 2026 - 11:55:02 EST
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf
> Of Stanislav Fomichev
> Sent: Wednesday, March 18, 2026 4:03 PM
> To: netdev@xxxxxxxxxxxxxxx
> Cc: davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx; kuba@xxxxxxxxxx;
> pabeni@xxxxxxxxxx; horms@xxxxxxxxxx; corbet@xxxxxxx;
> skhan@xxxxxxxxxxxxxxxxxxx; andrew+netdev@xxxxxxx;
> michael.chan@xxxxxxxxxxxx; pavan.chebbi@xxxxxxxxxxxx; Nguyen, Anthony
> L <anthony.l.nguyen@xxxxxxxxx>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@xxxxxxxxx>; saeedm@xxxxxxxxxx; tariqt@xxxxxxxxxx;
> mbloch@xxxxxxxxxx; alexanderduyck@xxxxxx; kernel-team@xxxxxxxx;
> johannes@xxxxxxxxxxxxxxxx; sd@xxxxxxxxxxxxxxx; jianbol@xxxxxxxxxx;
> dtatulea@xxxxxxxxxx; sdf@xxxxxxxxxxx; mohsin.bashr@xxxxxxxxx; Keller,
> Jacob E <jacob.e.keller@xxxxxxxxx>; willemb@xxxxxxxxxx;
> skhawaja@xxxxxxxxxx; bestswngs@xxxxxxxxx; linux-doc@xxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; intel-wired-lan@xxxxxxxxxxxxxxxx; linux-
> rdma@xxxxxxxxxxxxxxx; linux-wireless@xxxxxxxxxxxxxxx; linux-
> kselftest@xxxxxxxxxxxxxxx; leon@xxxxxxxxxx
> Subject: [Intel-wired-lan] [PATCH net-next v2 03/13] net: introduce
> ndo_set_rx_mode_async and dev_rx_mode_work
>
> Add ndo_set_rx_mode_async callback that drivers can implement instead
> of the legacy ndo_set_rx_mode. The legacy callback runs under the
> netif_addr_lock spinlock with BHs disabled, preventing drivers from
> sleeping. The async variant runs from a work queue with rtnl_lock and
> netdev_lock_ops held, in fully sleepable context.
>
> When __dev_set_rx_mode() sees ndo_set_rx_mode_async, it schedules
> dev_rx_mode_work instead of calling the driver inline. The work
> function takes two snapshots of each address list (uc/mc) under the
> addr_lock, then drops the lock and calls the driver with the work
> copies. After the driver returns, it reconciles the snapshots back to
> the real lists under the lock.
>
> Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxxx>
> ---
> Documentation/networking/netdevices.rst | 8 +++
> include/linux/netdevice.h | 20 ++++++
> net/core/dev.c | 94 +++++++++++++++++++++++-
> -
> 3 files changed, 115 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/networking/netdevices.rst
> b/Documentation/networking/netdevices.rst
> index 35704d115312..dc83d78d3b27 100644
> --- a/Documentation/networking/netdevices.rst
> +++ b/Documentation/networking/netdevices.rst
> @@ -289,6 +289,14 @@ struct net_device synchronization rules
> ndo_set_rx_mode:
> Synchronization: netif_addr_lock spinlock.
> Context: BHs disabled
...
> open_softirq(NET_TX_SOFTIRQ, net_tx_action);
> open_softirq(NET_RX_SOFTIRQ, net_rx_action);
>
> --
> 2.53.0
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>