Skip to content

Commit 0ec52d8

Browse files
chenyuan0001gregkh
authored andcommitted
bpf: Fix the xdp_adjust_tail sample prog issue
[ Upstream commit 4236f11 ] During the xdp_adjust_tail test, probabilistic failure occurs and SKB package is discarded by the kernel. After checking the issues by tracking SKB package, it is identified that they were caused by checksum errors. Refer to checksum of the arch/arm64/include/asm/checksum.h for fixing. v2: Based on Alexei Starovoitov's suggestions, it is necessary to keep the code implementation consistent. Fixes: c6ffd1f (bpf: add bpf_xdp_adjust_tail sample prog) Signed-off-by: Yuan Chen <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent 9151d80 commit 0ec52d8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

samples/bpf/xdp_adjust_tail_kern.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static __always_inline void swap_mac(void *data, struct ethhdr *orig_eth)
5757

5858
static __always_inline __u16 csum_fold_helper(__u32 csum)
5959
{
60+
csum = (csum & 0xffff) + (csum >> 16);
6061
return ~((csum & 0xffff) + (csum >> 16));
6162
}
6263

0 commit comments

Comments
 (0)