app/test:add NIC parameter exception handling
Checks
Commit Message
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(+)
Comments
On Thu, 13 Jul 2023 13:17:16 +0800
Kaisen You <kaisenx.you@intel.com> wrote:
> 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>
> ---
I don't think covering up a configuration problem is good idea.
What causes this, why should it be fixed here and not in the test setup.
@@ -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) {