Repository navigation
guestnet: send large TCP segments to TAP guests with GSO - #32
Merged
Merged
Conversation
Frames from guestnet to the guest were all MTU-size, so a download
needed one frame (and one syscall, and one guest interrupt path) per
1448 bytes. That limited host-to-guest TCP to about 3 Gb/s, against
about 21 Gb/s for the same Firecracker guest on a kernel-routed TAP.
When the link can carry offload metadata, configure gVisor to use host
GSO and send TCP segments of up to 64 KiB. TAPLink is the only link that
supports it for now. It writes each segment with a virtio_net_hdr that
asks for checksum completion and, for a segment larger than one MSS, for
TSO. If the guest accepted TSO, the VMM gives it the large segment; if
not, the host kernel segments the frame before the VMM reads it.
Throughput, before (main) and after this change, in Gb/s, median
(min-max) of 6 runs of 8 s each, in ABBA order. The host is an AWS
m8i.xlarge (4 vCPUs, nested KVM). The guest is Firecracker v1.14.2
with 2 vCPUs and the ciguestlet kernel (Linux 6.8.12), and the server
runs on the host. "up" is guest to host, "down" is host to guest; the
number is the number of TCP flows.
test before after kernel TAP
up1 13.6 (13.3-13.7) 13.4 (12.7-13.7) 24.1
up4 16.8 (16.6-17.1) 16.9 (16.3-17.0) 36.7
down1 3.0 (2.9-3.1) 12.5 (10.1-12.8) 22.1
down4 3.0 (2.8-3.0) 11.6 (11.2-11.7) 20.6
rr1 5099/s 5173/s 5736/s
The kernel TAP column, for reference, is the median of 3 runs. rr1 is a
1-byte request-response loop. Frames to the guest went from 1431 to
about 32 KB. Upload is unchanged, because the guest already sends TSO
frames of about 63 KB.
TestTAPLinkGSO checks the data end to end through a real TAP with TSO,
without offloads, and with packet loss, and that gVisor sends frames
larger than the 32 KiB GSO limit of channel.Endpoint. It and
TestTAPLink now skip if the process can't create a TAP or open an
AF_PACKET socket, instead of if it isn't root, so they also run with
only CAP_NET_ADMIN and CAP_NET_RAW.
Updates tailscale/corp#39994
Updates tailscale/corp#51705
Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
bradfitz
approved these changes
Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Frames from guestnet to the guest were all MTU-size, so a download needed one frame (and one syscall, and one guest interrupt path) per 1448 bytes. That limited host-to-guest TCP to about 3 Gb/s, against about 21 Gb/s for the same Firecracker guest on a kernel-routed TAP.
When the link can carry offload metadata, configure gVisor to use host GSO and send TCP segments of up to 64 KiB. TAPLink is the only link that supports it for now. It writes each segment with a virtio_net_hdr that asks for checksum completion and, for a segment larger than one MSS, for TSO. If the guest accepted TSO, the VMM gives it the large segment; if not, the host kernel segments the frame before the VMM reads it.
Throughput, before (main) and after this change, in Gb/s, median (min-max) of 6 runs of 8 s each, in ABBA order. The host is an AWS m8i.xlarge (4 vCPUs, nested KVM). The guest is Firecracker v1.14.2 with 2 vCPUs and the ciguestlet kernel (Linux 6.8.12), and the server runs on the host. "up" is guest to host, "down" is host to guest; the number is the number of TCP flows.
The kernel TAP column, for reference, is the median of 3 runs. rr1 is a 1-byte request-response loop. Frames to the guest went from 1431 to about 32 KB. Upload is unchanged, because the guest already sends TSO frames of about 63 KB.
TestTAPLinkGSO checks the data end to end through a real TAP with TSO, without offloads, and with packet loss, and that gVisor sends frames larger than the 32 KiB GSO limit of channel.Endpoint. It and TestTAPLink now skip if the process can't create a TAP or open an AF_PACKET socket, instead of if it isn't root, so they also run with only CAP_NET_ADMIN and CAP_NET_RAW.
Updates tailscale/corp#39994
Updates tailscale/corp#51705