summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorYuan Chen <chenyuan@kylinos.cn>2024-09-30 10:41:15 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-14 19:50:54 +0100
commita6fee1be65aab1b54bf44d7984f039a0c758aafc (patch)
tree9cc16c2caefb00068818e7c24f71be6785b1b563 /samples
parent4e0e9e7af5f75e3a5543c859b24516201b3b60d7 (diff)
downloadlinux-a6fee1be65aab1b54bf44d7984f039a0c758aafc.tar.gz
linux-a6fee1be65aab1b54bf44d7984f039a0c758aafc.tar.bz2
linux-a6fee1be65aab1b54bf44d7984f039a0c758aafc.zip
bpf: Fix the xdp_adjust_tail sample prog issue
[ Upstream commit 4236f114a3ffbbfd217436c08852e94cae372f57 ] 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 Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'samples')
-rw-r--r--samples/bpf/xdp_adjust_tail_kern.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/samples/bpf/xdp_adjust_tail_kern.c b/samples/bpf/xdp_adjust_tail_kern.c
index ffdd548627f0..da67bcad1c63 100644
--- a/samples/bpf/xdp_adjust_tail_kern.c
+++ b/samples/bpf/xdp_adjust_tail_kern.c
@@ -57,6 +57,7 @@ static __always_inline void swap_mac(void *data, struct ethhdr *orig_eth)
static __always_inline __u16 csum_fold_helper(__u32 csum)
{
+ csum = (csum & 0xffff) + (csum >> 16);
return ~((csum & 0xffff) + (csum >> 16));
}