[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210901104732.10956-6-magnus.karlsson@gmail.com>
Date: Wed, 1 Sep 2021 12:47:17 +0200
From: Magnus Karlsson <magnus.karlsson@...il.com>
To: magnus.karlsson@...el.com, bjorn@...nel.org, ast@...nel.org,
daniel@...earbox.net, netdev@...r.kernel.org,
maciej.fijalkowski@...el.com
Cc: jonathan.lemon@...il.com, ciara.loftus@...el.com,
bpf@...r.kernel.org, yhs@...com, andrii@...nel.org
Subject: [PATCH bpf-next 05/20] selftests: xsk: move rxqsize into xsk_socket_info
From: Magnus Karlsson <magnus.karlsson@...el.com>
Move the global variable rxqsize to struct xsk_socket_info as it
describes the size of a ring in that struct. By default, it is set to
the size dictated by libbpf.
Signed-off-by: Magnus Karlsson <magnus.karlsson@...el.com>
---
tools/testing/selftests/bpf/xdpxceiver.c | 9 +++------
tools/testing/selftests/bpf/xdpxceiver.h | 2 +-
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 56ee03fda2b3..28bf62c56190 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -276,7 +276,7 @@ static int xsk_configure_socket(struct xsk_socket_info *xsk, struct xsk_umem_inf
struct xsk_ring_prod *txr;
xsk->umem = umem;
- cfg.rx_size = rxqsize;
+ cfg.rx_size = xsk->rxqsize;
cfg.tx_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
cfg.libbpf_flags = 0;
cfg.xdp_flags = xdp_flags;
@@ -407,6 +407,7 @@ static void __test_spec_init(struct test_spec *test, struct ifobject *ifobj_tx,
memset(&ifobj->umem_arr[j], 0, sizeof(ifobj->umem_arr[j]));
memset(&ifobj->xsk_arr[j], 0, sizeof(ifobj->xsk_arr[j]));
ifobj->umem_arr[j].num_frames = DEFAULT_PKT_CNT / 4;
+ ifobj->xsk_arr[j].rxqsize = XSK_RING_CONS__DEFAULT_NUM_DESCS;
}
}
@@ -988,16 +989,13 @@ static void testapp_stats(struct test_spec *test)
test_spec_reset(test);
stat_test_type = i;
- /* reset defaults */
- rxqsize = XSK_RING_CONS__DEFAULT_NUM_DESCS;
-
switch (stat_test_type) {
case STAT_TEST_RX_DROPPED:
test->ifobj_rx->umem->frame_headroom = XSK_UMEM__DEFAULT_FRAME_SIZE -
XDP_PACKET_HEADROOM - 1;
break;
case STAT_TEST_RX_FULL:
- rxqsize = RX_FULL_RXQSIZE;
+ test->ifobj_rx->xsk->rxqsize = RX_FULL_RXQSIZE;
break;
case STAT_TEST_TX_INVALID:
continue;
@@ -1040,7 +1038,6 @@ static void run_pkt_test(struct test_spec *test, int mode, int type)
xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST;
second_step = 0;
stat_test_type = -1;
- rxqsize = XSK_RING_CONS__DEFAULT_NUM_DESCS;
configured_mode = mode;
diff --git a/tools/testing/selftests/bpf/xdpxceiver.h b/tools/testing/selftests/bpf/xdpxceiver.h
index 0d93a9e6c4f3..09e4e015b1bf 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.h
+++ b/tools/testing/selftests/bpf/xdpxceiver.h
@@ -79,7 +79,6 @@ static bool opt_verbose;
static u32 xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST;
static u32 xdp_bind_flags = XDP_USE_NEED_WAKEUP | XDP_COPY;
static int stat_test_type;
-static u32 rxqsize;
struct xsk_umem_info {
struct xsk_ring_prod fq;
@@ -96,6 +95,7 @@ struct xsk_socket_info {
struct xsk_umem_info *umem;
struct xsk_socket *xsk;
u32 outstanding_tx;
+ u32 rxqsize;
};
struct flow_vector {
--
2.29.0
Powered by blists - more mailing lists