diff options
| author | Jason A. Donenfeld <[email protected]> | 2023-07-03 01:27:04 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2023-07-03 08:17:52 +0000 |
| commit | 7387943fa35516f6f8017a3b0e9ce48a3bef9faa (patch) | |
| tree | 20734c41e3773bf0580dbd4fb3adf966a809c76c /drivers/net/wireguard/queueing.c | |
| parent | samples: pktgen: fix append mode failed issue (diff) | |
| download | kernel-7387943fa35516f6f8017a3b0e9ce48a3bef9faa.tar.gz kernel-7387943fa35516f6f8017a3b0e9ce48a3bef9faa.zip | |
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: [email protected]
Reported-by: Linus Torvalds <[email protected]>
Tested-by: Manuel Leiner <[email protected]>
Signed-off-by: Jason A. Donenfeld <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'drivers/net/wireguard/queueing.c')
| -rw-r--r-- | drivers/net/wireguard/queueing.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/wireguard/queueing.c b/drivers/net/wireguard/queueing.c index 8084e7408c0a..26d235d15235 100644 --- a/drivers/net/wireguard/queueing.c +++ b/drivers/net/wireguard/queueing.c @@ -28,6 +28,7 @@ int wg_packet_queue_init(struct crypt_queue *queue, work_func_t function, int ret; memset(queue, 0, sizeof(*queue)); + queue->last_cpu = -1; ret = ptr_ring_init(&queue->ring, len, GFP_KERNEL); if (ret) return ret; |
