Re: [Intel-wired-lan] [PATCH net-next v3 12/13] net: warn ops-locked drivers still using ndo_set_rx_mode

Loktionov, Aleksandr
2026-03-20T07:55:31Z

> -----Original Message-----
> From: Stanislav Fomichev <sdf@fomichev.me>
> Sent: Friday, March 20, 2026 2:25 AM
> To: netdev@vger.kernel.org
> Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; horms@kernel.org; corbet@lwn.net;
> skhan@linuxfoundation.org; andrew+netdev@lunn.ch;
> michael.chan@broadcom.com; pavan.chebbi@broadcom.com; Nguyen, Anthony
> L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; saeedm@nvidia.com; tariqt@nvidia.com;
> mbloch@nvidia.com; alexanderduyck@fb.com; kernel-team@meta.com;
> johannes@sipsolutions.net; sd@queasysnail.net; jianbol@nvidia.com;
> dtatulea@nvidia.com; sdf@fomichev.me; mohsin.bashr@gmail.com; Keller,
> Jacob E <jacob.e.keller@intel.com>; willemb@google.com;
> skhawaja@google.com; bestswngs@gmail.com; Loktionov, Aleksandr
> <aleksandr.loktionov@intel.com>; kees@kernel.org; linux-
> doc@vger.kernel.org; linux-kernel@vger.kernel.org; intel-wired-
> lan@lists.osuosl.org; linux-rdma@vger.kernel.org; linux-
> wireless@vger.kernel.org; linux-kselftest@vger.kernel.org;
> leon@kernel.org
> Subject: [PATCH net-next v3 12/13] net: warn ops-locked drivers still
> using ndo_set_rx_mode
>
> Now that all in-tree ops-locked drivers have been converted to
> ndo_set_rx_mode_async, add a warning in register_netdevice to catch
> any remaining or newly added drivers that use ndo_set_rx_mode with ops
> locking. This ensures future driver authors are guided toward the
> async path.
>
> Also route ops-locked devices through dev_rx_mode_work even if they
> lack rx_mode NDOs, to ensure netdev_ops_assert_locked() does not fire
> on the legacy path where only RTNL is held.
>
> Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
> ---
> net/core/dev.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c index
> fc5c9b14faa0..f38ab254708b 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -9779,7 +9779,8 @@ void __dev_set_rx_mode(struct net_device *dev)
> if (!netif_up_and_present(dev))
> return;
>
> - if (ops->ndo_set_rx_mode_async || ops->ndo_change_rx_flags) {
> + if (ops->ndo_set_rx_mode_async || ops->ndo_change_rx_flags ||
> + netdev_need_ops_lock(dev)) {
> queue_work(rx_mode_wq, &dev->rx_mode_work);
> return;
> }
> @@ -11471,6 +11472,11 @@ int register_netdevice(struct net_device
> *dev)
> goto err_uninit;
> }
>
> + if (netdev_need_ops_lock(dev) &&
> + dev->netdev_ops->ndo_set_rx_mode &&
> + !dev->netdev_ops->ndo_set_rx_mode_async)
> + netdev_WARN(dev, "ops-locked drivers should use
> +ndo_set_rx_mode_async\n");
> +
> ret = netdev_do_alloc_pcpu_stats(dev);
> if (ret)
> goto err_uninit;
> --
> 2.53.0

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