[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240930171753.2572922-11-sdf@fomichev.me>
Date: Mon, 30 Sep 2024 10:17:51 -0700
From: Stanislav Fomichev <sdf@...ichev.me>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
Mina Almasry <almasrymina@...gle.com>
Subject: [PATCH net-next v2 10/12] selftests: ncdevmem: Run selftest when none of the -s or -c has been provided
This will be used as a 'probe' mode in the selftest to check whether
the device supports the devmem or not. Use hard-coded queue layout
(two last queues) and prevent user from passing custom -q and/or -t.
Cc: Mina Almasry <almasrymina@...gle.com>
Signed-off-by: Stanislav Fomichev <sdf@...ichev.me>
---
tools/testing/selftests/net/ncdevmem.c | 27 +++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/net/ncdevmem.c b/tools/testing/selftests/net/ncdevmem.c
index 900a661a61af..9b0a81b12eac 100644
--- a/tools/testing/selftests/net/ncdevmem.c
+++ b/tools/testing/selftests/net/ncdevmem.c
@@ -688,17 +688,26 @@ int main(int argc, char *argv[])
}
}
- if (!server_ip)
- error(1, 0, "Missing -s argument\n");
-
- if (!port)
- error(1, 0, "Missing -p argument\n");
-
if (!ifname)
error(1, 0, "Missing -f argument\n");
ifindex = if_nametoindex(ifname);
+ if (!server_ip && !client_ip) {
+ if (start_queue != -1)
+ error(1, 0, "don't support custom start queue for probing\n");
+ if (num_queues != 1)
+ error(1, 0, "don't support custom number of queues for probing\n");
+
+ start_queue = rxq_num(ifindex) - 2;
+ if (start_queue < 0)
+ error(1, 0, "couldn't detect number of queues\n");
+ num_queues = 2; /* make sure can bind to multiple queues */
+
+ run_devmem_tests();
+ return 0;
+ }
+
if (start_queue < 0) {
start_queue = rxq_num(ifindex) - 1;
@@ -711,7 +720,11 @@ int main(int argc, char *argv[])
for (; optind < argc; optind++)
fprintf(stderr, "extra arguments: %s\n", argv[optind]);
- run_devmem_tests();
+ if (!server_ip)
+ error(1, 0, "Missing -s argument\n");
+
+ if (!port)
+ error(1, 0, "Missing -p argument\n");
mem = provider->alloc(getpagesize() * NUM_PAGES);
ret = is_server ? do_server(mem) : 1;
--
2.46.0
Powered by blists - more mailing lists