Mapping SndUna, SndNxt, and SndMax to the MDLs

The following figure shows how an offload target maps the bytes that are indicated by the SndUna, SndNxt, and SndMax members of the TCP_OFFLOAD_STATE_DELEGATED structure to the send data.

Diagram illustrating mapping SndUna, SndNxt, and SndMax

In the preceding figure, the linked list that is referenced by the pointer in the NetBufferListChain member contains three NET_BUFFER_LIST structures. There is a NET_BUFFER structure associated with each NET_BUFFER_LIST structure. The send data is distributed across MDLs that are associated with these NET_BUFFER structures.

Note the pointers in the SendDataHead and SendDataTail members at the top of the figure:

  • The pointer in SendDataHead points to the first NET_BUFFER_LIST structure whose NET_BUFFER structure has associated send data. This pointer and the pointer in the NetBufferListChain member reference the same NET_BUFFER_LIST structure.

  • The pointer in SendDataTail points to the last NET_BUFFER_LIST structure whose NET_BUFFER structure has associated send data.

The SendDataHead and SendDataTail members are in the TCP_OFFLOAD_STATE_DELEGATED structure that the host stack offloaded for the connection. The TCP_OFFLOAD_STATE_DELEGATED structure immediately follows in memory the NDIS_MINIPORT_OFFLOAD_BLOCK_LIST structure that contains the NetBufferListChain member.

The byte that is indicated by SndUna maps to the first byte of data in the linked list. The offload target obtains the location of this byte by calling the NET_BUFFER_CURRENT_MDL_OFFSET macro. The value that is returned by this macro specifies the offset, in bytes, to the beginning of the used data space in the MDL that is specified by the CurrentMdl member of the NET_BUFFER structure.

To locate the first byte of send data to be transmitted, the offload target subtracts the sequence number in SndUna from the sequence number in SndNxt and then traverses the MDL chain ( SndNxt- SndUna) bytes from the byte that is indicated by SndUna. For example, if SndNxt- SndUna= 1000, the offload target traverses the MDL chain SndUna+ 1000 bytes to find the byte that is indicated by SndNxt.

To find the byte that is indicated by SndMax, the offload target subtracts the sequence number in SndUna from the sequence number in SndMax and then traverses the MDL chain ( SndMax- SndUna) bytes from the byte that is indicated by SndUna. For example, if SndMax- SndUna= 1600, the offload target traverses the MDL chain SndUna+ 1600 bytes to find the byte that is indicated by SndMax.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft