aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-03-24 15:45:32 -0700
committerJakub Kicinski <kuba@kernel.org>2025-03-25 10:06:49 -0700
commit310ae9eb2617c62deedef8f121d7ca1ae774fa76 (patch)
tree2257965b50c36fe428e5040ef6f040e675bbda35 /include/linux/netdevice.h
parentnet: designate queue counts as "double ops protected" by instance lock (diff)
downloadwireguard-linux-310ae9eb2617c62deedef8f121d7ca1ae774fa76.tar.xz
wireguard-linux-310ae9eb2617c62deedef8f121d7ca1ae774fa76.zip
net: designate queue -> napi linking as "ops protected"
netdev netlink is the only reader of netdev_{,rx_}queue->napi, and it already holds netdev->lock. Switch protection of the writes to netdev->lock to "ops protected". The expectation will be now that accessing queue->napi will require netdev->lock for "ops locked" drivers, and rtnl_lock for all other drivers. Current "ops locked" drivers don't require any changes. gve and netdevsim use _locked() helpers right next to netif_queue_set_napi() so they must be holding the instance lock. iavf doesn't call it. bnxt is a bit messy but all paths seem locked. Acked-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20250324224537.248800-7-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 60ef367d8575..fa79145518d1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -710,7 +710,7 @@ struct netdev_queue {
* slow- / control-path part
*/
/* NAPI instance for the queue
- * Readers and writers must hold RTNL
+ * "ops protected", see comment about net_device::lock
*/
struct napi_struct *napi;
@@ -2526,7 +2526,8 @@ struct net_device {
* Double ops protects:
* @real_num_rx_queues, @real_num_tx_queues
*
- * Also protects some fields in struct napi_struct.
+ * Also protects some fields in:
+ * struct napi_struct, struct netdev_queue, struct netdev_rx_queue
*
* Ordering: take after rtnl_lock.
*/