Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf: Fix the xdp_adjust_tail sample prog issue

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: c6ffd1ff7856 (bpf: add bpf_xdp_adjust_tail sample prog)
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240930024115.52841-1-chenyuan_fl@163.com

authored by

Yuan Chen and committed by
Andrii Nakryiko
4236f114 19090f03

+1
+1
samples/bpf/xdp_adjust_tail_kern.c
··· 57 57 58 58 static __always_inline __u16 csum_fold_helper(__u32 csum) 59 59 { 60 + csum = (csum & 0xffff) + (csum >> 16); 60 61 return ~((csum & 0xffff) + (csum >> 16)); 61 62 } 62 63