Message ID | 20240929123859.24086-1-chenyuan_fl@163.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | bpf: fix the xdp_adjust_tail sample prog issue | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
bpf/vmtest-bpf-next-PR | success | PR summary |
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,