Add a receive-mode scheduling helper for callers which start a new update after a state transition. Cancel a pending retry and reset its backoff before queueing the immediate update so the preceding operation's retry state cannot shorten the new operation's bounded retry sequence. The helper preserves address-list synchronization state. Callers which need to replay configuration lost by the device must unsynchronize the affected address lists before scheduling the update. Assisted-by: LLM Signed-off-by: Satish Kharat --- include/linux/netdevice.h | 1 + net/core/dev_addr_lists.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 0325c6f2a7d1..4ff3523f9474 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -5232,6 +5232,7 @@ static inline void __dev_mc_unsync(struct net_device *dev, /* Functions used for secondary unicast and multicast support */ void dev_set_rx_mode(struct net_device *dev); +void netif_rx_mode_schedule_update(struct net_device *dev); void netif_rx_mode_schedule_retry(struct net_device *dev); int netif_set_promiscuity(struct net_device *dev, int inc); int dev_set_promiscuity(struct net_device *dev, int inc); diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index b6f25e487984..89ae77360a0b 100644 --- a/net/core/dev_addr_lists.c +++ b/net/core/dev_addr_lists.c @@ -1568,6 +1568,27 @@ static void netif_rx_mode_queue(struct net_device *dev) __netdev_work_core_sched(dev, NETDEV_WORK_RX_MODE); } +/** + * netif_rx_mode_schedule_update() - schedule a new receive-mode update + * @dev: network device + * + * Cancel any pending retry and reset its backoff before scheduling an + * immediate receive-mode update. This does not reset address-list + * synchronization state. Callers which need to replay lost device state must + * unsynchronize the affected address lists before scheduling the update. + * + * Context: sleepable. The caller must hold the device operations lock, or + * RTNL for a device which still uses RTNL-compatible operations. + */ +void netif_rx_mode_schedule_update(struct net_device *dev) +{ + might_sleep(); + netdev_assert_locked_ops_compat(dev); + netif_rx_mode_cancel_retry(dev); + netif_rx_mode_queue(dev); +} +EXPORT_SYMBOL_GPL(netif_rx_mode_schedule_update); + static void netif_rx_mode_retry(struct timer_list *t) { struct net_device *dev = -- 2.43.0