net: introduce functions to verify L4 checksums
authorOlivier Matz <olivier.matz@6wind.com>
Wed, 30 Jun 2021 13:51:57 +0000 (15:51 +0200)
committerAndrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru>
Fri, 2 Jul 2021 17:03:03 +0000 (19:03 +0200)
commit45a08ef55e4409043ed405135fb5a728408d65b7
tree86d5fee2f2e2e1023f5e0a82d5fd75694aa26342
parent375474b4d9a89456bd0d8baa4b610d3157ee262c
net: introduce functions to verify L4 checksums

Since commit d5df2ae0428a ("net: fix unneeded replacement of TCP
checksum 0"), the functions rte_ipv4_udptcp_cksum() and
rte_ipv6_udptcp_cksum() can return either 0x0000 or 0xffff when used to
verify a packet containing a valid checksum.

Since these functions should be used to calculate the checksum to set in
a packet, introduce 2 new helpers for checksum verification. They return
0 if the checksum is valid in the packet.

Use this new helper in net/tap driver.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
drivers/net/tap/rte_eth_tap.c
lib/net/rte_ip.h