aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/netdev_rx_queue.c
diff options
context:
space:
mode:
authorStanislav Fomichev <[email protected]>2025-03-05 16:37:23 +0000
committerJakub Kicinski <[email protected]>2025-03-06 20:59:43 +0000
commitcae03e5bdd9e0c8570506c50f1f234da40201732 (patch)
tree6ba78649fe86149ca22105ed86327ed18e5759e5 /net/core/netdev_rx_queue.c
parentnet: hold netdev instance lock during qdisc ndo_setup_tc (diff)
downloadkernel-cae03e5bdd9e0c8570506c50f1f234da40201732.tar.gz
kernel-cae03e5bdd9e0c8570506c50f1f234da40201732.zip
net: hold netdev instance lock during queue operations
For the drivers that use queue management API, switch to the mode where core stack holds the netdev instance lock. This affects the following drivers: - bnxt - gve - netdevsim Originally I locked only start/stop, but switched to holding the lock over all iterations to make them look atomic to the device (feels like it should be easier to reason about). Reviewed-by: Eric Dumazet <[email protected]> Cc: Saeed Mahameed <[email protected]> Signed-off-by: Stanislav Fomichev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/core/netdev_rx_queue.c')
-rw-r--r--net/core/netdev_rx_queue.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c
index ddd54e1e7289..7419c41fd3cb 100644
--- a/net/core/netdev_rx_queue.c
+++ b/net/core/netdev_rx_queue.c
@@ -30,6 +30,8 @@ int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq_idx)
goto err_free_new_mem;
}
+ netdev_lock(dev);
+
err = qops->ndo_queue_mem_alloc(dev, new_mem, rxq_idx);
if (err)
goto err_free_old_mem;
@@ -52,6 +54,8 @@ int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq_idx)
qops->ndo_queue_mem_free(dev, old_mem);
+ netdev_unlock(dev);
+
kvfree(old_mem);
kvfree(new_mem);
@@ -76,6 +80,7 @@ err_free_new_queue_mem:
qops->ndo_queue_mem_free(dev, new_mem);
err_free_old_mem:
+ netdev_unlock(dev);
kvfree(old_mem);
err_free_new_mem: