wireguard-go/tun
Jordan Whited d0bc03c707 tun: implement UDP GSO/GRO for Linux
Implement UDP GSO and GRO for the Linux tun.Device, which is made
possible by virtio extensions in the kernel's TUN driver starting in
v6.2.

secnetperf, a QUIC benchmark utility from microsoft/msquic@8e1eb1a, is
used to demonstrate the effect of this commit between two Linux
computers with i5-12400 CPUs. There is roughly ~13us of round trip
latency between them. secnetperf was invoked with the following command
line options:
-stats:1 -exec:maxtput -test:tput -download:10000 -timed:1 -encrypt:0

The first result is from commit 2e0774f without UDP GSO/GRO on the TUN.

[conn][0x55739a144980] STATS: EcnCapable=0 RTT=3973 us
SendTotalPackets=55859 SendSuspectedLostPackets=61
SendSpuriousLostPackets=59 SendCongestionCount=27
SendEcnCongestionCount=0 RecvTotalPackets=2779122
RecvReorderedPackets=0 RecvDroppedPackets=0
RecvDuplicatePackets=0 RecvDecryptionFailures=0
Result: 3654977571 bytes @ 2922821 kbps (10003.972 ms).

The second result is with UDP GSO/GRO on the TUN.

[conn][0x56493dfd09a0] STATS: EcnCapable=0 RTT=1216 us
SendTotalPackets=165033 SendSuspectedLostPackets=64
SendSpuriousLostPackets=61 SendCongestionCount=53
SendEcnCongestionCount=0 RecvTotalPackets=11845268
RecvReorderedPackets=25267 RecvDroppedPackets=0
RecvDuplicatePackets=0 RecvDecryptionFailures=0
Result: 15574671184 bytes @ 12458214 kbps (10001.222 ms).

Signed-off-by: Jordan Whited <jordan@tailscale.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-12-11 16:27:22 +01:00
..
netstack go.mod,tun/netstack: bump gvisor 2023-10-10 15:37:17 +02:00
tuntest conn, device, tun: implement vectorized I/O plumbing 2023-03-10 14:52:13 +01:00
alignment_windows_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
checksum.go tun: unwind summing loop in checksumNoFold() 2023-10-10 15:07:36 +02:00
checksum_test.go tun: unwind summing loop in checksumNoFold() 2023-10-10 15:07:36 +02:00
errors.go tun: replace ErrorBatch() with errors.Join() 2023-03-17 15:18:04 +01:00
offload_linux.go tun: implement UDP GSO/GRO for Linux 2023-12-11 16:27:22 +01:00
offload_linux_test.go tun: implement UDP GSO/GRO for Linux 2023-12-11 16:27:22 +01:00
operateonfd.go global: bump copyright year 2023-02-07 20:39:29 -03:00
tun.go global: buff -> buf 2023-03-13 17:55:53 +01:00
tun_darwin.go global: buff -> buf 2023-03-13 17:55:53 +01:00
tun_freebsd.go global: buff -> buf 2023-03-13 17:55:53 +01:00
tun_linux.go tun: implement UDP GSO/GRO for Linux 2023-12-11 16:27:22 +01:00
tun_openbsd.go global: buff -> buf 2023-03-13 17:55:53 +01:00
tun_windows.go tun: fix Device.Read() buf length assumption on Windows 2023-12-11 16:20:49 +01:00