diff options
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | 2018-05-28 00:40:09 +0200 |
---|---|---|
committer | Thomas Gschwantner <tharre3@gmail.com> | 2018-06-22 14:52:22 +0200 |
commit | e8ba3596215ae991010cb818a17c80ace01de13f (patch) | |
tree | 3938f0fdc82b9c9e42b92e3e95a7323610f85f99 /src/queueing.c | |
parent | tools: fix misspelling of strchrnul in comment (diff) | |
download | wireguard-monolithic-historical-e8ba3596215ae991010cb818a17c80ace01de13f.tar.xz wireguard-monolithic-historical-e8ba3596215ae991010cb818a17c80ace01de13f.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
Diffstat (limited to 'src/queueing.c')
-rw-r--r-- | src/queueing.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/queueing.c b/src/queueing.c index f33395e..80048c9 100644 --- a/src/queueing.c +++ b/src/queueing.c @@ -25,7 +25,7 @@ int packet_queue_init(struct crypt_queue *queue, work_func_t function, bool mult int ret; memset(queue, 0, sizeof(*queue)); - ret = ptr_ring_init(&queue->ring, len, GFP_KERNEL); + ret = mpmc_ptr_ring_init(&queue->ring, len, GFP_KERNEL); if (ret) return ret; if (multicore) { @@ -41,6 +41,6 @@ void packet_queue_free(struct crypt_queue *queue, bool multicore) { if (multicore) free_percpu(queue->worker); - WARN_ON(!__ptr_ring_empty(&queue->ring)); - ptr_ring_cleanup(&queue->ring, NULL); + WARN_ON(!mpmc_ptr_ring_empty(&queue->ring)); + mpmc_ptr_ring_cleanup(&queue->ring, NULL); } |