diff options
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | 2018-07-01 05:28:37 +0200 |
---|---|---|
committer | Thomas Gschwantner <tharre3@gmail.com> | 2018-07-01 05:28:37 +0200 |
commit | f55eb4ec4151b5b94fac3a1eb756250231db6aed (patch) | |
tree | b3cadb28a397903eb06546b123a8477483082e99 /src/send.c | |
parent | version: bump snapshot (diff) | |
download | wireguard-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/send.c')
-rw-r--r-- | src/send.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -223,8 +223,8 @@ void packet_tx_worker(struct work_struct *work) struct sk_buff *first; enum packet_state state; - while ((first = __ptr_ring_peek(&queue->ring)) != NULL && (state = atomic_read(&PACKET_CB(first)->state)) != PACKET_STATE_UNCRYPTED) { - __ptr_ring_discard_one(&queue->ring); + while ((first = __mpmc_ptr_ring_peek(&queue->ring)) != NULL && (state = atomic_read(&PACKET_CB(first)->state)) != PACKET_STATE_UNCRYPTED) { + __mpmc_ptr_ring_discard_one(&queue->ring); peer = PACKET_PEER(first); keypair = PACKET_CB(first)->keypair; @@ -244,7 +244,7 @@ void packet_encrypt_worker(struct work_struct *work) struct sk_buff *first, *skb, *next; bool have_simd = simd_get(); - while ((first = ptr_ring_consume_bh(&queue->ring)) != NULL) { + while ((first = mpmc_ptr_ring_consume(&queue->ring)) != NULL) { enum packet_state state = PACKET_STATE_CRYPTED; skb_walk_null_queue_safe(first, skb, next) { |