Constant renamed to be consistent with kernel WG

This commit is contained in:
Mathias Hall-Andersen
2019-12-16 16:53:23 +01:00
parent 22f978f014
commit f8f404c871
3 changed files with 7 additions and 6 deletions

View File

@@ -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;

View File

@@ -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<E: Endpoint, C: Callbacks, T: tun::Writer, B: udp::Writer<E>> Drop
impl<E: Endpoint, C: Callbacks, T: tun::Writer, B: udp::Writer<E>> DeviceHandle<E, C, T, B> {
pub fn new(num_workers: usize, tun: T) -> DeviceHandle<E, C, T, B> {
// 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,

View File

@@ -39,7 +39,7 @@ pub struct PeerInner<E: Endpoint, C: Callbacks, T: tun::Writer, B: udp::Writer<E
pub opaque: C::Opaque,
pub outbound: InorderQueue<Peer<E, C, T, B>, Outbound>,
pub inbound: InorderQueue<Peer<E, C, T, B>, Inbound<E, C, T, B>>,
pub staged_packets: Mutex<ArrayDeque<[Vec<u8>; MAX_STAGED_PACKETS], Wrapping>>,
pub staged_packets: Mutex<ArrayDeque<[Vec<u8>; MAX_QUEUED_PACKETS], Wrapping>>,
pub keys: Mutex<KeyWheel>,
pub ekey: Mutex<Option<EncryptionState>>,
pub endpoint: Mutex<Option<E>>,