aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/messages.h
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2018-05-31 17:36:30 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-04 20:29:48 +0200
commitb3fbf6e60b2d157d2a298abe81394649309a5a03 (patch)
tree3460fa799f98bb4fd880495ad2230de6c559fbad /src/messages.h
parentmpmc_ptr_ring: Place producer_head and producer_tail in the same cacheline (diff)
downloadwireguard-monolithic-historical-b3fbf6e60b2d157d2a298abe81394649309a5a03.tar.xz
wireguard-monolithic-historical-b3fbf6e60b2d157d2a298abe81394649309a5a03.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.
Diffstat (limited to 'src/messages.h')
-rw-r--r--src/messages.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/messages.h b/src/messages.h
index f3d47ef..e68ce2e 100644
--- a/src/messages.h
+++ b/src/messages.h
@@ -52,7 +52,12 @@ enum limits {
MAX_TIMER_HANDSHAKES = (90 * HZ) / REKEY_TIMEOUT,
MAX_QUEUED_INCOMING_HANDSHAKES = 4096, /* TODO: replace this with DQL */
MAX_STAGED_PACKETS = 128,
- MAX_QUEUED_PACKETS = 1024 /* TODO: replace this with DQL */
+ /* TODO: replace this with DQL */
+ MAX_QUEUED_PACKETS_DEFAULT = 1024,
+ /* The lock-free MPMC queue implementation requires that there are more queue slots than consumers*/
+ MAX_QUEUED_PACKETS = (MAX_QUEUED_PACKETS_DEFAULT > CONFIG_NR_CPUS)?
+ MAX_QUEUED_PACKETS_DEFAULT :
+ roundup_pow_of_two(CONFIG_NR_CPUS + 1),
};
enum message_type {