TCP Checksum offloading

Sebastian Huber sebastian.huber at
Wed Sep 7 07:04:04 UTC 2011

What do you mean with TCP check sum offload?  The Ethernet controller 
calculates it?

On 09/04/2011 06:28 AM, John Wood wrote:
> After looking into the 4.10 code, it looks like there is no evidence of TCP checksum offload being implemented.  If I am wrong please point me in the right direction.
> Otherwise, I would expect to need to make the following modifications.
> In tcp_input.c line 323
> 	ti->ti_sum = in_cksum(m, len);
> According to the Xilinx notes in the driver, if the checksum calc is ok the TCP checksum will be passed up as 0, otherwise, the actual is passed up allowing the higher layer to drop the packet.  So, I should be able to check the TCP checksum prior to executing line 323, if it is zero call in_cksum, otherwise act as if this call returned 0.
> In tcp_output.c line 599
> 	ti->ti_sum = in_cksum(m, (int)(hdrlen + len));
> I think it would be best to add a configuration option, that either calls this or, in the case of Xilinx, this should be set to zero for TCP offload.

You can provide your own implementation of in_cksum().  You may also set 
special flags in the mbuf.m_flags and use them in your in_cksum(), e.g. to 
distinguish receive and transmit.

Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

More information about the users mailing list