diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-04-22 02:04:22 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-04-22 02:04:22 -0600 |
commit | 5ac387260b81e1b8b4ed00cc9de0c14ec403d8b0 (patch) | |
tree | 6b8ef9201cda4b7b34f85c983d808f5996b93f9f /drivers/net/wireguard/queueing.h | |
parent | wireguard: move symmetric crypto into standalone file (diff) | |
download | wireguard-linux-5ac387260b81e1b8b4ed00cc9de0c14ec403d8b0.tar.xz wireguard-linux-5ac387260b81e1b8b4ed00cc9de0c14ec403d8b0.zip |
wireguard: split CRYPTED/UNCRYPTED into {EN,DE}CRYPTED/NOT_{EN,DE}CRYPTED
By splitting the enum into all possibilities, rather than having the
{EN,DE} prefix being implicit based on context, it allows us to later
merge processing of encryption and decryption into the same context.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'drivers/net/wireguard/queueing.h')
-rw-r--r-- | drivers/net/wireguard/queueing.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h index 3432232afe06..fb927d76b80a 100644 --- a/drivers/net/wireguard/queueing.h +++ b/drivers/net/wireguard/queueing.h @@ -49,8 +49,10 @@ void wg_packet_tx_worker(struct work_struct *work); void wg_packet_encrypt_worker(struct work_struct *work); enum packet_state { - PACKET_STATE_UNCRYPTED, - PACKET_STATE_CRYPTED, + PACKET_STATE_NOT_ENCRYPTED, + PACKET_STATE_NOT_DECRYPTED, + PACKET_STATE_ENCRYPTED, + PACKET_STATE_DECRYPTED, PACKET_STATE_DEAD }; @@ -144,11 +146,12 @@ static inline int wg_cpumask_next_online(int *next) static inline int wg_queue_enqueue_per_device_and_peer( struct crypt_queue *device_queue, struct crypt_queue *peer_queue, - struct sk_buff *skb, struct workqueue_struct *wq, int *next_cpu) + struct sk_buff *skb, struct workqueue_struct *wq, int *next_cpu, + enum packet_state state) { int cpu; - atomic_set_release(&PACKET_CB(skb)->state, PACKET_STATE_UNCRYPTED); + atomic_set_release(&PACKET_CB(skb)->state, state); /* We first queue this up for the peer ingestion, but the consumer * will wait for the state to change to CRYPTED or DEAD before. */ |