net: ethtool: optionally skip rtnl_lock on Netlink path for SET ops
authorJakub Kicinski <kuba@kernel.org>
Fri, 5 Jun 2026 00:29:05 +0000 (17:29 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 9 Jun 2026 17:13:05 +0000 (10:13 -0700)
commitf9a3e05114b85d63452e7f9c172b53d6a1736fe0
tree5b7754e541525360bb9cecee974711de163dcf45
parent45079e00133ee78fd216ccc4285534044ea69173
net: ethtool: optionally skip rtnl_lock on Netlink path for SET ops

Make ethtool not take rtnl_lock for SET commands when operation
is performed on an ops-locked driver. cfg/cfg_pending are now
ops-locked, since only ethtool modifies them.

Some SET driver callbacks will still need rtnl_lock, most notably
those which may end up calling netdev_update_features() or the qdisc
layer (via netif_set_real_num_tx_queues()). Let drivers selectively
opt back into the rtnl_lock with a new bitfield in ops.

We need two helpers since Netlink and ioctl cmds have different
values. Keep the helpers side by side in common.h to make sure
they get updated together, even tho they will only get called
from ioctl.c and netlink.c.

SET commands which don't use ethnl_default_set_doit() are converted
by subsequent commits.

Reviewed-by: Eric Dumazet <edumazet@google.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260605002912.3456868-6-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12 files changed:
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
drivers/net/ethernet/google/gve/gve_ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
drivers/net/ethernet/microsoft/mana/mana_ethtool.c
drivers/net/netdevsim/ethtool.c
include/linux/ethtool.h
include/linux/netdevice.h
net/ethtool/common.h
net/ethtool/netlink.c