aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-04-09 17:01:54 -0700
committerJakub Kicinski <kuba@kernel.org>2025-04-09 17:01:55 -0700
commitf8cb38c32eb1ba14f82226bee1825e67cffe432f (patch)
tree92629aa80020f1a3c58f50e897987cc12c6c070b /include/linux/netdevice.h
parentnet: Drop unused @sk of __skb_try_recv_from_queue() (diff)
parentnetdev: depend on netdev->lock for qstats in ops locked drivers (diff)
downloadwireguard-linux-f8cb38c32eb1ba14f82226bee1825e67cffe432f.tar.xz
wireguard-linux-f8cb38c32eb1ba14f82226bee1825e67cffe432f.zip
Merge branch 'net-depend-on-instance-lock-for-queue-related-netlink-ops'
Jakub Kicinski says: ==================== net: depend on instance lock for queue related netlink ops netdev-genl used to be protected by rtnl_lock. In previous release we already switched the queue management ops (for Rx zero-copy) to the instance lock. This series converts other ops to depend on the instance lock when possible. Unfortunately queue related state is hard to lock (unlike NAPI) as the process of switching the number of queues usually involves a large reconfiguration of the driver. The reconfig process has historically been under rtnl_lock, but for drivers which opt into ops locking it is also under the instance lock. Leverage that and conditionally take rtnl_lock or instance lock depending on the device capabilities. v1: https://lore.kernel.org/20250407190117.16528-1-kuba@kernel.org ==================== Link: https://patch.msgid.link/20250408195956.412733-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rw-r--r--include/linux/netdevice.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index cf3b6445817b..dece2ae396a1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -688,6 +688,7 @@ struct netdev_queue {
/* Subordinate device that the queue has been assigned to */
struct net_device *sb_dev;
#ifdef CONFIG_XDP_SOCKETS
+ /* "ops protected", see comment about net_device::lock */
struct xsk_buff_pool *pool;
#endif
@@ -1952,6 +1953,7 @@ enum netdev_reg_state {
* @priv_destructor: Called from unregister
* @npinfo: XXX: need comments on this one
* @nd_net: Network namespace this network device is inside
+ * protected by @lock
*
* @ml_priv: Mid-layer private
* @ml_priv_type: Mid-layer private type
@@ -2359,6 +2361,9 @@ struct net_device {
bool dismantle;
+ /** @moving_ns: device is changing netns, protected by @lock */
+ bool moving_ns;
+
enum {
RTNL_LINK_INITIALIZED,
RTNL_LINK_INITIALIZING,
@@ -2521,7 +2526,7 @@ struct net_device {
* @net_shaper_hierarchy, @reg_state, @threaded
*
* Double protects:
- * @up
+ * @up, @moving_ns, @nd_net, @xdp_flags
*
* Double ops protects:
* @real_num_rx_queues, @real_num_tx_queues