| Navigation:First_Community->Software->Windows Driver | Goto:New Topic•Setting•Search | |
CopyRight owned by the original author.--(www.MegaEntry.com)
To increase its performance, the Microsoft TCP/IP transport can offload one or more of the following tasks to a NIC that has the appropriate task-offload capabilities:MegaEntry - Social networking and discussion site!
The TCP/IP transport determines a NIC 's task-offload capabilities by querying OID_TCP_TASK_OFFLOAD. In this query, the TCP/IP transport supplies, in the InformationBuffer, an NDIS_TASK_OFFLOAD_HEADER, which is defined as:typedef struct _NDIS_TASK_OFFLOAD_HEADER
{
ULONG Version;
ULONG Size;
ULONG Reserved;
UCHAR OffsetFirstTask;
NDIS_ENCAPSULATION_FORMAT EncapsulationFormat;
} NDIS_TASK_OFFLOAD_HEADER, *PNDIS_TASK_OFFLOAD_HEADER;
The NDIS_TASK_OFFLOAD_HEADER structure specifies the following:
typedef struct _NDIS_TASK_OFFLOAD
{
ULONG Version;
ULONG Size;
NDIS_TASK Task;
ULONG OffsetNextTask;
ULONG TaskBufferLength;
UCHAR TaskBuffer[1];
} NDIS_TASK_OFFLOAD, *PNDIS_TASK_OFFLOAD;
The NDIS_TASK_OFFLOAD structure specifies the following:
CopyRight owned by the original author.--(www.MegaEntry.com)
TCP/IP checksum tasks cannot be offloaded to a load-balancing miniport driver. For more information on load balancing, see Load Balancing and Fail Over. Before passing to the miniport driver a packet descriptor for a packet on which the miniport driver will perform one or more checksum tasks, the TCP/IP transport specifies the checksum information associated with the packet descriptor. This information is specified by an NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure, which is part of the per-packet information (extended out-of-band data) that is associated with the packet descriptor. The NDIS_TCP_IP_CHECKSUM_PACKET_INFO structure is defined as: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;
Before offloading the checksum calculation for a TCP packet, the TCP/IP transport calculates the one 's complement sum for the TCP pseudoheader. The TCP/IP transport calculates the one 's complement sum across all fields in the pseudoheader, including Source IP Address, Destination IP Address, Protocol, and the TCP length for TCP packets. The TCP/IP transport enters the one 's complement sum for the pseudoheader in the Checksum field of the TCP header.
The one 's complement sum for the pseudoheader provided by the TCP/IP transport gives the NIC an early start in calculating the real TCP checksum for the send packet. To calculate the actual TCP checksum, the NIC calculates the variable part of the TCP checksum (for the TCP header and payload), adds this checksum to the one 's complement sum for the pseudoheader calculated by the TCP/IP transport, and calculates the 16-bit one 's complement for the checksum. For more information on calculating such checksums, see RFC 793 and RFC 1122.
After it receives the packet descriptor in its MiniportSend, MiniportSendPackets, or MiniportCoSendPackets function, a miniport driver typically does the following checksum processing:
CopyRight owned by the original author.--(www.MegaEntry.com)
A NIC that supports the segmentation of large TCP packets (TCP packets that are larger than the maximum transmission unit of the network medium), must also be able to:
Segmentation of a Large TCP Packet
The length of the TCP user data in the large TCP packet should be equal to or less than the value that the miniport driver assigns to the MaxOffloadSize. For more information, see Reporting a NIC 's TCP Packet Segmentation Capabilities.
The length of the TCP user data in a segment packet must be less than or equal to the MSS. The MSS is the ULONG value that the TCP transport passes down by using the per-packet information that is associated with the large TCP packet descriptor. Note that only the last packet that was created from the segmented large packet should contain less than MSS user data bytes. All other packets that were created from the segmented packet should contain MSS user data bytes. If you do not follow this rule, the creation and transmission of unnecessary extra packets could degrade performance.
The number of segment packets that were derived from the large TCP packet must be equal to or greater than the MinSegmentCount specified by the miniport driver. For more information, see Reporting a NIC 's TCP Packet Segmentation Capabilities.
The following assumptions and restrictions apply to processing IP and TCP headers:
CopyRight owned by the original author.--(www.MegaEntry.com)
When processing a large TCP packet, the miniport driver is responsible only for segmenting the packet and affixing MAC, IP, and TCP headers to the packets that are derived from the large TCP packet. The TCP/IP transport performs all other tasks (such as adjusting the send window size based on the remote host 's receive window size). Before completing the send operation for the large packet (such as with NdisMSendComplete or NdisMCoSendComplete), the miniport driver writes the ULONG value (the per-packet information for large-TCP-packet offloads) with the total number of TCP user data bytes sent successfully in all packets that were created from the large TCP packet.