diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-07-03 04:27:04 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-07-03 11:17:52 +0300 |
commit | 7387943fa35516f6f8017a3b0e9ce48a3bef9faa (patch) | |
tree | 20734c41e3773bf0580dbd4fb3adf966a809c76c /drivers/net/wireguard/receive.c | |
parent | a27ac5390922059867f645eefd978e533d7af902 (diff) | |
download | linux-7387943fa35516f6f8017a3b0e9ce48a3bef9faa.tar.xz |
wireguard: queueing: use saner cpu selection wrapping
Using `% nr_cpumask_bits` is slow and complicated, and not totally
robust toward dynamic changes to CPU topologies. Rather than storing the
next CPU in the round-robin, just store the last one, and also return
that value. This simplifies the loop drastically into a much more common
pattern.
Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
Cc: stable@vger.kernel.org
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: Manuel Leiner <manuel.leiner@gmx.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireguard/receive.c')
-rw-r--r-- | drivers/net/wireguard/receive.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c index 7135d51d2d87..0b3f0c843550 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -524,7 +524,7 @@ static void wg_packet_consume_data(struct wg_device *wg, struct sk_buff *skb) goto err; ret = wg_queue_enqueue_per_device_and_peer(&wg->decrypt_queue, &peer->rx_queue, skb, - wg->packet_crypt_wq, &wg->decrypt_queue.last_cpu); + wg->packet_crypt_wq); if (unlikely(ret == -EPIPE)) wg_queue_enqueue_per_peer_rx(skb, PACKET_STATE_DEAD); if (likely(!ret || ret == -EPIPE)) { |