diff options
author | Ciara Loftus <ciara.loftus@intel.com> | 2019-09-13 12:39:48 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-09-16 09:35:10 +0200 |
commit | 5a712e1363c8ecb4b504a888833ef91416314c36 (patch) | |
tree | 8b79b58d9ea4bcb2cb9b9d56907a3aa2907ecea8 /samples | |
parent | ixgbe: fix xdp handle calculations (diff) | |
download | linux-5a712e1363c8ecb4b504a888833ef91416314c36.tar.xz linux-5a712e1363c8ecb4b504a888833ef91416314c36.zip |
samples/bpf: fix xdpsock l2fwd tx for unaligned mode
Preserve the offset of the address of the received descriptor, and include
it in the address set for the tx descriptor, so the kernel can correctly
locate the start of the packet data.
Fixes: 03895e63ff97 ("samples/bpf: add buffer recycling for unaligned chunks to xdpsock")
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/bpf/xdpsock_user.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c index 102eace22956..df011ac33402 100644 --- a/samples/bpf/xdpsock_user.c +++ b/samples/bpf/xdpsock_user.c @@ -685,7 +685,7 @@ static void l2fwd(struct xsk_socket_info *xsk, struct pollfd *fds) for (i = 0; i < rcvd; i++) { u64 addr = xsk_ring_cons__rx_desc(&xsk->rx, idx_rx)->addr; u32 len = xsk_ring_cons__rx_desc(&xsk->rx, idx_rx++)->len; - u64 orig = xsk_umem__extract_addr(addr); + u64 orig = addr; addr = xsk_umem__add_offset_to_addr(addr); char *pkt = xsk_umem__get_data(xsk->umem->buffer, addr); |