Skip to content

Commit

Permalink
bpf: Fix the xdp_adjust_tail sample prog issue
Browse files Browse the repository at this point in the history
[ 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]>
  • Loading branch information
chenyuan0001 authored and gregkh committed Dec 5, 2024
1 parent 9151d80 commit 0ec52d8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions samples/bpf/xdp_adjust_tail_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit 0ec52d8

Please sign in to comment.