Imported Upstream version 16.11.2
[deb_dpdk.git] / app / test-pmd / testpmd.c
index a0332c2..ce48ca0 100644 (file)
@@ -283,7 +283,7 @@ struct rte_eth_rxmode rx_mode = {
        .hw_vlan_strip  = 1, /**< VLAN strip enabled. */
        .hw_vlan_extend = 0, /**< Extended VLAN disabled. */
        .jumbo_frame    = 0, /**< Jumbo Frame Support disabled. */
-       .hw_strip_crc   = 0, /**< CRC stripping by hardware disabled. */
+       .hw_strip_crc   = 1, /**< CRC stripping by hardware enabled. */
 };
 
 struct rte_fdir_conf fdir_conf = {
@@ -518,34 +518,6 @@ init_config(void)
                fwd_lcores[lc_id]->cpuid_idx = lc_id;
        }
 
-       /*
-        * Create pools of mbuf.
-        * If NUMA support is disabled, create a single pool of mbuf in
-        * socket 0 memory by default.
-        * Otherwise, create a pool of mbuf in the memory of sockets 0 and 1.
-        *
-        * Use the maximum value of nb_rxd and nb_txd here, then nb_rxd and
-        * nb_txd can be configured at run time.
-        */
-       if (param_total_num_mbufs)
-               nb_mbuf_per_pool = param_total_num_mbufs;
-       else {
-               nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX + (nb_lcores * mb_mempool_cache)
-                               + RTE_TEST_TX_DESC_MAX + MAX_PKT_BURST;
-
-               if (!numa_support)
-                       nb_mbuf_per_pool =
-                               (nb_mbuf_per_pool * RTE_MAX_ETHPORTS);
-       }
-
-       if (!numa_support) {
-               if (socket_num == UMA_NO_CONFIG)
-                       mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0);
-               else
-                       mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool,
-                                                socket_num);
-       }
-
        FOREACH_PORT(pid, ports) {
                port = &ports[pid];
                rte_eth_dev_info_get(pid, &port->dev_info);
@@ -568,20 +540,37 @@ init_config(void)
                port->need_reconfig_queues = 1;
        }
 
+       /*
+        * Create pools of mbuf.
+        * If NUMA support is disabled, create a single pool of mbuf in
+        * socket 0 memory by default.
+        * Otherwise, create a pool of mbuf in the memory of sockets 0 and 1.
+        *
+        * Use the maximum value of nb_rxd and nb_txd here, then nb_rxd and
+        * nb_txd can be configured at run time.
+        */
+       if (param_total_num_mbufs)
+               nb_mbuf_per_pool = param_total_num_mbufs;
+       else {
+               nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX +
+                       (nb_lcores * mb_mempool_cache) +
+                       RTE_TEST_TX_DESC_MAX + MAX_PKT_BURST;
+               nb_mbuf_per_pool *= RTE_MAX_ETHPORTS;
+       }
+
        if (numa_support) {
                uint8_t i;
-               unsigned int nb_mbuf;
 
-               if (param_total_num_mbufs)
-                       nb_mbuf_per_pool = nb_mbuf_per_pool/nb_ports;
-
-               for (i = 0; i < max_socket; i++) {
-                       nb_mbuf = (nb_mbuf_per_pool * RTE_MAX_ETHPORTS);
-                       if (nb_mbuf)
-                               mbuf_pool_create(mbuf_data_size,
-                                               nb_mbuf,i);
-               }
+               for (i = 0; i < max_socket; i++)
+                       mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, i);
+       } else {
+               if (socket_num == UMA_NO_CONFIG)
+                       mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0);
+               else
+                       mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool,
+                                                socket_num);
        }
+
        init_port_config();
 
        /*
@@ -1829,24 +1818,13 @@ init_port_config(void)
                        port->dev_conf.rx_adv_conf.rss_conf.rss_hf = 0;
                }
 
-               if (port->dcb_flag == 0 && port->dev_info.max_vfs == 0) {
+               if (port->dcb_flag == 0) {
                        if( port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
                                port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_RSS;
                        else
                                port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_NONE;
                }
 
-               if (port->dev_info.max_vfs != 0) {
-                       if (port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0)
-                               port->dev_conf.rxmode.mq_mode =
-                                       ETH_MQ_RX_VMDQ_RSS;
-                       else
-                               port->dev_conf.rxmode.mq_mode =
-                                       ETH_MQ_RX_NONE;
-
-                       port->dev_conf.txmode.mq_mode = ETH_MQ_TX_NONE;
-               }
-
                rxtx_port_config(port);
 
                rte_eth_macaddr_get(pid, &port->eth_addr);
@@ -1938,9 +1916,9 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf,
                rx_conf->nb_tcs = num_tcs;
                tx_conf->nb_tcs = num_tcs;
 
-               for (i = 0; i < num_tcs; i++) {
-                       rx_conf->dcb_tc[i] = i;
-                       tx_conf->dcb_tc[i] = i;
+               for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
+                       rx_conf->dcb_tc[i] = i % num_tcs;
+                       tx_conf->dcb_tc[i] = i % num_tcs;
                }
                eth_conf->rxmode.mq_mode = ETH_MQ_RX_DCB_RSS;
                eth_conf->rx_adv_conf.rss_conf.rss_hf = rss_hf;
@@ -2140,6 +2118,7 @@ main(int argc, char** argv)
                        start_packet_forwarding(0);
                }
                prompt();
+               pmd_test_exit();
        } else
 #endif
        {