aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTushar Vyavahare <tushar.vyavahare@intel.com>2024-04-02 11:45:29 +0000
committerDaniel Borkmann <daniel@iogearbox.net>2024-04-03 16:04:14 +0200
commitc53908b254fcf25b05bcdf6634adb36eaccac111 (patch)
treea122671ae8298b2f23d3f86ebd86a878260648ff
parentc4f960539fae6f04617d3909cc0dfdb88e7d197b (diff)
downloadbpf-next-c53908b254fcf25b05bcdf6634adb36eaccac111.tar.gz
selftests/xsk: Add new test case for AF_XDP under max ring sizes
Introduce a test case to evaluate AF_XDP's robustness by pushing hardware and software ring sizes to their limits. This test ensures AF_XDP's reliability amidst potential producer/consumer throttling due to maximum ring utilization. The testing strategy includes: 1. Configuring rings to their maximum allowable sizes. 2. Executing a series of tests across diverse batch sizes to assess system's behavior under different configurations. Signed-off-by: Tushar Vyavahare <tushar.vyavahare@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> Link: https://lore.kernel.org/bpf/20240402114529.545475-8-tushar.vyavahare@intel.com
-rw-r--r--tools/testing/selftests/bpf/xskxceiver.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index dac2dcf39bb8ff..2eac0895b0a160 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -2439,6 +2439,30 @@ static int testapp_hw_sw_min_ring_size(struct test_spec *test)
return testapp_validate_traffic(test);
}
+static int testapp_hw_sw_max_ring_size(struct test_spec *test)
+{
+ u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 2;
+ int ret;
+
+ test->set_ring = true;
+ test->total_steps = 2;
+ test->ifobj_tx->ring.tx_pending = test->ifobj_tx->ring.tx_max_pending;
+ test->ifobj_tx->ring.rx_pending = test->ifobj_tx->ring.rx_max_pending;
+ test->ifobj_rx->umem->num_frames = max_descs;
+ test->ifobj_rx->xsk->rxqsize = max_descs;
+ test->ifobj_tx->xsk->batch_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
+ test->ifobj_rx->xsk->batch_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
+
+ ret = testapp_validate_traffic(test);
+ if (ret)
+ return ret;
+
+ /* Set batch_size to 4095 */
+ test->ifobj_tx->xsk->batch_size = max_descs - 1;
+ test->ifobj_rx->xsk->batch_size = max_descs - 1;
+ return testapp_validate_traffic(test);
+}
+
static void run_pkt_test(struct test_spec *test)
{
int ret;
@@ -2544,6 +2568,7 @@ static const struct test_spec tests[] = {
{.name = "UNALIGNED_INV_DESC_MULTI_BUFF", .test_func = testapp_unaligned_inv_desc_mb},
{.name = "TOO_MANY_FRAGS", .test_func = testapp_too_many_frags},
{.name = "HW_SW_MIN_RING_SIZE", .test_func = testapp_hw_sw_min_ring_size},
+ {.name = "HW_SW_MAX_RING_SIZE", .test_func = testapp_hw_sw_max_ring_size},
};
static void print_tests(void)