app/testpmd: add parameter to start forwarding Tx first
[dpdk.git] / app / test-pmd / testpmd.c
index b3ad83b..a7bad73 100644 (file)
@@ -98,6 +98,7 @@ uint16_t verbose_level = 0; /**< Silent by default. */
 /* use master core for command line ? */
 uint8_t interactive = 0;
 uint8_t auto_start = 0;
+uint8_t tx_first;
 char cmdline_filename[PATH_MAX] = {0};
 
 /*
@@ -1824,7 +1825,7 @@ rmv_event_callback(void *arg)
        else if (da->type == RTE_DEVTYPE_WHITELISTED_PCI)
                rte_pci_device_name(&da->pci.addr, name, sizeof(name));
        printf("removing device %s\n", name);
-       rte_eal_dev_detach(name);
+       rte_eal_dev_detach(dev->device);
        dev->state = RTE_ETH_DEV_UNUSED;
 }
 
@@ -2297,6 +2298,9 @@ main(int argc, char** argv)
        if (argc > 1)
                launch_args_parse(argc, argv);
 
+       if (tx_first && interactive)
+               rte_exit(EXIT_FAILURE, "--tx-first cannot be used on "
+                               "interactive mode.\n");
        if (!nb_rxq && !nb_txq)
                printf("Warning: Either rx or tx queues should be non-zero\n");
 
@@ -2356,7 +2360,7 @@ main(int argc, char** argv)
                int rc;
 
                printf("No commandline core given, start packet forwarding\n");
-               start_packet_forwarding(0);
+               start_packet_forwarding(tx_first);
                printf("Press enter to exit\n");
                rc = read(0, &c, 1);
                pmd_test_exit();