共用方式為


NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

The NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure specifies information used in offloading checksum tasks from the TCP/IP transport to a NIC.

Syntax

typedef struct _NDIS_TCP_IP_CHECKSUM_PACKET_INFO {
  union {
    struct {
      ULONG NdisPacketChecksumV4  :1;
      ULONG NdisPacketChecksumV6  :1;
      ULONG NdisPacketTcpChecksum  :1;
      ULONG NdisPacketUdpChecksum  :1;
      ULONG NdisPacketIpChecksum  :1;
    } Transmit;
    struct {
      ULONG NdisPacketTcpChecksumFailed  :1;
      ULONG NdisPacketUdpChecksumFailed  :1;
      ULONG NdisPacketIpChecksumFailed  :1;
      ULONG NdisPacketTcpChecksumSucceeded  :1;
      ULONG NdisPacketUdpChecksumSucceeded  :1;
      ULONG NdisPacketIpChecksumSucceeded  :1;
      ULONG NdisPacketLoopback  :1;
    } Receive;
    ULONG  Value;
  };
} NDIS_TCP_IP_CHECKSUM_PACKET_INFO, *PNDIS_TCP_IP_CHECKSUM_PACKET_INFO;

Members

  • Transmit
    A structure within NDIS_TCP_IP_CHECKSUM_PACKET_INFO that specifies transmit information and that contains the following members:

    • NdisPacketChecksumV4
      Set by the TCP/IP transport to indicate that the send packet contains IPv4 addresses. If the transport does not set NdisPacketChecksumV4, the miniport driver should not perform checksum tasks on the packet.

    • NdisPacketChecksumV6
      Set by the TCP/IP transport to indicate that the send packet contains IPv6 addresses. Because the TCP/IP transport in the initial release of Windows 2000 is incapable of processing IPv6 packets, it never sets NdisPacketChecksumV6. Future versions of the TCP/IP transport, however, may support the processing of IPv6 packets.

    • NdisPacketTcpChecksum
      Set by the TCP/IP transport to indicate that the NIC should calculate the packet's TCP checksum.

    • NdisPacketUdpChecksum
      Set by the TCP/IP transport to indicate that the NIC should calculate the packet's UDP checksum.

    • NdisPacketIpChecksum
      Set by the TCP/IP transport to indicate that the NIC should calculate the IP checksum for the first IP header in the packet. If the packet contains both a tunnel IP header and a transport IP header, the NIC should calculate the checksum for the tunnel IP header. The TCP/IP transport calculates the checksum for the transport IP header of such a packet.

  • Receive
    A structure within NDIS_TCP_IP_CHECKSUM_PACKET_INFO that specifies receive information and that contains the following members:

    • NdisPacketTcpChecksumFailed
      Set by the miniport driver to indicate that the TCP checksum calculated by its NIC did not match the checksum in the receive packet's TCP header.

    • NdisPacketUdpChecksumFailed
      Set by the miniport driver to indicate that the UDP checksum calculated by its NIC did not match the checksum in the receive packet's UDP header. The initial release of Windows 2000 does not support UDP checksum offloads; however, future service packs and update releases of Windows 2000 may support UDP checksum offloads.

    • NdisPacketIpChecksumFailed
      Set by the miniport driver to indicate that the IP checksum calculated by its NIC did not match the checksum in the receive packet's first IP header. If the receive packet contains both a tunnel IP header and a transport IP header, the NIC validates only the checksum for the tunnel IP header. The TCP/IP transport validates the checksum for the transport IP header of such a packet.

    • NdisPacketTcpChecksumSucceeded
      Set by the miniport driver to indicate that the TCP checksum calculated by its NIC matched the checksum in the receive packet's TCP header.

    • NdisPacketUdpChecksumSucceeded
      Set by the miniport driver to indicate that the UDP checksum calculated by its NIC matched the checksum in the receive packet's UDP header.

    • NdisPacketIpChecksumSucceeded
      Set by the miniport driver to indicate that the IP checksum calculated by its NIC matched the checksum in the receive packet's first IP header. If the receive packet contains both a tunnel IP header and a transport IP header, the NIC validates only the checksum for the tunnel IP header. The TCP/IP transport validates the checksum for the transport IP header of such a packet.

    • NdisPacketLoopback
      NDIS uses this bit. The miniport driver must not examine or set this bit; the miniport driver should just ignore this bit.

  • Value
    A ULONG version of the checksum information.

Remarks

The NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure is part of the per-packet information (extended out-of-band data) associated with a packet descriptor.

Before the TCP/IP transport passes to the miniport driver a packet on which the miniport driver will perform checksum tasks, the TCP/IP transport updates the NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure associated with the packet descriptor. Specifically, the TCP/IP transport sets the NdisPacketChecksumV4 flag to indicate that the send packet contains IPv4 addresses. If the TCP/IP transport does not set this flag, the miniport driver should not perform checksum tasks on the packet. If the TCP/IP transport sets NdisPacketChecksumV4 flag, it also sets NdisPacketTcpChecksum and/or NdisPacketIpChecksum to indicate which checksums the miniport driver should calculate for the packet.

Before indicating up a receive packet on which it performs checksum tasks, a miniport driver sets the appropriate NdisPackeXxxChecksumFailed and/or NdisPacketXxxChecksumSucceeded flags in the NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure.

To obtain the NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure, a driver should call the NDIS_PER_PACKET_INFO_FROM_PACKET macro with an InfoType of TcpIpCheckSumPacketInfo. Alternatively, a driver can call the NDIS_PACKET_EXTENSION_FROM_PACKET macro to obtain a pointer to the NDIS_PACKET_EXTENSION structure associated with a given packet descriptor. The miniport driver can then use the TcpIpCheckSumPacketInfo array index to obtain the NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure.

A callout can use the following procedure to detect checksum tasks that will be offloaded:

NDIS_TCP_IP_CHECKSUM_PACKET_INFO ChecksumInfo;
ChecksumInfo.Value = 
 (ULONG) (ULONG_PTR) NET_BUFFER_LIST_INFO(
 NetBufferList, TcpIpChecksumNetBufferListInfo);
if (ChecksumInfo.Transmit.NdisPacketTcpChecksum == TRUE) {
 // In this case, the calculation of the TCP send checksum
  // will be offloaded to the NIC.
 ...
}

else if (ChecksumInfo.Transmit.NdisPacketUdpChecksum == TRUE) {
 // In this case, the calculation of the UDP send checksum
  // will be offloaded to the NIC.
  ...
}

Requirements

Header

Ndis.h (include Ndis.h)

See also

NDIS_PACKET_EXTENSION

NDIS_PACKET_EXTENSION_FROM_PACKET

NDIS_PER_PACKET_INFO_FROM_PACKET

 

 

Send comments about this topic to Microsoft