Re: [PATCH] bpf: fix the xdp_adjust_tail sample prog issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 29, 2024 at 5:41 AM Yuan Chen <chenyuan_fl@xxxxxxx> wrote:
>
> From: Yuan Chen <chenyuan@xxxxxxxxxx>
>
> 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@xxxxxxxxxx>
> ---
>  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);
>  }

progs/xdping_kern.c is doing it differently:
static __always_inline __u16 csum_fold_helper(__wsum sum)
{
        sum = (sum & 0xffff) + (sum >> 16);
        return ~((sum & 0xffff) + (sum >> 16));
}

Let's make it common.

pw-bot: cr





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux