aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/device.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-09-15 22:04:22 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-09-15 23:41:22 +0200
commit3f1cc6f8911228fda393b4c90ed995637de10227 (patch)
tree18c9183c7664548b90c83d55ffe74afd526d337f /src/device.h
parentdata: avoid running parallel/serial work on the same CPU (diff)
downloadwireguard-monolithic-historical-3f1cc6f8911228fda393b4c90ed995637de10227.tar.xz
wireguard-monolithic-historical-3f1cc6f8911228fda393b4c90ed995637de10227.zip
data: switch to multiconsumer model with spinlocks
Diffstat (limited to 'src/device.h')
-rw-r--r--src/device.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/device.h b/src/device.h
index 047fdf5..c71b251 100644
--- a/src/device.h
+++ b/src/device.h
@@ -16,15 +16,22 @@
struct wireguard_device;
-struct handshake_worker {
- struct wireguard_device *wg;
+struct multicore_worker {
+ void *ptr;
struct work_struct work;
};
struct crypt_queue {
- struct list_head list;
- struct work_struct work;
- atomic_t qlen;
+ spinlock_t lock;
+ struct list_head queue;
+ union {
+ struct {
+ struct multicore_worker __percpu *worker;
+ int last_cpu;
+ };
+ struct work_struct work;
+ };
+ int len;
};
struct wireguard_device {
@@ -37,9 +44,9 @@ struct wireguard_device {
struct noise_static_identity static_identity;
struct workqueue_struct *handshake_receive_wq, *handshake_send_wq, *packet_crypt_wq;
struct sk_buff_head incoming_handshakes;
- struct crypt_queue __percpu *send_queue, *receive_queue;
- int incoming_handshake_cpu, encrypt_cpu, decrypt_cpu;
- struct handshake_worker __percpu *incoming_handshakes_worker;
+ struct crypt_queue send_queue, receive_queue;
+ int incoming_handshake_cpu;
+ struct multicore_worker __percpu *incoming_handshakes_worker;
struct cookie_checker cookie_checker;
struct pubkey_hashtable peer_hashtable;
struct index_hashtable index_hashtable;