net: introduce functions to verify L4 checksums
authorOlivier Matz <olivier.matz@6wind.com>
Tue, 27 Apr 2021 07:59:38 +0000 (09:59 +0200)
committerOlivier Matz <olivier.matz@6wind.com>
Tue, 27 Apr 2021 09:50:53 +0000 (11:50 +0200)
commit79cff40588effab037c463c7c1661baea5764c36
tree2fb48c912de049b12ce0931c037f1fe1586eb79e
parentf889c369daf6a5fda2c7e90af658988db07e4cb9
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>
drivers/net/tap/rte_eth_tap.c
lib/net/rte_ip.h