aboutsummaryrefslogtreecommitdiffstats
path: root/app/test-pmd/testpmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/test-pmd/testpmd.c')
-rw-r--r--app/test-pmd/testpmd.c60
1 files changed, 38 insertions, 22 deletions
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1428974e..8d0905eb 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -272,9 +272,6 @@ uint32_t bypass_timeout = RTE_BYPASS_TMT_OFF;
#endif
-/* default period is 1 second */
-static uint64_t timer_period = 1;
-
/*
* Ethernet device configuration.
*/
@@ -444,10 +441,13 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
mb_size, (unsigned) mb_mempool_cache,
sizeof(struct rte_pktmbuf_pool_private),
socket_id, 0);
+ if (rte_mp == NULL)
+ goto err;
if (rte_mempool_populate_anon(rte_mp) == 0) {
rte_mempool_free(rte_mp);
rte_mp = NULL;
+ goto err;
}
rte_pktmbuf_pool_init(rte_mp, NULL);
rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);
@@ -458,6 +458,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,
}
}
+err:
if (rte_mp == NULL) {
rte_exit(EXIT_FAILURE,
"Creation of mbuf pool for socket %u failed: %s\n",
@@ -881,9 +882,10 @@ flush_fwd_rx_queues(void)
uint16_t i;
uint8_t j;
uint64_t prev_tsc = 0, diff_tsc, cur_tsc, timer_tsc = 0;
+ uint64_t timer_period;
/* convert to number of cycles */
- timer_period *= rte_get_timer_hz();
+ timer_period = rte_get_timer_hz(); /* 1 second timeout */
for (j = 0; j < 2; j++) {
for (rxp = 0; rxp < cur_fwd_config.nb_fwd_ports; rxp++) {
@@ -1962,17 +1964,36 @@ init_port_dcb_config(portid_t pid,
uint8_t pfc_en)
{
struct rte_eth_conf port_conf;
- struct rte_eth_dev_info dev_info;
struct rte_port *rte_port;
int retval;
uint16_t i;
- rte_eth_dev_info_get(pid, &dev_info);
+ rte_port = &ports[pid];
+
+ memset(&port_conf, 0, sizeof(struct rte_eth_conf));
+ /* Enter DCB configuration status */
+ dcb_config = 1;
+
+ /*set configuration of DCB in vt mode and DCB in non-vt mode*/
+ retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en);
+ if (retval < 0)
+ return retval;
+ port_conf.rxmode.hw_vlan_filter = 1;
+
+ /**
+ * Write the configuration into the device.
+ * Set the numbers of RX & TX queues to 0, so
+ * the RX & TX queues will not be setup.
+ */
+ (void)rte_eth_dev_configure(pid, 0, 0, &port_conf);
+
+ rte_eth_dev_info_get(pid, &rte_port->dev_info);
/* If dev_info.vmdq_pool_base is greater than 0,
* the queue id of vmdq pools is started after pf queues.
*/
- if (dcb_mode == DCB_VT_ENABLED && dev_info.vmdq_pool_base > 0) {
+ if (dcb_mode == DCB_VT_ENABLED &&
+ rte_port->dev_info.vmdq_pool_base > 0) {
printf("VMDQ_DCB multi-queue mode is nonsensical"
" for port %d.", pid);
return -1;
@@ -1982,13 +2003,18 @@ init_port_dcb_config(portid_t pid,
* and has the same number of rxq and txq in dcb mode
*/
if (dcb_mode == DCB_VT_ENABLED) {
- nb_rxq = dev_info.max_rx_queues;
- nb_txq = dev_info.max_tx_queues;
+ if (rte_port->dev_info.max_vfs > 0) {
+ nb_rxq = rte_port->dev_info.nb_rx_queues;
+ nb_txq = rte_port->dev_info.nb_tx_queues;
+ } else {
+ nb_rxq = rte_port->dev_info.max_rx_queues;
+ nb_txq = rte_port->dev_info.max_tx_queues;
+ }
} else {
/*if vt is disabled, use all pf queues */
- if (dev_info.vmdq_pool_base == 0) {
- nb_rxq = dev_info.max_rx_queues;
- nb_txq = dev_info.max_tx_queues;
+ if (rte_port->dev_info.vmdq_pool_base == 0) {
+ nb_rxq = rte_port->dev_info.max_rx_queues;
+ nb_txq = rte_port->dev_info.max_tx_queues;
} else {
nb_rxq = (queueid_t)num_tcs;
nb_txq = (queueid_t)num_tcs;
@@ -1997,16 +2023,6 @@ init_port_dcb_config(portid_t pid,
}
rx_free_thresh = 64;
- memset(&port_conf, 0, sizeof(struct rte_eth_conf));
- /* Enter DCB configuration status */
- dcb_config = 1;
-
- /*set configuration of DCB in vt mode and DCB in non-vt mode*/
- retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en);
- if (retval < 0)
- return retval;
-
- rte_port = &ports[pid];
memcpy(&rte_port->dev_conf, &port_conf, sizeof(struct rte_eth_conf));
rxtx_port_config(rte_port);