app/pdump: check for ports
authorVipin Varghese <vipin.varghese@intel.com>
Mon, 26 Feb 2018 06:22:38 +0000 (11:52 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 22 Apr 2018 23:12:15 +0000 (01:12 +0200)
In case of application build with shared library mode unless
option '-d' is passed, poll mode driver for devices is not
initialized. Notifying the user just after rte_eal_init is
pro active way of intimating the user.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
app/pdump/main.c

index 1f43e3f..aa0f3a3 100644 (file)
@@ -847,6 +847,9 @@ main(int argc, char **argv)
        if (diag < 0)
                rte_panic("Cannot init EAL\n");
 
+       if (rte_eth_dev_count_avail() == 0)
+               rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
+
        argc -= diag;
        argv += (diag - 3);