lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] TCP/UDP checksum offload in hardware


From: Sakhuja, Nitin
Subject: Re: [lwip-users] TCP/UDP checksum offload in hardware
Date: Wed, 30 Mar 2022 15:58:09 +0000

While searching the lwIP developer archives on this topic, I came across the following:

 

https://lists.nongnu.org/archive/html/lwip-devel/2021-09/msg00036.html

 

Quoted from the above thread:

 

These patches implement the capability to offload checksum computation to
modern network cards. For each pbuf the stack can point to a checksum field
that should be computed and filled by the device. Expensive checksumming of
payload bytes can be offloaded which means that this feature is intended for
checksums of transport protocols only (like TCP, UDP). This is inline with
todays standards, like you find with virtio-net

 

As initial implementation, I have it done for TCP, specifically for segments

and control packets that are sent. For this purpose, lwip will compute a

partial checksum of only the pseudo header. Starting with this partial

checksum, the hardware will continue computing the final 16bit ones’

complement over the payload. In principle, UDP can be added, too, but I think

it makes sense to have discussed the basic infrastructure first… I am open

for comments. Maybe you have a better name suggestion for the checksum

functions introduced with patch 2.

 

Best Regards

-Nitin

 

From: Sakhuja, Nitin
Sent: Tuesday, March 29, 2022 11:45 AM
To: 'lwip-users@nongnu.org' <lwip-users@nongnu.org>
Cc: Lopez Cruz, Misael <misael.lopez@ti.com>; Govindarajan, Sriramakrishnan <srk@ti.com>
Subject: TCP/UDP checksum offload in hardware

 

Hello All,

 

From my understanding, lwIP supports an all-or-none approach for checksum generation in software vs hardware i.e. either the complete TCP/UDP checksum is generated in software or it is fully offloaded to hardware.

 

However there are platforms that support partial checksum offload where-in software is required to first generate the IP pseudo-header checksum. The packet with this partial checksum is sent to hardware which then checksums the rest of the L4 payload.

 

This may require the following support to be added in lwIP:

 

  1. Ability to generate only IP pseudo header checksum and populate it in the TCP/UDP header.
  2. Provide metadata in pbuf to assist the hardware in computing the partial checksum. This includes mainly byte start position and number of bytes to checksum. Some new fields will be needed in the pbuf structure to pass this information down to the Ethernet driver. The alternative to propagating this info in pbuf would be to extract it in the driver from the pbuf payload which seems inefficient for every single packet.   

 

Is the above understanding correct and has anyone explored the option of partial checksum generation?

 

Best regards

-Nitin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]