RE: [Intel-wired-lan] [PATCH net-next v2 01/13] net: add address list snapshot and reconciliation infrastructure

From: Loktionov, Aleksandr

Date: Wed Mar 18 2026 - 11:46:43 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 01/13] net: add address
> list snapshot and reconciliation infrastructure
>
> Introduce __hw_addr_list_snapshot() and __hw_addr_list_reconcile() for
> use by the upcoming ndo_set_rx_mode_async callback.
>
> The async rx_mode path needs to snapshot the device's unicast and
> multicast address lists under the addr_lock, hand those snapshots to
> the driver (which may sleep), and then propagate any sync_cnt changes
> back to the real lists. Two identical snapshots are taken:
> a work copy for the driver to pass to __hw_addr_sync_dev() and a
> reference copy to compute deltas against.
>
> __hw_addr_list_reconcile() walks the reference snapshot comparing each
> entry against the work snapshot to determine what the driver synced or
> unsynced. It then applies those deltas to the real list, handling
> concurrent modifications:
>
> - If the real entry was concurrently removed but the driver synced
> it to hardware (delta > 0), re-insert a stale entry so the next
> work run properly unsyncs it from hardware.
> - If the entry still exists, apply the delta normally. An entry
> whose refcount drops to zero is removed.
>
> Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxxx>
> ---
> include/linux/netdevice.h | 6 +
> net/core/dev.h | 1 +
> net/core/dev_addr_lists.c | 110 ++++++++++-
> net/core/dev_addr_lists_test.c | 321
> ++++++++++++++++++++++++++++++++-
> 4 files changed, 435 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index ae269a2e7f4d..469b7cdb3237 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -4985,6 +4985,12 @@ void __hw_addr_unsync_dev(struct
> netdev_hw_addr_list *list,
> int (*unsync)(struct net_device *,
> const unsigned char *));
> void __hw_addr_init(struct netdev_hw_addr_list *list);
> +int __hw_addr_list_snapshot(struct netdev_hw_addr_list *snap,
> + const struct netdev_hw_addr_list *list,
> + int addr_len);
> +void __hw_addr_list_reconcile(struct netdev_hw_addr_list *real_list,
> + struct netdev_hw_addr_list *work,
> + struct netdev_hw_addr_list *ref, int
> addr_len);
>
> /* Functions used for device addresses handling */ void
> dev_addr_mod(struct net_device *dev, unsigned int offset, diff --git
> a/net/core/dev.h b/net/core/dev.h index 781619e76b3e..acc925b7b337
> 100644
> --- a/net/core/dev.h
> +++ b/net/core/dev.h
> @@ -69,6 +69,7 @@ void linkwatch_run_queue(void); void
> dev_addr_flush(struct net_device *dev); int dev_addr_init(struct
> net_device *dev); void dev_addr_check(struct net_device *dev);
> +void __hw_addr_flush(struct netdev_hw_addr_list *list);
>
> #if IS_ENABLED(CONFIG_NET_SHAPER)
> void net_shaper_flush_netdev(struct net_device *dev); diff --git
> a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index
> 76c91f224886..754f5ea4c3db 100644
> --- a/net/core/dev_addr_lists.c
> +++ b/net/core/dev_addr_lists.c
> @@ -481,7 +481,7 @@ void __hw_addr_unsync_dev(struct
> netdev_hw_addr_list *list, } EXPORT_SYMBOL(__hw_addr_unsync_dev);
>
> -static void __hw_addr_flush(struct netdev_hw_addr_list *list)
> +void __hw_addr_flush(struct netdev_hw_addr_list *list)
> {
> struct netdev_hw_addr *ha, *tmp;
>
> @@ -501,6 +501,114 @@ void __hw_addr_init(struct netdev_hw_addr_list
> *list) } EXPORT_SYMBOL(__hw_addr_init);
>

...

> {}
> };
>
> --
> 2.53.0

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>