aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/queueing.h
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2018-07-01 05:28:37 +0200
committerThomas Gschwantner <tharre3@gmail.com>2018-07-01 05:28:37 +0200
commitf55eb4ec4151b5b94fac3a1eb756250231db6aed (patch)
treeb3cadb28a397903eb06546b123a8477483082e99 /src/queueing.h
parentversion: bump snapshot (diff)
downloadwireguard-monolithic-historical-f55eb4ec4151b5b94fac3a1eb756250231db6aed.tar.xz
wireguard-monolithic-historical-f55eb4ec4151b5b94fac3a1eb756250231db6aed.zip
[WIP] implement a lock-free MPMC ring buffer
TODO: actually use the right memory barriers in the right places TODO: eliminate false sharing between mpmc_ptr_ring members TODO: reconsider atomic_long_t vs. atomic_t, vs. the type of size in _init() TODO: sprinkle likely/unlikely on some branches FIXME: it still crashes Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Diffstat (limited to 'src/queueing.h')
-rw-r--r--src/queueing.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/queueing.h b/src/queueing.h
index 0057cfa..14d69df 100644
--- a/src/queueing.h
+++ b/src/queueing.h
@@ -120,10 +120,10 @@ static inline int queue_enqueue_per_device_and_peer(struct crypt_queue *device_q
int cpu;
atomic_set(&PACKET_CB(skb)->state, PACKET_STATE_UNCRYPTED);
- if (unlikely(ptr_ring_produce_bh(&peer_queue->ring, skb)))
+ if (unlikely(mpmc_ptr_ring_produce(&peer_queue->ring, skb)))
return -ENOSPC;
cpu = cpumask_next_online(next_cpu);
- if (unlikely(ptr_ring_produce_bh(&device_queue->ring, skb)))
+ if (unlikely(mpmc_ptr_ring_produce(&device_queue->ring, skb)))
return -EPIPE;
queue_work_on(cpu, wq, &per_cpu_ptr(device_queue->worker, cpu)->work);
return 0;