Supporting NVGRE in Large Send Offload (LSO)
NDIS 6.30 (Windows Server 2012) introduces Network Virtualization using Generic Routing Encapsulation (NVGRE). NDIS miniport, protocol, and filter drivers and NICs that perform large send offload (LSO) version 2 (LSOV2) should do so in a way that supports NVGRE.
If NDIS_TCP_SEND_OFFLOADS_SUPPLEMENTAL_NET_BUFFER_LIST_INFO.IsEncapsulatedPacket is TRUE and the TcpIpChecksumNetBufferListInfo out-of-band (OOB) information is valid, this indicates that NVGRE support is required and the NIC must perform LSOV2 offload on the NVGRE-formatted packet, with the following conditions:
- Only the values in the NDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO.LsoV2Transmit structure are valid. The NIC and miniport driver must not refer to the values in the NDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO.LsoV1Transmit structure.
- The NDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO.LsoV2Transmit.TcpHeaderOffset member does not have the correct offset value and must not be used by the NIC or miniport driver.
To support NVGRE in LSOV2, protocol and filter drivers must make the following changes:
- Reduce the MSS value in the NDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO.LsoV2Transmit structure to account for the new GRE header.
- Send down a TCP payload length that may not be an exact multiple of the reduced MSS value.
- Adjust the InnerFrameOffset, TransportIpHeaderRelativeOffset, and TcpHeaderRelativeOffset values in the NDIS_TCP_SEND_OFFLOADS_SUPPLEMENTAL_NET_BUFFER_LIST_INFO structure to account for the GRE header.
NICs and miniport drivers may use the InnerFrameOffset, TransportIpHeaderRelativeOffset, and TcpHeaderRelativeOffset values provided in the NDIS_TCP_SEND_OFFLOADS_SUPPLEMENTAL_NET_BUFFER_LIST_INFO structure. The NIC or miniport driver may perform any needed header checks on the tunnel (outer) IP header or subsequent headers to validate these offsets.
Miniport drivers must handle the case where NDIS_TCP_SEND_OFFLOADS_SUPPLEMENTAL_NET_BUFFER_LIST_INFO.InnerFrameOffset may be in a different scatter-gather list than the beginning of the packet. The protocol driver will guarantee that all the prepended encapsulation headers (ETH, IP, GRE) will be physically contiguous and will be in the first MDL of the packet.
Protocol and filter drivers do not ensure that the total TCP payload length is an exact multiple of the reduced MSS value. For this reason, miniport drivers and NICs must update the tunnel (outer) IP header. NICs must generate as many full-sized segments as possible based on the reduced MSS value in the NDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO.LsoV2Transmit OOB information. Only one sub-MSS segment may be generated per LSOv2 send.
Miniport drivers must do the following:
- Compute the checksum for the tunnel (outer) IP header.
- Increment the IP identification (IP ID) value of the tunnel (outer) IP header for every packet. The first packet must use the IP ID in the original tunnel (outer) IP header.
- Increment the IP ID of the transport (inner) IP header for every packet. The first packet must use the IP ID in the original transport (inner) IP header.
- Compute the checksum for the TCP header and the transport (inner) IP header.
- Ensure that the complete headers, including the encapsulation tunnel (outer) headers are added to every generated packet.