From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: netdev@vger.kernel.org
Cc: magnus.karlsson@intel.com, stfomichev@gmail.com, kuba@kernel.org,
pabeni@redhat.com, tushar.vyavahare@intel.com,
kerneljasonxing@gmail.com, bjorn@kernel.org,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Subject: [PATCH v5 net-next 10/13] selftests: xsk: list the endpoint roles of the test cases
Date: Thu, 19 Nov 2026 17:46:33 +0100 [thread overview]
Message-ID: <20261119164636.1071385-11-maciej.fijalkowski@intel.com> (raw)
In-Reply-To: <20261119164636.1071385-1-maciej.fijalkowski@intel.com>
On a NIC, drivers/net/xsk.py, added later in this series, runs each
case with its zero-copy endpoint as RX, as TX or as both. A list of the
cases by ID in that runner would repeat the test table and silently go
stale when a case is added or moved.
Split tests[] into the tests that check both endpoint roles, those that
check the RX endpoint, those that check the TX endpoint, and the
generic ones, which a hardware run does not do: BIDIRECTIONAL swaps the
directions, and STAT_RX_DROPPED and TX_QUEUE_CONSUMER skip in zero-copy
mode. The test IDs follow the order of these arrays, so they change,
and xsk.py takes them from xskxceiver. The notes that came with
ci_skip_tests[] go.
-l now follows each test with the roles that it tests on hardware, e.g.
"0: SEND_RECEIVE rx tx" or "9: POLL_RX rx", and a generic test with
none, so that one list serves both a veth and a hardware run.
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
.../testing/selftests/net/lib/xsk/test_xsk.h | 68 +++++++++++++------
.../selftests/net/lib/xsk/xskxceiver.c | 33 +++++++--
2 files changed, 72 insertions(+), 29 deletions(-)
diff --git a/tools/testing/selftests/net/lib/xsk/test_xsk.h b/tools/testing/selftests/net/lib/xsk/test_xsk.h
index 15534f4ec8f4..6877ec324b58 100644
--- a/tools/testing/selftests/net/lib/xsk/test_xsk.h
+++ b/tools/testing/selftests/net/lib/xsk/test_xsk.h
@@ -304,49 +304,73 @@ int testapp_xdp_shared_umem(struct test_spec *test);
int worker_testapp_validate_rx(struct test_spec *test);
int worker_testapp_validate_tx(struct test_spec *test);
-static const struct test_spec tests[] = {
+/* Tests by the role of the endpoint that they check, which xskxceiver -l
+ * lists after the name. A hardware run gives that role to its zero-copy
+ * endpoint. It does not do the generic tests: BIDIRECTIONAL swaps the
+ * directions, which a hardware run tests one at a time, and the others
+ * skip in zero-copy mode.
+ */
+static const struct test_spec hw_rx_tx_tests[] = {
{.name = "SEND_RECEIVE", .test_func = testapp_send_receive},
{.name = "SEND_RECEIVE_2K_FRAME", .test_func = testapp_send_receive_2k_frame},
{.name = "SEND_RECEIVE_SINGLE_PKT", .test_func = testapp_single_pkt},
+ {.name = "SEND_RECEIVE_9K_PACKETS", .test_func = testapp_send_receive_mb},
+ {.name = "SEND_RECEIVE_UNALIGNED", .test_func = testapp_send_receive_unaligned},
+ {.name = "SEND_RECEIVE_UNALIGNED_9K_PACKETS",
+ .test_func = testapp_send_receive_unaligned_mb},
+ {.name = "HW_SW_MAX_RING_SIZE", .test_func = testapp_hw_sw_max_ring_size},
+ {.name = "TEARDOWN", .test_func = testapp_teardown},
+ {.name = "XDP_SHARED_UMEM", .test_func = testapp_xdp_shared_umem},
+};
+
+static const struct test_spec hw_rx_tests[] = {
{.name = "POLL_RX", .test_func = testapp_poll_rx},
- {.name = "POLL_TX", .test_func = testapp_poll_tx},
{.name = "POLL_RXQ_FULL", .test_func = testapp_poll_rxq_tmout},
- {.name = "POLL_TXQ_FULL", .test_func = testapp_poll_txq_tmout},
- {.name = "ALIGNED_INV_DESC", .test_func = testapp_aligned_inv_desc},
- {.name = "ALIGNED_INV_DESC_2K_FRAME_SIZE", .test_func = testapp_aligned_inv_desc_2k_frame},
{.name = "UMEM_HEADROOM", .test_func = testapp_headroom},
- {.name = "BIDIRECTIONAL", .test_func = testapp_bidirectional},
- {.name = "STAT_RX_DROPPED", .test_func = testapp_stats_rx_dropped},
- {.name = "STAT_TX_INVALID", .test_func = testapp_stats_tx_invalid_descs},
{.name = "STAT_RX_FULL", .test_func = testapp_stats_rx_full},
{.name = "STAT_FILL_EMPTY", .test_func = testapp_stats_fill_empty},
{.name = "XDP_PROG_CLEANUP", .test_func = testapp_xdp_prog_cleanup},
{.name = "XDP_DROP_HALF", .test_func = testapp_xdp_drop},
- {.name = "XDP_SHARED_UMEM", .test_func = testapp_xdp_shared_umem},
{.name = "XDP_METADATA_COPY", .test_func = testapp_xdp_metadata},
{.name = "XDP_METADATA_COPY_MULTI_BUFF", .test_func = testapp_xdp_metadata_mb},
- {.name = "ALIGNED_INV_DESC_MULTI_BUFF", .test_func = testapp_aligned_inv_desc_mb},
- {.name = "TOO_MANY_FRAGS", .test_func = testapp_too_many_frags},
{.name = "XDP_ADJUST_TAIL_SHRINK", .test_func = testapp_adjust_tail_shrink},
- {.name = "TX_QUEUE_CONSUMER", .test_func = testapp_tx_queue_consumer},
- /* Flaky tests */
{.name = "XDP_ADJUST_TAIL_SHRINK_MULTI_BUFF", .test_func = testapp_adjust_tail_shrink_mb},
{.name = "XDP_ADJUST_TAIL_GROW", .test_func = testapp_adjust_tail_grow},
{.name = "XDP_ADJUST_TAIL_GROW_MULTI_BUFF", .test_func = testapp_adjust_tail_grow_mb},
- {.name = "SEND_RECEIVE_9K_PACKETS", .test_func = testapp_send_receive_mb},
- /* Tests with huge page dependency */
- {.name = "SEND_RECEIVE_UNALIGNED", .test_func = testapp_send_receive_unaligned},
+};
+
+static const struct test_spec hw_tx_tests[] = {
+ {.name = "POLL_TX", .test_func = testapp_poll_tx},
+ {.name = "POLL_TXQ_FULL", .test_func = testapp_poll_txq_tmout},
+ {.name = "ALIGNED_INV_DESC", .test_func = testapp_aligned_inv_desc},
+ {.name = "ALIGNED_INV_DESC_2K_FRAME_SIZE", .test_func = testapp_aligned_inv_desc_2k_frame},
+ {.name = "STAT_TX_INVALID", .test_func = testapp_stats_tx_invalid_descs},
+ {.name = "ALIGNED_INV_DESC_MULTI_BUFF", .test_func = testapp_aligned_inv_desc_mb},
+ {.name = "TOO_MANY_FRAGS", .test_func = testapp_too_many_frags},
{.name = "UNALIGNED_INV_DESC", .test_func = testapp_unaligned_inv_desc},
{.name = "UNALIGNED_INV_DESC_4001_FRAME_SIZE",
.test_func = testapp_unaligned_inv_desc_4001_frame},
- {.name = "SEND_RECEIVE_UNALIGNED_9K_PACKETS",
- .test_func = testapp_send_receive_unaligned_mb},
{.name = "UNALIGNED_INV_DESC_MULTI_BUFF", .test_func = testapp_unaligned_inv_desc_mb},
- /* Test with HW ring size dependency */
{.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},
- /* Too long test */
- {.name = "TEARDOWN", .test_func = testapp_teardown},
+};
+
+static const struct test_spec generic_tests[] = {
+ {.name = "BIDIRECTIONAL", .test_func = testapp_bidirectional},
+ {.name = "STAT_RX_DROPPED", .test_func = testapp_stats_rx_dropped},
+ {.name = "TX_QUEUE_CONSUMER", .test_func = testapp_tx_queue_consumer},
+};
+
+/* A test ID is the index of the test in these arrays taken in order. */
+static const struct test_group {
+ const struct test_spec *tests;
+ u32 nb_tests;
+ bool hw_rx;
+ bool hw_tx;
+} test_groups[] = {
+ {hw_rx_tx_tests, ARRAY_SIZE(hw_rx_tx_tests), true, true},
+ {hw_rx_tests, ARRAY_SIZE(hw_rx_tests), true, false},
+ {hw_tx_tests, ARRAY_SIZE(hw_tx_tests), false, true},
+ {generic_tests, ARRAY_SIZE(generic_tests), false, false},
};
diff --git a/tools/testing/selftests/net/lib/xsk/xskxceiver.c b/tools/testing/selftests/net/lib/xsk/xskxceiver.c
index cc7754f3a822..fa6d8798e6b0 100644
--- a/tools/testing/selftests/net/lib/xsk/xskxceiver.c
+++ b/tools/testing/selftests/net/lib/xsk/xskxceiver.c
@@ -176,7 +176,7 @@ static void print_usage(char **argv)
" -v, --verbose Verbose output\n"
" -b, --busy-poll Enable busy poll\n"
" -m, --mode Mode to run: skb, drv or zc\n"
- " -l, --list List all available tests\n"
+ " -l, --list List all tests and the roles they test on hardware\n"
" -t, --test Test case to run, a number from -l\n"
" -e, --endpoint Role of this endpoint: rx or tx\n"
" -p, --peer Control host: IPv4/IPv6 address or hostname\n"
@@ -220,13 +220,31 @@ static void bind_iface(struct ifobject *ifobj, const char *ifname, char **argv)
ifobj->orig_mtu = ifobj->dev_mtu;
}
+/* List each test followed by the roles that it tests on hardware, if any. */
static void print_tests(void)
{
- u32 i;
+ const struct test_group *group;
+ u32 i, j, id = 0;
printf("Tests:\n");
- for (i = 0; i < ARRAY_SIZE(tests); i++)
- printf("%u: %s\n", i, tests[i].name);
+ for (i = 0; i < ARRAY_SIZE(test_groups); i++) {
+ group = &test_groups[i];
+ for (j = 0; j < group->nb_tests; j++, id++)
+ printf("%u: %s%s%s\n", id, group->tests[j].name,
+ group->hw_rx ? " rx" : "", group->hw_tx ? " tx" : "");
+ }
+}
+
+static const struct test_spec *find_test(u32 id)
+{
+ u32 i;
+
+ for (i = 0; i < ARRAY_SIZE(test_groups); i++) {
+ if (id < test_groups[i].nb_tests)
+ return &test_groups[i].tests[id];
+ id -= test_groups[i].nb_tests;
+ }
+ return NULL;
}
static void parse_command_line(struct ifobject *ifobj_tx, struct ifobject *ifobj_rx, int argc,
@@ -468,8 +486,8 @@ static int setup_peer(struct ifobject *local, struct ifobject *shadow,
int main(int argc, char **argv)
{
u32 cache_line_size, max_frags, umem_tailroom;
- const size_t total_tests = ARRAY_SIZE(tests);
struct ifobject *ifobj_tx, *ifobj_rx;
+ const struct test_spec *test_to_run;
struct ifobject *shadow_ifobj;
struct ifobject *local_ifobj;
struct xsk_peer *peer = NULL;
@@ -515,7 +533,8 @@ int main(int argc, char **argv)
ifobj_tx->caps.umem_tailroom = umem_tailroom;
ifobj_rx->caps.umem_tailroom = umem_tailroom;
- if (opt_run_test != RUN_ALL_TESTS && opt_run_test >= total_tests) {
+ test_to_run = find_test(opt_run_test);
+ if (!test_to_run) {
ksft_print_msg("Error: test %u does not exist.\n", opt_run_test);
ksft_exit_xfail();
}
@@ -558,7 +577,7 @@ int main(int argc, char **argv)
}
ksft_set_plan(1);
- test_init(&test, ifobj_tx, ifobj_rx, opt_mode, &tests[opt_run_test]);
+ test_init(&test, ifobj_tx, ifobj_rx, opt_mode, test_to_run);
ret = run_pkt_test(&test);
out:
--
2.43.0
next prev parent reply other threads:[~2026-11-19 16:47 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 16:46 [PATCH v5 net-next 00/13] selftests: net: adjust xskxceiver to drv-net Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 01/13] selftests: xsk: factor endpoint work out of pthread wrappers Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 02/13] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 03/13] selftests: xsk: drop the single-interface loopback mode Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 04/13] selftests: xsk: collect interface capabilities in struct xsk_caps Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 05/13] selftests: xsk: split xskxceiver main() into setup, run and cleanup Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 06/13] selftests: xsk: run one test case per xskxceiver invocation Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 07/13] selftests: xsk: run the RX and TX endpoints in separate processes Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 08/13] selftests: xsk: send UDP over IPv4 or IPv6 between the interface MACs Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-23 19:08 ` Björn Töpel
2026-11-19 16:46 ` [PATCH v5 net-next 09/13] selftests: xsk: prepare xskxceiver for endpoints on two hosts Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-23 19:10 ` Björn Töpel
2026-11-19 16:46 ` Maciej Fijalkowski [this message]
2026-11-23 19:12 ` [PATCH v5 net-next 10/13] selftests: xsk: list the endpoint roles of the test cases Björn Töpel
2026-11-19 16:46 ` [PATCH v5 net-next 11/13] selftests: drv-net: decouple local link setup from netdevsim Maciej Fijalkowski
2026-11-23 19:12 ` Björn Töpel
2026-11-19 16:46 ` [PATCH v5 net-next 12/13] selftests: drv-net: run the AF_XDP tests over veth or a NIC Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 13/13] selftests: xsk: document generic and hardware endpoint runs Maciej Fijalkowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119164636.1071385-11-maciej.fijalkowski@intel.com \
--to=maciej.fijalkowski@intel.com \
--cc=bjorn@kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stfomichev@gmail.com \
--cc=tushar.vyavahare@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox