Free — no signup required

TCP Offloading: Making Hardware Do the Work

3 min read

The Prep Cook Analogy

Processing TCP/IP is mathematically intensive work. For every outgoing packet, the CPU must calculate a checksum to ensure data integrity. For large application writes, the CPU must also segment a large buffer (say, 1MB) into hundreds of individual TCP segments sized to fit the MTU. For incoming traffic, the reverse is true: the CPU must verify checksums and reassemble segments.

This is repetitive, mechanical work—the kind of task that a specialized processor handles far more efficiently than a general-purpose CPU. Modern NICs contain dedicated hardware processors designed exactly for this. TCP Offloading is the technique of delegating these tasks from the main CPU to the NIC hardware.

The Three Core Offloads

1. Checksum Offload (TX and RX)
The NIC calculates the IP, TCP, and UDP checksums in hardware just before transmission (TX checksum offload) and verifies them on receipt (RX checksum offload). The CPU hands the NIC a packet with a blank checksum field and the NIC fills it in. This is enabled by default on virtually all modern NICs and provides a measurable CPU reduction at high packet rates.

2. TSO — TCP Segmentation Offload
Without TSO, the CPU must segment every large application write into MTU-sized TCP segments before handing them to the NIC driver. With TSO enabled, the CPU hands the NIC a single large buffer (up to 64KB) and the NIC's hardware segments it into correctly sized packets on the fly, adding TCP/IP headers to each segment. This reduces the number of times the CPU interacts with the NIC driver by up to 40× for large transfers.

3. LRO — Large Receive Offload
LRO is the receive-side complement to TSO. When many small TCP segments arrive in rapid succession from the same flow, the NIC coalesces them into a single large buffer before handing it to the CPU. Instead of the CPU processing 40 separate 1500-byte segments, it processes one 60KB buffer. This dramatically reduces the number of kernel receive interrupts and memory copies for high-throughput TCP flows.

A note on LRO vs. GRO: LRO (Large Receive Offload) is implemented in NIC hardware. GRO (Generic Receive Offload) is a software equivalent implemented in the Linux kernel, used when the NIC does not support LRO in hardware. GRO is more flexible—it can handle more protocol types—and is generally preferred in environments with complex routing or bridging (like Kubernetes nodes), where LRO can cause issues by coalescing packets that should be forwarded separately.

Key Point: TCP offloading reduces CPU overhead by delegating checksum calculation and segment assembly/disassembly to NIC hardware. These features are enabled by default on modern NICs and should only be disabled for specific debugging scenarios (e.g., when capturing traffic with tcpdump and needing to see individual segments rather than coalesced buffers).

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free