From f8f404c8717fb23fec922f35163937ab01962396 Mon Sep 17 00:00:00 2001 From: Mathias Hall-Andersen Date: Mon, 16 Dec 2019 16:53:23 +0100 Subject: Constant renamed to be consistent with kernel WG --- src/wireguard/router/constants.rs | 6 +++--- src/wireguard/router/device.rs | 5 +++-- src/wireguard/router/peer.rs | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/wireguard/router/constants.rs b/src/wireguard/router/constants.rs index 82360bb..af76299 100644 --- a/src/wireguard/router/constants.rs +++ b/src/wireguard/router/constants.rs @@ -1,9 +1,9 @@ // WireGuard semantics constants -pub const MAX_STAGED_PACKETS: usize = 128; +pub const MAX_QUEUED_PACKETS: usize = 1024; // performance constants -pub const PARALLEL_QUEUE_SIZE: usize = 256; -pub const INORDER_QUEUE_SIZE: usize = PARALLEL_QUEUE_SIZE; +pub const PARALLEL_QUEUE_SIZE: usize = MAX_QUEUED_PACKETS; +pub const INORDER_QUEUE_SIZE: usize = MAX_QUEUED_PACKETS; pub const MAX_INORDER_CONSUME: usize = INORDER_QUEUE_SIZE; diff --git a/src/wireguard/router/device.rs b/src/wireguard/router/device.rs index a12a657..f903a8e 100644 --- a/src/wireguard/router/device.rs +++ b/src/wireguard/router/device.rs @@ -12,6 +12,7 @@ use zerocopy::LayoutVerified; use super::anti_replay::AntiReplay; use super::pool::Job; +use super::constants::PARALLEL_QUEUE_SIZE; use super::inbound; use super::outbound; @@ -125,8 +126,8 @@ impl> Drop impl> DeviceHandle { pub fn new(num_workers: usize, tun: T) -> DeviceHandle { // allocate shared device state - let (queue_outbound, mut outrx) = ParallelQueue::new(num_workers, 128); - let (queue_inbound, mut inrx) = ParallelQueue::new(num_workers, 128); + let (queue_outbound, mut outrx) = ParallelQueue::new(num_workers, PARALLEL_QUEUE_SIZE); + let (queue_inbound, mut inrx) = ParallelQueue::new(num_workers, PARALLEL_QUEUE_SIZE); let device = Device { inner: Arc::new(DeviceInner { inbound: tun, diff --git a/src/wireguard/router/peer.rs b/src/wireguard/router/peer.rs index ebc0aac..23a3e62 100644 --- a/src/wireguard/router/peer.rs +++ b/src/wireguard/router/peer.rs @@ -39,7 +39,7 @@ pub struct PeerInner, Outbound>, pub inbound: InorderQueue, Inbound>, - pub staged_packets: Mutex; MAX_STAGED_PACKETS], Wrapping>>, + pub staged_packets: Mutex; MAX_QUEUED_PACKETS], Wrapping>>, pub keys: Mutex, pub ekey: Mutex>, pub endpoint: Mutex>, -- cgit v1.2.3-59-g8ed1b