Checksum Offload
BCM5718 Programmer’s Guide
Broadcom
®
January 29, 2016 • 5718-PG108-R
Page 109
Checksum Offload
As network speed increases, offloading is becoming an important feature, and the ability to offload tasks from
the host processor aids in the efficiency of the host and in overall system performance. To achieve a significant
performance boost, most operating systems now a days offer a mechanism for the TCP/IP protocol stack to
offload checksum calculations to the device.
The host software can configure the Ethernet controller to calculate IP, TCP, and UDP checksum as described
in RFC 791, RFC 793, and RFC 768 respectively. The first step in checksum calculation is determining the start
of an IP and UDP datagram and TCP segment within a frame, which could vary depending on whether the frame
is tagged (VLAN) or encapsulated with LLC/SNAP header. Then the checksum is computed from the start to the
end of the datagram and inserted into the appropriate location in protocol header. Ethernet controller is designed
to support checksum calculation on all frame types and also on IP datagram and TCP segments containing
options.
For the Ethernet controller to compute the checksum and insert it into the outgoing frame, the host software must
set the appropriate control bits in the send buffer descriptors associated with the frame and seed the checksum
field with zero or with the pseudo header checksum.
The host software enables IP checksum calculation by setting the IP_CHKSUM bits in all the send buffer
descriptors associated with the frame. The Ethernet controller inserts the checksum into the checksum field of
the IP header.
To enable TCP or UDP checksum calculation, the host software must set the TCP_UDP_CKSUM bit in all the
send buffer descriptors associated with the frame containing the entire UDP datagram or TCP segment. The
TCP and UDP checksum engines do not span IP fragmented frames.
The host software can configure the Ethernet controller to disable TCP or UDP pseudo-header checksum
calculation by setting the Mode_Control.Send_No_Pseudo_Header_Checksum bit. When set, the host software
must seed the checksum field in the TCP or UDP header with the pseudo-header checksum. If the
Mode_Control.Send_No_Pseudo_Header_Checksum is cleared, the Ethernet controller computes the
checksum including the pseudo header and inserts it into the checksum field.
Note:
In LSO enabled case, a driver needs to zero the TCP checksum field coming from upper layer
of OS when doing TX CSO. Also, make sure to set bit-27 and bit-28 of 0x4800 when doing TX CSO
in both LSO/Non LSO mode.