Offloading TCP Segmentation Using Context Descriptors lets a driver offload ‘TCP Segmentation’ as well as checksum calculations What is ‘segmentation’? MAC header IP header TCP header packet ‘data’ payload The sender creates an Ethernet packet – but it’s longer than the LAN allows – so our NIC can be programmed to ‘carve it up’ into smaller Ethernet packets MAC header IP header TCP header partial payload MAC header IP header TCP header partial payload MAC header IP header TCP header partial payload NIC’s segmentation parameters • • • • • HDRLEN = total length of packet-headers PAYLEN = total length of data to be sent DTALEN = length of packet-buffer content MSS = Maximum Segment Size (w/o hdrs) POPTS = Packet Options Context descriptor (type 0) 63 48 47 40 39 TUCSE TUCSO MSS HDRLEN 32 31 TUCSS RSV 16 15 IPCSE STA TUCMD DTYP =0 8 IPCSO 7 0 IPCSS PAYLEN DEXT=1 (Extended Descriptor) Legend: IPCSS (IP CheckSum Start) IPCSO (IP CheckSum Offset) IPCSE (IP CheckSum Ending) PAYLEN (Payload Length) TUCMD (TCP/UCP Command) HDRLEN (Header Length) TUCSS (TCP/UDP CheckSum Start) TUCSO (TCP/UDP CheckSum Offset) TUCSE (TCP/UDP CheckSum Ending) DTYP (Descriptor Type) STA (TCP/UDP Status) MSS (Maximum Segment Size) The TUCMD byte 7 IDE 6 5 4 SNAP DEXT (=1) reserved (=0) 3 RS 2 TSE Legend: IDE (Interrupt Delay Enable) SNAP (Sub-Network Access Protocol) DEXT (Descriptor Extension) RS (Report Status) TSE (TCP-Segmentation Enable) IP (Internet Protocol) TCP (Transport Control Protocol) always valid valid only when TSE=1 1 IP 0 TCP Context descriptor (type 1) 63 48 47 40 39 32 31 16 15 8 7 ADDRESS VLAN POPTS RSV STA DCMD DTYP =1 DTALEN DEXT=1 (Extended Descriptor) Legend: DTALEN (Data Length) DTYP (Descriptor Type) DCMD (Descriptor Command) STA (Status) RSV (Reserved) POPTS (Packet Options) VLAN (VLAN tag) 0 The DCMD byte 7 IDE 6 5 4 VLE DEXT (=1) reserved (=0) 3 RS 2 TSE Legend: IDE (Interrupt Delay Enable) VLE (VLAN Enable) DEXT (Descriptor Extension) RS (Report Status) TSE (TCP-Segmentation Enable) IFCS (Insert Frame CheckSum) EOP (End Of Packet)) always valid valid only when EOP=1 1 IFCS 0 EOP Context descriptor-pairs • The sender accompanies each packet with a Type 0 Context Descriptor and with (one or more ) Type 1 Context Descriptor(s) 63 48 47 40 39 TUCSE TUCSO MSS HDRLEN 32 31 TUCSS RSV 16 15 IPCSE STA TUCMD DTYP =0 8 IPCSO 7 0 IPCSS PAYLEN BASE ADDRESS VLAN POPTS RSV STA DCMD DTYP =1 DTALEN Internet Protocol Header Leave these fields equal to zero Transport Control Protocol Header Setup this field with ones-complement sum of words from ‘partial’ pseudo-header The ‘partial’ pseudo-header 31 0 Source IP-address Destination IP-address ZERO protocol ID ZERO 64-bit Statistical Counters • The NIC’s statistical counters are intended to operate in a ‘clear-upon-read’ manner, but this requires reading the entire register • A few of the NIC’s statistical counters are 64-bit registers (even though a CPU may have to access them 32-bits at a time) • Examples: TOTL/TOTH, TORL/TORH • You must be sure to access both halves!