Skip to content

Commit

Permalink
samples/bpf: xdp1 and xdp2 reduce XDPBUFSIZE to 60
Browse files Browse the repository at this point in the history
Default samples/pktgen scripts send 60 byte packets as hardware adds
4-bytes FCS checksum, which fulfils minimum Ethernet 64 bytes frame
size.

XDP layer will not necessary have access to the 4-bytes FCS checksum.

This leads to bpf_xdp_load_bytes() failing as it tries to copy 64-bytes
from an XDP packet that only have 60-bytes available.

Fixes: 7722517 ("samples/bpf: fixup some tools to be able to support xdp multibuffer")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/bpf/168545704139.2996228.2516528552939485216.stgit@firesoul
  • Loading branch information
Jesper Dangaard Brouer authored and Daniel Borkmann committed May 31, 2023
1 parent 9b68f30 commit 60548b8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion samples/bpf/xdp1_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static int parse_ipv6(void *data, u64 nh_off, void *data_end)
return ip6h->nexthdr;
}

#define XDPBUFSIZE 64
#define XDPBUFSIZE 60
SEC("xdp.frags")
int xdp_prog1(struct xdp_md *ctx)
{
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/xdp2_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int parse_ipv6(void *data, u64 nh_off, void *data_end)
return ip6h->nexthdr;
}

#define XDPBUFSIZE 64
#define XDPBUFSIZE 60
SEC("xdp.frags")
int xdp_prog1(struct xdp_md *ctx)
{
Expand Down

0 comments on commit 60548b8

Please sign in to comment.