Skip to content

Commit bc924bb

Browse files
magnus-karlssongregkh
authored andcommitted
samples/bpf: Consider frame size in tx_only of xdpsock sample
commit 3b80d10 upstream. Fix the tx_only micro-benchmark in xdpsock to take frame size into consideration. It was hardcoded to the default value of frame_size which is 4K. Changing this on the command line to 2K made half of the packets illegal as they were outside the umem and were therefore discarded by the kernel. Fixes: 46738f7 ("samples/bpf: add use of need_wakeup flag in xdpsock") Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Link: https://lore.kernel.org/bpf/20210506124349.6666-1-magnus.karlsson@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 02ce4c9 commit bc924bb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎samples/bpf/xdpsock_user.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ static void tx_only(struct xsk_socket_info *xsk, u32 *frame_nb, int batch_size)
12571257
for (i = 0; i < batch_size; i++) {
12581258
struct xdp_desc *tx_desc = xsk_ring_prod__tx_desc(&xsk->tx,
12591259
idx + i);
1260-
tx_desc->addr = (*frame_nb + i) << XSK_UMEM__DEFAULT_FRAME_SHIFT;
1260+
tx_desc->addr = (*frame_nb + i) * opt_xsk_frame_size;
12611261
tx_desc->len = PKT_SIZE;
12621262
}
12631263

0 commit comments

Comments
 (0)