From: Kaisen You <kaisenx.you@intel.com>
To: dev@dpdk.org
Cc: qiming.yang@intel.com, yidingx.zhou@intel.com,
Kaisen You <kaisenx.you@intel.com>,
stable@dpdk.org
Subject: [PATCH] app/test:add NIC parameter exception handling
Date: Thu, 13 Jul 2023 13:17:16 +0800 [thread overview]
Message-ID: <20230713051716.2579821-1-kaisenx.you@intel.com> (raw)
Add NIC exception parameter handling to dpdk_test process,
program exits when carrying unbound vfio NIC parameters.
Fixes: 50247fe03fe0 ("test/timer: exercise new APIs in secondary process")
Cc: stable@dpdk.org
Signed-off-by: Kaisen You <kaisenx.you@intel.com>
---
app/test/test.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/app/test/test.c b/app/test/test.c
index fb073ff795..c927adba81 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -20,6 +20,7 @@ extern cmdline_parse_ctx_t main_ctx[];
#endif
#include <rte_memory.h>
+#include <rte_ethdev.h>
#include <rte_eal.h>
#include <rte_cycles.h>
#include <rte_log.h>
@@ -111,6 +112,9 @@ main(int argc, char **argv)
char *tests[argc]; /* store an array of tests to run */
int test_count = 0;
int i;
+ uint16_t count;
+ uint16_t port_id;
+ uint16_t nb_ports;
#endif
char *extra_args;
int ret;
@@ -157,6 +161,20 @@ main(int argc, char **argv)
prgname = argv[0];
+ count = 0;
+ RTE_ETH_FOREACH_DEV(port_id) {
+ count++;
+ }
+ nb_ports = count;
+ if (nb_ports == 0) {
+ if (rte_errno == EBUSY)
+ printf("Requested device cannot be used: %d\n", rte_errno);
+ else
+ printf("No probed ethernet devices: %d\n", rte_errno);
+ ret = 0;
+ goto out;
+ }
+
#ifdef RTE_LIB_TIMER
ret = rte_timer_subsystem_init();
if (ret < 0 && ret != -EALREADY) {
--
2.25.1
next reply other threads:[~2023-07-13 5:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 5:17 Kaisen You [this message]
2024-06-13 15:30 ` 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=20230713051716.2579821-1-kaisenx.you@intel.com \
--to=kaisenx.you@intel.com \
--cc=dev@dpdk.org \
--cc=qiming.yang@intel.com \
--cc=stable@dpdk.org \
--cc=yidingx.zhou@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;
as well as URLs for NNTP newsgroup(s).