summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-04-06 18:25:33 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-01 01:56:04 +0100
commit628e82e270b63b1a3497372c74088374bbc08ab0 (patch)
treeefb2d1056d9bf9c8920271c52cdaab6fe1f3a1da /Documentation
parent1af2abd34237fd0c4fa32eced05407d71a7e9955 (diff)
downloadlinux-628e82e270b63b1a3497372c74088374bbc08ab0.tar.gz
linux-628e82e270b63b1a3497372c74088374bbc08ab0.tar.bz2
linux-628e82e270b63b1a3497372c74088374bbc08ab0.zip
net: provide macros for commonly copied lockless queue stop/wake code
[ Upstream commit c91c46de6bbc1147ae5dfe046b87f5f3d6593215 ] A lot of drivers follow the same scheme to stop / start queues without introducing locks between xmit and NAPI tx completions. I'm guessing they all copy'n'paste each other's code. The original code dates back all the way to e1000 and Linux 2.6.19. Smaller drivers shy away from the scheme and introduce a lock which may cause deadlocks in netpoll. Provide macros which encapsulate the necessary logic. The macros do not prevent false wake ups, the extra barrier required to close that race is not worth it. See discussion in: https://lore.kernel.org/all/c39312a2-4537-14b4-270c-9fe1fbb91e89@gmail.com/ Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of: 95ecba62e2fd ("net: fix races in netdev_tx_sent_queue()/dev_watchdog()") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/networking/driver.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Documentation/networking/driver.rst b/Documentation/networking/driver.rst
index 3040a74d421c..870f933e4a1a 100644
--- a/Documentation/networking/driver.rst
+++ b/Documentation/networking/driver.rst
@@ -67,6 +67,12 @@ and::
TX_BUFFS_AVAIL(dp) > 0)
netif_wake_queue(dp->dev);
+Lockless queue stop / wake helper macros
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. kernel-doc:: include/net/netdev_queues.h
+ :doc: Lockless queue stopping / waking helpers.
+
No exclusive ownership
----------------------