BPF List
 help / color / mirror / Atom feed
* [PATCH bpf] samples/bpf: consider frame size in tx_only of xdpsock sample
@ 2021-05-06 12:43 Magnus Karlsson
  2021-05-06 13:09 ` Maciej Fijalkowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Magnus Karlsson @ 2021-05-06 12:43 UTC (permalink / raw)
  To: magnus.karlsson, bjorn, ast, daniel, netdev, jonathan.lemon
  Cc: bpf, maciej.fijalkowski

From: Magnus Karlsson <magnus.karlsson@intel.com>

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: 46738f73ea4f ("samples/bpf: add use of need_wakeup flag in xdpsock")
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
---
 samples/bpf/xdpsock_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index aa696854be78..53e300f860bb 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -1255,7 +1255,7 @@ static void tx_only(struct xsk_socket_info *xsk, u32 *frame_nb, int batch_size)
 	for (i = 0; i < batch_size; i++) {
 		struct xdp_desc *tx_desc = xsk_ring_prod__tx_desc(&xsk->tx,
 								  idx + i);
-		tx_desc->addr = (*frame_nb + i) << XSK_UMEM__DEFAULT_FRAME_SHIFT;
+		tx_desc->addr = (*frame_nb + i) * opt_xsk_frame_size;
 		tx_desc->len = PKT_SIZE;
 	}
 

base-commit: 9683e5775c75097c46bd24e65411b16ac6c6cbb3
-- 
2.29.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-06 23:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-06 12:43 [PATCH bpf] samples/bpf: consider frame size in tx_only of xdpsock sample Magnus Karlsson
2021-05-06 13:09 ` Maciej Fijalkowski
2021-05-06 23:29 ` Daniel Borkmann
2021-05-06 23:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox