TCP Checksum offloading

Marta Rybczynska marta.rybczynska at
Wed Sep 7 07:37:55 UTC 2011

On Wed, 7 Sep 2011 09:04:04 +0200, Sebastian Huber
<sebastian.huber at> wrote:
> What do you mean with TCP check sum offload?  The Ethernet controller 
> calculates it?

It is becoming a more and more popular feature. However, as far as I know
it didn't exist at the time the network stack was ported to RTEMS.
> 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
>> 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
>> up allowing the higher layer to drop the packet.  So, I should be able
>> 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
>> 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.
> distinguish receive and transmit.

It may be a good idea to hide everything in in_csum (calculate or not, the
value that says that the HW will do it). Same for the RX path.

Marta Rybczynska

More information about the users mailing list