Supporting NVGRE in Checksum Offload
NDIS 6.30 (Windows Server 2012) introduces Network Virtualization using Generic Routing Encapsulation (NVGRE). NDIS miniport, protocol, and filter drivers and NICs that offload checksum tasks should do so in a way that supports NVGRE.
Note This page assumes that you are familiar with the information in Offloading Checksum Tasks.
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 compute the checksum for the tunnel (outer) IP header, the transport (inner) IP header, and the TCP or UDP header.
The IsIPv4 and IsIPv6 flags in the NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO structure indicate the IP header version of the tunnel (outer) IP header. The NIC must parse the transport (inner) IP header to determine that header's IP version. Because mixed-mode packets are allowed (see NDIS_ENCAPSULATED_PACKET_TASK_OFFLOAD), the NIC must not assume that the inner and outer IP headers will have the same IP header version.
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.
Note that when NDIS_TCP_SEND_OFFLOADS_SUPPLEMENTAL_NET_BUFFER_LIST_INFO.IsEncapsulatedPacket is TRUE, the existing header offset fields, NDIS_TCP_LARGE_SEND_OFFLOAD_NET_BUFFER_LIST_INFO.LsoV2Transmit.TcpHeaderOffset and NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO.Transmit.TcpHeaderOffset, will not have correct values and must not be used by the NIC or driver.
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.
Checksum validation for NVGRE is largely the same as it would be otherwise.
If a miniport receives an OID_TCP_OFFLOAD_PARAMETERS OID request and succeeds it for NDIS_ENCAPSULATION_TYPE_GRE_MAC (see NDIS_OFFLOAD_PARAMETERS), the NIC must perform checksum validation on the tunnel (outer) IP header, transport (inner) IP header, and TCP or UDP header.
For encapsulated packets that have an IPv4 tunnel (outer) header and an IPv4 transport (inner) header, a miniport driver should set the IpChecksumSucceeded flag in the NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO structure only if both IP header checksum validations succeeded. For encapsulated packets that have both a tunnel (outer) IPv4 header and a transport (inner) IPv4 header, the miniport driver should set the IpChecksumFailed flag if either of the IP header checksum validations failed.