For the TSO feature, the Tx DMA
operation is as follows:
- The application sets up the Transmit descriptor (TDES0-TDES3)
and sets the Own bit (TDES3[31]) after setting up the corresponding data buffers
with Ethernet Packet data.
- The application increases the offset value of the Descriptor
Tail pointer of the DMA Tx channel.
- While in the Run state, the DMA fetches the next available
descriptor and does one of the following:
- If the descriptor is a context descriptor and the
context is not between the first and last descriptors of a packet, the
DMA stores the context values.
- If the descriptor is a context descriptor and the
context is between the first and last descriptors of a packet, the DMA
closes the context descriptor indicating a Context Descriptor Error
(TDES3[23]) and fetches the next descriptor.
- If the descriptor is a normal descriptor, the DMA
checks for the TSE bit. If TSE bit is not set, the DMA continues with
the default mode of operation or OSF operation (if enabled).
- The DMA calculates the number of segments from the TCP payload
length(TDES3[17:0]) and the MSS value.
- The DMA goes through channel arbitration to fetch the data
buffers. The DMA fetches the header and payload separately.
- For the first segment, the DMA fetches the header from the
system memory and stores the header in the TSO memory (if present and when the
length of header is not greater than the TSO memory size). If the current
segmented packet is not the first segment, the DMA fetches the header from the
local TSO memory if available. Otherwise, the DMA fetches the header buffer in
system memory again, as done for the first segment. In such cases (header not
available is TSO memory), the DMA does not close the first descriptor containing
the header buffer until the header for last segment is fetched.
- The required fields in the header bytes are modified/updated
as per the segmentation requirements and written into the corresponding MTL
TxQ.
- The DMA then takes the payload buffer pointer, fetches the MSS
number of payload bytes from the system memory, and directly pushes it into the
MTL TxQ. In case the buffer(s) in the descriptor do not have enough data for the
MSS payload (except for the last segment), the DMA closes this descriptor.
- The DMA jumps to Step 3 and repeats the process until the last
segment is written into the TxQ.
- The DMA closes the last descriptor and also the first
descriptor (containing the header buffer when the buffer is not stored in TSO
memory) and then moves on to the next packet transfer.
The DMA repeats all these steps if
more descriptors are available. When no descriptor is available, the DMA enters the
suspend state.
Note: The TSO engine determines whether
to perform TSO or USO operation based on the THL field (TCP Header Length) in TDES3
of first Normal Tx descriptor for the packet. The value of 2 indicates USO and any
value greater than or equal to 5 indicates TSO. The DMA repeats all these steps if
more descriptors are available. When no descriptor is available, the DMA enters the
suspend state.