[PATCH 5/6] net: add smaller IPv4 cksum function for simple cases
Stephen Hemminger
stephen at networkplumber.org
Thu Oct 17 18:24:37 CEST 2024
On Thu, 17 Oct 2024 15:22:12 +0100
Bruce Richardson <bruce.richardson at intel.com> wrote:
> There are multiple instances in the DPDK app folder where we set up an
> IP header and then compute the checksum field by direct addition of
> nine uint16_t values in the header (20 bytes less the cksum field).
> The existing rte_ip.h checksum function is more general than necessary
> here and requires that the checksum field is already set to zero -
> rather than having it skipped.
>
> Fix the code duplication present in the apps by creating a new
> rte_ipv4_cksum_simple function - taking the code from the existing
> testpmd icmpecho.c file - and using that in app/test, testpmd and
> testeventdev.
>
> Within that new function, we can adjust slightly how the typecasting to
> uint16_t is done, and thereby ensure that the app can all be compiled
> without -Wno-address-of-packed-member compiler flag.
>
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
DPDK should use the same optimization as FreeBSD and Linux
and use 32 bit add's here.
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
More information about the dev
mailing list