> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf
> Of Stanislav Fomichev
> Sent: Wednesday, March 18, 2026 4:03 PM
> To: [email protected]
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; Nguyen, Anthony
> L <[email protected]>; Kitszel, Przemyslaw
> <[email protected]>; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]; Keller,
> Jacob E <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]
> 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 <[email protected]>
> ---
>  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 <[email protected]>

Reply via email to