wireguard-go/device
Jordan Whited 4ffa9c2032 device: change Peer.endpoint locking to reduce contention
Access to Peer.endpoint was previously synchronized by Peer.RWMutex.
This has now moved to Peer.endpoint.Mutex. Peer.SendBuffers() is now the
sole caller of Endpoint.ClearSrc(), which is signaled via a new bool,
Peer.endpoint.clearSrcOnTx. Previous Callers of Endpoint.ClearSrc() now
set this bool, primarily via peer.markEndpointSrcForClearing().
Peer.SetEndpointFromPacket() clears Peer.endpoint.clearSrcOnTx when an
updated conn.Endpoint is stored. This maintains the same event order as
before, i.e. a conn.Endpoint received after peer.endpoint.clearSrcOnTx
is set, but before the next Peer.SendBuffers() call results in the
latest conn.Endpoint source being used for the next packet transmission.

These changes result in throughput improvements for single flow,
parallel (-P n) flow, and bidirectional (--bidir) flow iperf3 TCP/UDP
tests as measured on both Linux and Windows. Latency under load improves
especially for high throughput Linux scenarios. These improvements are
likely realized on all platforms to some degree, as the changes are not
platform-specific.

Co-authored-by: James Tucker <james@tailscale.com>
Signed-off-by: James Tucker <james@tailscale.com>
Signed-off-by: Jordan Whited <jordan@tailscale.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-12-11 16:34:09 +01:00
..
allowedips_rand_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
allowedips_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
allowedips.go global: bump copyright year 2023-02-07 20:39:29 -03:00
bind_test.go global: buff -> buf 2023-03-13 17:55:53 +01:00
channels.go device: move Queue{In,Out}boundElement Mutex to container type 2023-10-10 15:07:36 +02:00
constants.go global: bump copyright year 2023-02-07 20:39:29 -03:00
cookie_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
cookie.go global: bump copyright year 2023-02-07 20:39:29 -03:00
device_test.go global: buff -> buf 2023-03-13 17:55:53 +01:00
device.go device: change Peer.endpoint locking to reduce contention 2023-12-11 16:34:09 +01:00
devicestate_string.go device: remove deviceStateNew 2021-02-09 15:39:19 +01:00
endpoint_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
indextable.go global: bump copyright year 2023-02-07 20:39:29 -03:00
ip.go global: bump copyright year 2023-02-07 20:39:29 -03:00
kdf_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
keypair.go global: bump copyright year 2023-02-07 20:39:29 -03:00
logger.go global: bump copyright year 2023-02-07 20:39:29 -03:00
mobilequirks.go device: change Peer.endpoint locking to reduce contention 2023-12-11 16:34:09 +01:00
noise_test.go device: uniformly check ECDH output for zeros 2023-02-16 16:33:14 +01:00
noise-helpers.go device: uniformly check ECDH output for zeros 2023-02-16 16:33:14 +01:00
noise-protocol.go device: uniformly check ECDH output for zeros 2023-02-16 16:33:14 +01:00
noise-types.go global: bump copyright year 2023-02-07 20:39:29 -03:00
peer.go device: change Peer.endpoint locking to reduce contention 2023-12-11 16:34:09 +01:00
pools_test.go conn, device, tun: implement vectorized I/O plumbing 2023-03-10 14:52:13 +01:00
pools.go device: move Queue{In,Out}boundElement Mutex to container type 2023-10-10 15:07:36 +02:00
queueconstants_android.go device: ratchet up max segment size on android 2023-10-22 02:12:13 +02:00
queueconstants_default.go conn: inch BatchSize toward being non-dynamic 2023-03-10 14:52:22 +01:00
queueconstants_ios.go global: bump copyright year 2023-02-07 20:39:29 -03:00
queueconstants_windows.go global: bump copyright year 2023-02-07 20:39:29 -03:00
race_disabled_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
race_enabled_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
receive.go device: move Queue{In,Out}boundElement Mutex to container type 2023-10-10 15:07:36 +02:00
send.go device: move Queue{In,Out}boundElement Mutex to container type 2023-10-10 15:07:36 +02:00
sticky_default.go global: remove old-style build tags 2021-10-12 12:02:10 -06:00
sticky_linux.go device: change Peer.endpoint locking to reduce contention 2023-12-11 16:34:09 +01:00
timers.go device: change Peer.endpoint locking to reduce contention 2023-12-11 16:34:09 +01:00
tun.go global: bump copyright year 2023-02-07 20:39:29 -03:00
uapi.go device: change Peer.endpoint locking to reduce contention 2023-12-11 16:34:09 +01:00