TCP Checksum offloading

John Wood jwood at
Wed Sep 7 12:40:31 UTC 2011

Hi Sebastian,

That's correct, the Xilinx MAC calculates both TCP and UDP checksums.  This combined with data caching the packets dramatically increases performance but only if you do both so the processor does not have to access the packets directly outside of the initial copy. 

After looking at the code I would agree that another version of in_cksum would probably be the best way to go here, unfortunately, I am not sure I have the time to take this on.  I was hopeful that another BSP might have done this as a starting point or v4.10 had more support for Xilinx stuff but it appears to be the dame FIFO based driver in V4.9.


-----Original Message-----
From: rtems-users-bounces at [mailto:rtems-users-bounces at] On Behalf Of Sebastian Huber
Sent: Wednesday, September 07, 2011 3:04 AM
To: rtems-users at
Subject: Re: TCP Checksum offloading

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.
rtems-users mailing list
rtems-users at

More information about the users mailing list