Skip to content

guestnet: send large TCP segments to TAP guests with GSO - #32

Merged
tomhjp merged 1 commit into
mainfrom
tomhjp/guestnet-gso
Nov 30, 2026
Merged

tomhjp merged 1 commit into
mainfrom
tomhjp/guestnet-gso

Conversation

@tomhjp

@tomhjp tomhjp commented Nov 30, 2026

Copy link
Copy Markdown
Member

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

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>
@tomhjp
tomhjp requested a review from a team November 30, 2026 22:40
@tomhjp
tomhjp merged commit a4b920c into main Nov 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants