summaryrefslogtreecommitdiffhomepage
path: root/src/queueing.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-07-31 07:03:07 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-07-31 07:19:52 +0200
commit488b7dcba7a5dcf5d65349992c7fc32b3d9c17d1 (patch)
tree847677cfc90dee98bfe86d64a991f3ff0d8f428d /src/queueing.h
parent0c942d003c4291fe05d0de296ac040c7b0d0503c (diff)
peer: simplify rcu reference counts
Use RCU reference counts only when we must, and otherwise use a more reasonably named function. Reported-by: Jann Horn <jann@thejh.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/queueing.h')
-rw-r--r--src/queueing.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/queueing.h b/src/queueing.h
index c17b0d8..3fb7b5c 100644
--- a/src/queueing.h
+++ b/src/queueing.h
@@ -132,20 +132,14 @@ static inline int queue_enqueue_per_device_and_peer(struct crypt_queue *device_q
static inline void queue_enqueue_per_peer(struct crypt_queue *queue, struct sk_buff *skb, enum packet_state state)
{
- struct wireguard_peer *peer = peer_rcu_get(PACKET_PEER(skb));
-
atomic_set(&PACKET_CB(skb)->state, state);
- queue_work_on(cpumask_choose_online(&peer->serial_work_cpu, peer->internal_id), peer->device->packet_crypt_wq, &queue->work);
- peer_put(peer);
+ queue_work_on(cpumask_choose_online(&PACKET_PEER(skb)->serial_work_cpu, PACKET_PEER(skb)->internal_id), PACKET_PEER(skb)->device->packet_crypt_wq, &queue->work);
}
static inline void queue_enqueue_per_peer_napi(struct crypt_queue *queue, struct sk_buff *skb, enum packet_state state)
{
- struct wireguard_peer *peer = peer_rcu_get(PACKET_PEER(skb));
-
atomic_set(&PACKET_CB(skb)->state, state);
- napi_schedule(&peer->napi);
- peer_put(peer);
+ napi_schedule(&PACKET_PEER(skb)->napi);
}
#ifdef DEBUG