aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/mpmc_ptr_ring.h
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2018-07-01 05:28:37 +0200
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>2018-07-01 05:33:52 +0200
commit039b34ff85848cb06c61db4c9a551ec1d1ae25e5 (patch)
tree9cee430d78b29a2f2601ec4c8682c76e5a14aa6d /src/mpmc_ptr_ring.h
parentmpmc_ptr_ring: place producer_head and producer_tail in the same cacheline (diff)
downloadwireguard-monolithic-historical-039b34ff85848cb06c61db4c9a551ec1d1ae25e5.tar.xz
wireguard-monolithic-historical-039b34ff85848cb06c61db4c9a551ec1d1ae25e5.zip
messages: ensure that there are more queue slots than CPUs
I'm not completely sure about this. It also doesn't fix all the errors: sometimes the test suite reports that it fails to send packets. Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Diffstat (limited to 'src/mpmc_ptr_ring.h')
-rw-r--r--src/mpmc_ptr_ring.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mpmc_ptr_ring.h b/src/mpmc_ptr_ring.h
index 8c9c28c..267d10d 100644
--- a/src/mpmc_ptr_ring.h
+++ b/src/mpmc_ptr_ring.h
@@ -134,6 +134,9 @@ static inline void *mpmc_ptr_ring_consume(struct mpmc_ptr_ring *r)
return element;
}
+/*
+ * Warning: size must be greater than the number of concurrent consumers
+ */
static inline int mpmc_ptr_ring_init(struct mpmc_ptr_ring *r, int size, gfp_t gfp)
{
if (WARN_ONCE(!is_power_of_2(size), "size must be a power of two"))