From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [RFC v2 02/12] test: add test for hotplug and secondary process operations
Date: Wed, 9 Jul 2025 10:33:28 -0700 [thread overview]
Message-ID: <20250709173611.6390-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20250709173611.6390-1-stephen@networkplumber.org>
Use null device to exercise ethdev start/stop in secondary process.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/test_mp_secondary.c | 51 +++++++++++++++++++++++++++++++++---
1 file changed, 48 insertions(+), 3 deletions(-)
diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c
index f3694530a8..09611cc5c2 100644
--- a/app/test/test_mp_secondary.c
+++ b/app/test/test_mp_secondary.c
@@ -15,6 +15,9 @@
#include <string.h>
#include <unistd.h>
+#include <rte_ethdev.h>
+#include <rte_bus_vdev.h>
+
#ifdef RTE_EXEC_ENV_WINDOWS
int
test_mp_secondary(void)
@@ -204,6 +207,44 @@ run_object_creation_tests(void)
return 0;
}
+static int
+run_ethdev_tests(void)
+{
+ char vdev_name[] = "net_null";
+ struct rte_eth_conf dev_conf = { 0 };
+ uint16_t port;
+ int ret;
+
+ printf("### Testing hotplug and ethdev start/stop\n");
+
+ /* use hotplug to make a null vdev */
+ ret = rte_eal_hotplug_add("vdev", vdev_name, "");
+ TEST_ASSERT(ret == 0, "Hotplug add of '%s' failed", vdev_name);
+
+ printf("# Checked hotlug_add OK\n");
+
+ ret = rte_eth_dev_get_port_by_name(vdev_name, &port);
+ TEST_ASSERT(ret == 0, "Lookup vdev '%s' failed", vdev_name);
+
+ ret = rte_eth_dev_configure(port, 1, 1, &dev_conf);
+ TEST_ASSERT(ret == 0, "Configure port %u failed", port);
+
+ ret = rte_eth_dev_start(port);
+ TEST_ASSERT(ret == 0, "Start port %u failed", port);
+
+ printf("# Checked rte_eth_dev_start\n");
+
+ ret = rte_eth_dev_stop(port);
+ TEST_ASSERT(ret == 0, "Stop port %u failed", port);
+
+ printf("# Checked rte_eth_dev_stop\n");
+
+ rte_eal_hotplug_remove("vdev", vdev_name);
+
+ printf("# Checked hotlug_remove OK\n");
+ return 0;
+}
+
/* if called in a primary process, just spawns off a secondary process to
* run validation tests - which brings us right back here again...
* if called in a secondary process, this runs a series of API tests to check
@@ -212,15 +253,19 @@ run_object_creation_tests(void)
int
test_mp_secondary(void)
{
- if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ int ret;
+
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY)
return run_secondary_instances();
- }
printf("IN SECONDARY PROCESS\n");
+ ret = run_ethdev_tests();
+ if (ret != 0)
+ return ret;
return run_object_creation_tests();
}
#endif /* !RTE_EXEC_ENV_WINDOWS */
-REGISTER_FAST_TEST(multiprocess_autotest, false, false, test_mp_secondary);
+REGISTER_FAST_TEST(multiprocess_autotest, true, true, test_mp_secondary);
--
2.47.2
next prev parent reply other threads:[~2025-07-09 17:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0250411234927.114568-1-stephen@networkplumber.org>
2025-07-09 17:33 ` [RFC v2 00/12] Packet capture using port mirroring Stephen Hemminger
2025-07-09 17:33 ` [RFC v2 01/12] ethdev: allow start/stop from secondary process Stephen Hemminger
2025-07-09 17:47 ` Khadem Ullah
2025-07-09 17:33 ` Stephen Hemminger [this message]
2025-07-09 17:33 ` [RFC v2 03/12] net/ring: allow lockfree transmit if ring supports it Stephen Hemminger
2025-07-09 17:33 ` [RFC v2 04/12] net/ring: add new devargs for dumpcap use Stephen Hemminger
2025-07-09 17:33 ` [RFC v2 05/12] mbuf: add dynamic flag for use by port mirroring Stephen Hemminger
2025-07-09 17:33 ` [RFC v2 06/12] ethdev: add port mirroring feature Stephen Hemminger
2025-07-09 17:33 ` [RFC v2 07/12] pcapng: split packet copy from header insertion Stephen Hemminger
2025-07-09 17:33 ` [RFC v2 08/12] pcapng: make queue optional Stephen Hemminger
2025-07-09 17:33 ` [RFC v2 09/12] test: add tests for ethdev mirror Stephen Hemminger
2025-07-09 17:33 ` [RFC v2 10/12] app/testpmd: support for port mirroring Stephen Hemminger
2025-07-09 17:33 ` [RFC v2 11/12] app/dumpcap: use port mirror instead of pdump Stephen Hemminger
2025-07-09 17:33 ` [RFC v2 12/12] pdump: mark API and application as deprecated Stephen Hemminger
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=20250709173611.6390-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
/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;
as well as URLs for NNTP newsgroup(s).