[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240929124134.24288-1-chenyuan_fl@163.com>
Date: Sun, 29 Sep 2024 20:41:34 +0800
From: Yuan Chen <chenyuan_fl@....com>
To: ast@...nel.org,
andrii@...nel.org
Cc: netdev@...r.kernel.org,
bpf@...r.kernel.org
Subject: [PATCH] bpf: fix the xdp_adjust_tail sample prog issue
From: Yuan Chen <chenyuan@...inos.cn>
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.
Fixes: c6ffd1ff7856 (bpf: add bpf_xdp_adjust_tail sample prog)
Signed-off-by: Yuan Chen <chenyuan@...inos.cn>
---
samples/bpf/xdp_adjust_tail_kern.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/samples/bpf/xdp_adjust_tail_kern.c b/samples/bpf/xdp_adjust_tail_kern.c
index ffdd548627f0..3543ddd62ef4 100644
--- a/samples/bpf/xdp_adjust_tail_kern.c
+++ b/samples/bpf/xdp_adjust_tail_kern.c
@@ -57,7 +57,8 @@ static __always_inline void swap_mac(void *data, struct ethhdr *orig_eth)
static __always_inline __u16 csum_fold_helper(__u32 csum)
{
- return ~((csum & 0xffff) + (csum >> 16));
+ csum += (csum >> 16) | (csum << 16);
+ return ~(__sum16)(csum >> 16);
}
static __always_inline void ipv4_csum(void *data_start, int data_size,
--
2.46.0
Powered by blists - more mailing lists