[Top][All Lists]

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

[lwip-devel] [patch #10111] [RFC] Hardware checksum offloading

From: Simon Kuenzer
Subject: [lwip-devel] [patch #10111] [RFC] Hardware checksum offloading
Date: Thu, 11 Nov 2021 19:07:19 -0500 (EST)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:94.0) Gecko/20100101 Firefox/94.0

Follow-up Comment #5, patch #10111 (project lwip):

[comment #4 comment #4:]
> As outlook (not part of these patches yet), I plan to extend this work with
another pbuf flag (for instance called DATA_VALID) that can tell the stack to
skip checksum checks for packets. We need this on a per packet base because we
need to be able to handle mixed traffic: (1) checksums might be already
checked (but not necessarily) by a physical network card attached to the
hypervisor, (2) the checksum field might be incomplete - actually incorrect -
because traffic is received from another virtual machine that did offloading.
Because this is an in-memory communication, no corruption is assumed.

I attached a completed version (see v2 patches, previous patches can be now
ignored). The patches implement the partial checksum offloading capabilities
for TCP and UDP for transmission and reception.
For this purpose, we introduce two pbuf flags in order to be able to handle
mixed traffic:

* PBUF_FLAG_CSUM_PARTIAL marks a packet as containing only a partially
computed TCP or UDP checksum. The csum_start and csum_offset fields point to
the checksum field of the header and to where the computation needs to be
completed. As soon as the stack receives such a packet, we skip checksum
validation but check csum_start and csum_offset. Similar to Linux, we assume
that traffic with a partial checksum is only resulting from in-memory
communication where corruption is unlikely, e.g., guest-to-guest,
host-to-guest. Unfortunately, some virtual devices (e.g., netfront) do not
tell csum_start and csum_offset which is why those fields are optional for
reception and only checked when they are available.
* PBUF_FLAG_DATA_VALID marks a packet whose UDP or TCP checksum has already
been validated (e.g., physical NIC on the host). On reception, lwIP will skip
checksum validation. For improving loopback traffic, this flag is set for
transmitted TCP and UDP packets.

Through lwipopts.h, the new features can be compiled-in or even compiled-out.
For each network device, the handling of partially checksummed traffic can be
set through netif checksum control flags.
A current limitation of this version of implementation is the lack of support
for forwarding and L2-bridging. Basically, the missing piece of the puzzle is
a function that can complete the checksum computation in the software for
partially checksummed packets that are forwarded to devices that do not
support partially checksummed packets.


Reply to this item at:


  Message sent via Savannah

reply via email to

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