diff options
| author | James Tucker <james@tailscale.com> | 2025-11-25 20:07:06 -0800 |
|---|---|---|
| committer | James Tucker <james@tailscale.com> | 2025-11-26 10:50:39 -0800 |
| commit | 4469ec329c80f2bb2f07c5124a252a22297685d8 (patch) | |
| tree | 4ba26be9dd68df9ef2e16137d81584d15944b35d | |
| parent | 824027305a2b986b523b5b29dab7b96dba4475aa (diff) | |
| download | tailscale-raggi/envknobs-gso-gro.tar.xz tailscale-raggi/envknobs-gso-gro.zip | |
net/batching: add envknobs to disable UDP GRO & GSOraggi/envknobs-gso-gro
It is sometimes useful when diagnosing subtle and specific performance
problems to rule out GRO/GSO independently and/or toggle them to
influence packet pacing.
Updates #17835
Updates tailscale/corp#31164
Signed-off-by: James Tucker <james@tailscale.com>
| -rw-r--r-- | net/batching/conn_linux.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/net/batching/conn_linux.go b/net/batching/conn_linux.go index bd7ac25be..2bb002995 100644 --- a/net/batching/conn_linux.go +++ b/net/batching/conn_linux.go @@ -20,6 +20,7 @@ import ( "golang.org/x/net/ipv4" "golang.org/x/net/ipv6" "golang.org/x/sys/unix" + "tailscale.com/envknob" "tailscale.com/hostinfo" "tailscale.com/net/neterror" "tailscale.com/net/packet" @@ -328,10 +329,15 @@ func tryEnableUDPOffload(pconn nettype.PacketConn) (hasTX bool, hasRX bool) { return } err = rc.Control(func(fd uintptr) { - _, errSyscall := syscall.GetsockoptInt(int(fd), unix.IPPROTO_UDP, unix.UDP_SEGMENT) - hasTX = errSyscall == nil - errSyscall = syscall.SetsockoptInt(int(fd), unix.IPPROTO_UDP, unix.UDP_GRO, 1) - hasRX = errSyscall == nil + var errSyscall error + if !envknob.Bool("TS_DEBUG_DISABLE_UDP_GSO") { + _, errSyscall = syscall.GetsockoptInt(int(fd), unix.IPPROTO_UDP, unix.UDP_SEGMENT) + hasTX = errSyscall == nil + } + if !envknob.Bool("TS_DEBUG_DISABLE_UDP_GRO") { + errSyscall = syscall.SetsockoptInt(int(fd), unix.IPPROTO_UDP, unix.UDP_GRO, 1) + hasRX = errSyscall == nil + } }) if err != nil { return false, false |
