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
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: c6ffd1f (bpf: add bpf_xdp_adjust_tail sample prog)
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
  • Loading branch information
chenyuan0001 authored and Kernel Patches Daemon committed Sep 29, 2024
1 parent e8d83e7 commit 7bffceb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion samples/bpf/xdp_adjust_tail_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7bffceb

Please sign in to comment.