app/testpmd: initialize pdump
[dpdk.git] / app / test-pmd / testpmd.c
index fa6434c..06885ce 100644 (file)
@@ -76,6 +76,9 @@
 #ifdef RTE_LIBRTE_PMD_XENVIRT
 #include <rte_eth_xenvirt.h>
 #endif
+#ifdef RTE_LIBRTE_PDUMP
+#include <rte_pdump.h>
+#endif
 
 #include "testpmd.h"
 
@@ -144,7 +147,6 @@ streamid_t nb_fwd_streams;       /**< Is equal to (nb_ports * nb_rxq). */
 struct fwd_engine * fwd_engines[] = {
        &io_fwd_engine,
        &mac_fwd_engine,
-       &mac_retry_fwd_engine,
        &mac_swap_engine,
        &flow_gen_engine,
        &rx_only_engine,
@@ -159,6 +161,9 @@ struct fwd_engine * fwd_engines[] = {
 
 struct fwd_config cur_fwd_config;
 struct fwd_engine *cur_fwd_eng = &io_fwd_engine; /**< IO mode by default. */
+uint32_t retry_enabled;
+uint32_t burst_tx_delay_time = BURST_TX_WAIT_US;
+uint32_t burst_tx_retry_num = BURST_TX_RETRIES;
 
 uint16_t mbuf_data_size = DEFAULT_MBUF_DATA_SIZE; /**< Mbuf data space size. */
 uint32_t param_total_num_mbufs = 0;  /**< number of mbufs in all pools - if
@@ -1022,6 +1027,7 @@ start_packet_forwarding(int with_tx_first)
                flush_fwd_rx_queues();
 
        fwd_config_setup();
+       pkt_fwd_config_display(&cur_fwd_config);
        rxtx_config_display();
 
        for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
@@ -1055,8 +1061,11 @@ start_packet_forwarding(int with_tx_first)
                        for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
                                (*port_fwd_begin)(fwd_ports_ids[i]);
                }
-               launch_packet_forwarding(run_one_txonly_burst_on_core);
-               rte_eal_mp_wait_lcore();
+               while (with_tx_first--) {
+                       launch_packet_forwarding(
+                                       run_one_txonly_burst_on_core);
+                       rte_eal_mp_wait_lcore();
+               }
                port_fwd_end = tx_only_engine.port_fwd_end;
                if (port_fwd_end != NULL) {
                        for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++)
@@ -1089,10 +1098,6 @@ stop_packet_forwarding(void)
 #endif
        static const char *acc_stats_border = "+++++++++++++++";
 
-       if (all_ports_started() == 0) {
-               printf("Not all ports were started\n");
-               return;
-       }
        if (test_done) {
                printf("Packet forwarding not started\n");
                return;
@@ -1360,7 +1365,7 @@ start_port(portid_t pid)
                                        if (mp == NULL) {
                                                printf("Failed to setup RX queue:"
                                                        "No mempool allocation"
-                                                       "on the socket %d\n",
+                                                       " on the socket %d\n",
                                                        rxring_numa[pi]);
                                                return -1;
                                        }
@@ -1368,17 +1373,23 @@ start_port(portid_t pid)
                                        diag = rte_eth_rx_queue_setup(pi, qi,
                                             nb_rxd,rxring_numa[pi],
                                             &(port->rx_conf),mp);
-                               }
-                               else
+                               } else {
+                                       struct rte_mempool *mp =
+                                               mbuf_pool_find(port->socket_id);
+                                       if (mp == NULL) {
+                                               printf("Failed to setup RX queue:"
+                                                       "No mempool allocation"
+                                                       " on the socket %d\n",
+                                                       port->socket_id);
+                                               return -1;
+                                       }
                                        diag = rte_eth_rx_queue_setup(pi, qi,
                                             nb_rxd,port->socket_id,
-                                            &(port->rx_conf),
-                                            mbuf_pool_find(port->socket_id));
-
+                                            &(port->rx_conf), mp);
+                               }
                                if (diag == 0)
                                        continue;
 
-
                                /* Fail to setup rx queue, return */
                                if (rte_atomic16_cmpset(&(port->port_status),
                                                        RTE_PORT_HANDLING,
@@ -2025,6 +2036,10 @@ signal_handler(int signum)
        if (signum == SIGINT || signum == SIGTERM) {
                printf("\nSignal %d received, preparing to exit...\n",
                                signum);
+#ifdef RTE_LIBRTE_PDUMP
+               /* uninitialize packet capture framework */
+               rte_pdump_uninit();
+#endif
                force_quit();
                /* exit with the expected status */
                signal(signum, SIG_DFL);
@@ -2045,6 +2060,11 @@ main(int argc, char** argv)
        if (diag < 0)
                rte_panic("Cannot init EAL\n");
 
+#ifdef RTE_LIBRTE_PDUMP
+       /* initialize packet capture framework */
+       rte_pdump_init(NULL);
+#endif
+
        nb_ports = (portid_t) rte_eth_dev_count();
        if (nb_ports == 0)
                RTE_LOG(WARNING, EAL, "No probed ethernet devices\n");