]> git.baikalelectronics.ru Git - kernel.git/commit
wireguard: receive: use ring buffer for incoming handshakes
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 29 Nov 2021 15:39:26 +0000 (10:39 -0500)
committerJakub Kicinski <kuba@kernel.org>
Tue, 30 Nov 2021 03:50:50 +0000 (19:50 -0800)
commit8ab51af1e9d918c2e35cbf9fc6aaadb36caed24b
tree781d38534bf4bf0309a6ce97a514a986d7866308
parentc7ef6c0b106c1e2c864888916f42cd9da9f0f4cf
wireguard: receive: use ring buffer for incoming handshakes

Apparently the spinlock on incoming_handshake's skb_queue is highly
contended, and a torrent of handshake or cookie packets can bring the
data plane to its knees, simply by virtue of enqueueing the handshake
packets to be processed asynchronously. So, we try switching this to a
ring buffer to hopefully have less lock contention. This alleviates the
problem somewhat, though it still isn't perfect, so future patches will
have to improve this further. However, it at least doesn't completely
diminish the data plane.

Reported-by: Streun Fabio <fstreun@student.ethz.ch>
Reported-by: Joel Wanner <joel.wanner@inf.ethz.ch>
Fixes: 0c73bbc77a76 ("net: WireGuard secure network tunnel")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/wireguard/device.c
drivers/net/wireguard/device.h
drivers/net/wireguard/queueing.c
drivers/net/wireguard/queueing.h
drivers/net/wireguard/receive.c