net/virtio: set default speed unknown
[dpdk.git] / app / test-pmd / config.c
index 3ac7d8f..418ea6d 100644 (file)
@@ -49,6 +49,7 @@
 #include <rte_pmd_bnxt.h>
 #endif
 #include <rte_gro.h>
+#include <rte_hexdump.h>
 
 #include "testpmd.h"
 
@@ -452,6 +453,8 @@ rx_queue_infos_display(portid_t port_id, uint16_t queue_id)
                (qinfo.conf.rx_deferred_start != 0) ? "on" : "off");
        printf("\nRX scattered packets: %s",
                (qinfo.scattered_rx != 0) ? "on" : "off");
+       if (qinfo.rx_buf_size != 0)
+               printf("\nRX buffer size: %hu", qinfo.rx_buf_size);
        printf("\nNumber of RXDs: %hu", qinfo.nb_desc);
 
        if (rte_eth_rx_burst_mode_get(port_id, queue_id, &mode) == 0)
@@ -630,7 +633,7 @@ port_infos_display(portid_t port_id)
                printf("\nmemory allocation on the socket: %u",port->socket_id);
 
        printf("\nLink status: %s\n", (link.link_status) ? ("up") : ("down"));
-       printf("Link speed: %u Mbps\n", (unsigned) link.link_speed);
+       printf("Link speed: %s\n", rte_eth_link_speed_to_str(link.link_speed));
        printf("Link duplex: %s\n", (link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
               ("full-duplex") : ("half-duplex"));
 
@@ -775,12 +778,128 @@ port_summary_display(portid_t port_id)
        if (ret != 0)
                return;
 
-       printf("%-4d %02X:%02X:%02X:%02X:%02X:%02X %-12s %-14s %-8s %uMbps\n",
+       printf("%-4d %02X:%02X:%02X:%02X:%02X:%02X %-12s %-14s %-8s %s\n",
                port_id, mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
                mac_addr.addr_bytes[2], mac_addr.addr_bytes[3],
                mac_addr.addr_bytes[4], mac_addr.addr_bytes[5], name,
                dev_info.driver_name, (link.link_status) ? ("up") : ("down"),
-               (unsigned int) link.link_speed);
+               rte_eth_link_speed_to_str(link.link_speed));
+}
+
+void
+port_eeprom_display(portid_t port_id)
+{
+       struct rte_dev_eeprom_info einfo;
+       int ret;
+       if (port_id_is_invalid(port_id, ENABLED_WARN)) {
+               print_valid_ports();
+               return;
+       }
+
+       int len_eeprom = rte_eth_dev_get_eeprom_length(port_id);
+       if (len_eeprom < 0) {
+               switch (len_eeprom) {
+               case -ENODEV:
+                       printf("port index %d invalid\n", port_id);
+                       break;
+               case -ENOTSUP:
+                       printf("operation not supported by device\n");
+                       break;
+               case -EIO:
+                       printf("device is removed\n");
+                       break;
+               default:
+                       printf("Unable to get EEPROM: %d\n", len_eeprom);
+                       break;
+               }
+               return;
+       }
+
+       char buf[len_eeprom];
+       einfo.offset = 0;
+       einfo.length = len_eeprom;
+       einfo.data = buf;
+
+       ret = rte_eth_dev_get_eeprom(port_id, &einfo);
+       if (ret != 0) {
+               switch (ret) {
+               case -ENODEV:
+                       printf("port index %d invalid\n", port_id);
+                       break;
+               case -ENOTSUP:
+                       printf("operation not supported by device\n");
+                       break;
+               case -EIO:
+                       printf("device is removed\n");
+                       break;
+               default:
+                       printf("Unable to get EEPROM: %d\n", ret);
+                       break;
+               }
+               return;
+       }
+       rte_hexdump(stdout, "hexdump", einfo.data, einfo.length);
+       printf("Finish -- Port: %d EEPROM length: %d bytes\n", port_id, len_eeprom);
+}
+
+void
+port_module_eeprom_display(portid_t port_id)
+{
+       struct rte_eth_dev_module_info minfo;
+       struct rte_dev_eeprom_info einfo;
+       int ret;
+
+       if (port_id_is_invalid(port_id, ENABLED_WARN)) {
+               print_valid_ports();
+               return;
+       }
+
+
+       ret = rte_eth_dev_get_module_info(port_id, &minfo);
+       if (ret != 0) {
+               switch (ret) {
+               case -ENODEV:
+                       printf("port index %d invalid\n", port_id);
+                       break;
+               case -ENOTSUP:
+                       printf("operation not supported by device\n");
+                       break;
+               case -EIO:
+                       printf("device is removed\n");
+                       break;
+               default:
+                       printf("Unable to get module EEPROM: %d\n", ret);
+                       break;
+               }
+               return;
+       }
+
+       char buf[minfo.eeprom_len];
+       einfo.offset = 0;
+       einfo.length = minfo.eeprom_len;
+       einfo.data = buf;
+
+       ret = rte_eth_dev_get_module_eeprom(port_id, &einfo);
+       if (ret != 0) {
+               switch (ret) {
+               case -ENODEV:
+                       printf("port index %d invalid\n", port_id);
+                       break;
+               case -ENOTSUP:
+                       printf("operation not supported by device\n");
+                       break;
+               case -EIO:
+                       printf("device is removed\n");
+                       break;
+               default:
+                       printf("Unable to get module EEPROM: %d\n", ret);
+                       break;
+               }
+               return;
+       }
+
+       rte_hexdump(stdout, "hexdump", einfo.data, einfo.length);
+       printf("Finish -- Port: %d MODULE EEPROM length: %d bytes\n", port_id, einfo.length);
 }
 
 void
@@ -1052,6 +1171,15 @@ port_offload_cap_display(portid_t port_id)
                        printf("off\n");
        }
 
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP) {
+               printf("Tx scheduling on timestamp:    ");
+               if (ports[port_id].dev_conf.txmode.offloads &
+                   DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
 }
 
 int
@@ -1412,11 +1540,12 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
        }
 
        printf("RSS:\n"
-              " queues: ");
+              " queues:");
        if (rss_conf->queue_num == 0)
-               printf("none\n");
+               printf(" none");
        for (i = 0; i < rss_conf->queue_num; i++)
-               printf("%d\n", rss_conf->queue[i]);
+               printf(" %d", rss_conf->queue[i]);
+       printf("\n");
 
        printf(" function: ");
        switch (rss_conf->func) {
@@ -1578,9 +1707,12 @@ int
 port_flow_flush(portid_t port_id)
 {
        struct rte_flow_error error;
-       struct rte_port *port;
+       struct rte_port *port = &ports[port_id];
        int ret = 0;
 
+       if (port->flow_list == NULL)
+               return ret;
+
        /* Poisoning to make sure PMDs update it in case of error. */
        memset(&error, 0x44, sizeof(error));
        if (rte_flow_flush(port_id, &error)) {
@@ -1589,7 +1721,7 @@ port_flow_flush(portid_t port_id)
                    port_id == (portid_t)RTE_PORT_ALL)
                        return ret;
        }
-       port = &ports[port_id];
+
        while (port->flow_list) {
                struct port_flow *pf = port->flow_list->next;
 
@@ -1881,22 +2013,102 @@ tx_queue_id_is_invalid(queueid_t txq_id)
 }
 
 static int
-rx_desc_id_is_invalid(uint16_t rxdesc_id)
+get_rx_ring_size(portid_t port_id, queueid_t rxq_id, uint16_t *ring_size)
+{
+       struct rte_port *port = &ports[port_id];
+       struct rte_eth_rxq_info rx_qinfo;
+       int ret;
+
+       ret = rte_eth_rx_queue_info_get(port_id, rxq_id, &rx_qinfo);
+       if (ret == 0) {
+               *ring_size = rx_qinfo.nb_desc;
+               return ret;
+       }
+
+       if (ret != -ENOTSUP)
+               return ret;
+       /*
+        * If the rte_eth_rx_queue_info_get is not support for this PMD,
+        * ring_size stored in testpmd will be used for validity verification.
+        * When configure the rxq by rte_eth_rx_queue_setup with nb_rx_desc
+        * being 0, it will use a default value provided by PMDs to setup this
+        * rxq. If the default value is 0, it will use the
+        * RTE_ETH_DEV_FALLBACK_RX_RINGSIZE to setup this rxq.
+        */
+       if (port->nb_rx_desc[rxq_id])
+               *ring_size = port->nb_rx_desc[rxq_id];
+       else if (port->dev_info.default_rxportconf.ring_size)
+               *ring_size = port->dev_info.default_rxportconf.ring_size;
+       else
+               *ring_size = RTE_ETH_DEV_FALLBACK_RX_RINGSIZE;
+       return 0;
+}
+
+static int
+get_tx_ring_size(portid_t port_id, queueid_t txq_id, uint16_t *ring_size)
 {
-       if (rxdesc_id < nb_rxd)
+       struct rte_port *port = &ports[port_id];
+       struct rte_eth_txq_info tx_qinfo;
+       int ret;
+
+       ret = rte_eth_tx_queue_info_get(port_id, txq_id, &tx_qinfo);
+       if (ret == 0) {
+               *ring_size = tx_qinfo.nb_desc;
+               return ret;
+       }
+
+       if (ret != -ENOTSUP)
+               return ret;
+       /*
+        * If the rte_eth_tx_queue_info_get is not support for this PMD,
+        * ring_size stored in testpmd will be used for validity verification.
+        * When configure the txq by rte_eth_tx_queue_setup with nb_tx_desc
+        * being 0, it will use a default value provided by PMDs to setup this
+        * txq. If the default value is 0, it will use the
+        * RTE_ETH_DEV_FALLBACK_TX_RINGSIZE to setup this txq.
+        */
+       if (port->nb_tx_desc[txq_id])
+               *ring_size = port->nb_tx_desc[txq_id];
+       else if (port->dev_info.default_txportconf.ring_size)
+               *ring_size = port->dev_info.default_txportconf.ring_size;
+       else
+               *ring_size = RTE_ETH_DEV_FALLBACK_TX_RINGSIZE;
+       return 0;
+}
+
+static int
+rx_desc_id_is_invalid(portid_t port_id, queueid_t rxq_id, uint16_t rxdesc_id)
+{
+       uint16_t ring_size;
+       int ret;
+
+       ret = get_rx_ring_size(port_id, rxq_id, &ring_size);
+       if (ret)
+               return 1;
+
+       if (rxdesc_id < ring_size)
                return 0;
-       printf("Invalid RX descriptor %d (must be < nb_rxd=%d)\n",
-              rxdesc_id, nb_rxd);
+
+       printf("Invalid RX descriptor %u (must be < ring_size=%u)\n",
+              rxdesc_id, ring_size);
        return 1;
 }
 
 static int
-tx_desc_id_is_invalid(uint16_t txdesc_id)
+tx_desc_id_is_invalid(portid_t port_id, queueid_t txq_id, uint16_t txdesc_id)
 {
-       if (txdesc_id < nb_txd)
+       uint16_t ring_size;
+       int ret;
+
+       ret = get_tx_ring_size(port_id, txq_id, &ring_size);
+       if (ret)
+               return 1;
+
+       if (txdesc_id < ring_size)
                return 0;
-       printf("Invalid TX descriptor %d (must be < nb_txd=%d)\n",
-              txdesc_id, nb_txd);
+
+       printf("Invalid TX descriptor %u (must be < ring_size=%u)\n",
+              txdesc_id, ring_size);
        return 1;
 }
 
@@ -2017,11 +2229,7 @@ rx_ring_desc_display(portid_t port_id, queueid_t rxq_id, uint16_t rxd_id)
 {
        const struct rte_memzone *rx_mz;
 
-       if (port_id_is_invalid(port_id, ENABLED_WARN))
-               return;
-       if (rx_queue_id_is_invalid(rxq_id))
-               return;
-       if (rx_desc_id_is_invalid(rxd_id))
+       if (rx_desc_id_is_invalid(port_id, rxq_id, rxd_id))
                return;
        rx_mz = ring_dma_zone_lookup("rx_ring", port_id, rxq_id);
        if (rx_mz == NULL)
@@ -2034,11 +2242,7 @@ tx_ring_desc_display(portid_t port_id, queueid_t txq_id, uint16_t txd_id)
 {
        const struct rte_memzone *tx_mz;
 
-       if (port_id_is_invalid(port_id, ENABLED_WARN))
-               return;
-       if (tx_queue_id_is_invalid(txq_id))
-               return;
-       if (tx_desc_id_is_invalid(txd_id))
+       if (tx_desc_id_is_invalid(port_id, txq_id, txd_id))
                return;
        tx_mz = ring_dma_zone_lookup("tx_ring", port_id, txq_id);
        if (tx_mz == NULL)
@@ -2079,10 +2283,17 @@ rxtx_config_display(void)
                struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf[0];
                uint16_t *nb_rx_desc = &ports[pid].nb_rx_desc[0];
                uint16_t *nb_tx_desc = &ports[pid].nb_tx_desc[0];
-               uint16_t nb_rx_desc_tmp;
-               uint16_t nb_tx_desc_tmp;
                struct rte_eth_rxq_info rx_qinfo;
                struct rte_eth_txq_info tx_qinfo;
+               uint16_t rx_free_thresh_tmp;
+               uint16_t tx_free_thresh_tmp;
+               uint16_t tx_rs_thresh_tmp;
+               uint16_t nb_rx_desc_tmp;
+               uint16_t nb_tx_desc_tmp;
+               uint64_t offloads_tmp;
+               uint8_t pthresh_tmp;
+               uint8_t hthresh_tmp;
+               uint8_t wthresh_tmp;
                int32_t rc;
 
                /* per port config */
@@ -2096,41 +2307,64 @@ rxtx_config_display(void)
                /* per rx queue config only for first queue to be less verbose */
                for (qid = 0; qid < 1; qid++) {
                        rc = rte_eth_rx_queue_info_get(pid, qid, &rx_qinfo);
-                       if (rc)
+                       if (rc) {
                                nb_rx_desc_tmp = nb_rx_desc[qid];
-                       else
+                               rx_free_thresh_tmp =
+                                       rx_conf[qid].rx_free_thresh;
+                               pthresh_tmp = rx_conf[qid].rx_thresh.pthresh;
+                               hthresh_tmp = rx_conf[qid].rx_thresh.hthresh;
+                               wthresh_tmp = rx_conf[qid].rx_thresh.wthresh;
+                               offloads_tmp = rx_conf[qid].offloads;
+                       } else {
                                nb_rx_desc_tmp = rx_qinfo.nb_desc;
+                               rx_free_thresh_tmp =
+                                               rx_qinfo.conf.rx_free_thresh;
+                               pthresh_tmp = rx_qinfo.conf.rx_thresh.pthresh;
+                               hthresh_tmp = rx_qinfo.conf.rx_thresh.hthresh;
+                               wthresh_tmp = rx_qinfo.conf.rx_thresh.wthresh;
+                               offloads_tmp = rx_qinfo.conf.offloads;
+                       }
 
                        printf("    RX queue: %d\n", qid);
                        printf("      RX desc=%d - RX free threshold=%d\n",
-                               nb_rx_desc_tmp, rx_conf[qid].rx_free_thresh);
+                               nb_rx_desc_tmp, rx_free_thresh_tmp);
                        printf("      RX threshold registers: pthresh=%d hthresh=%d "
                                " wthresh=%d\n",
-                               rx_conf[qid].rx_thresh.pthresh,
-                               rx_conf[qid].rx_thresh.hthresh,
-                               rx_conf[qid].rx_thresh.wthresh);
-                       printf("      RX Offloads=0x%"PRIx64"\n",
-                               rx_conf[qid].offloads);
+                               pthresh_tmp, hthresh_tmp, wthresh_tmp);
+                       printf("      RX Offloads=0x%"PRIx64"\n", offloads_tmp);
                }
 
                /* per tx queue config only for first queue to be less verbose */
                for (qid = 0; qid < 1; qid++) {
                        rc = rte_eth_tx_queue_info_get(pid, qid, &tx_qinfo);
-                       if (rc)
+                       if (rc) {
                                nb_tx_desc_tmp = nb_tx_desc[qid];
-                       else
+                               tx_free_thresh_tmp =
+                                       tx_conf[qid].tx_free_thresh;
+                               pthresh_tmp = tx_conf[qid].tx_thresh.pthresh;
+                               hthresh_tmp = tx_conf[qid].tx_thresh.hthresh;
+                               wthresh_tmp = tx_conf[qid].tx_thresh.wthresh;
+                               offloads_tmp = tx_conf[qid].offloads;
+                               tx_rs_thresh_tmp = tx_conf[qid].tx_rs_thresh;
+                       } else {
                                nb_tx_desc_tmp = tx_qinfo.nb_desc;
+                               tx_free_thresh_tmp =
+                                               tx_qinfo.conf.tx_free_thresh;
+                               pthresh_tmp = tx_qinfo.conf.tx_thresh.pthresh;
+                               hthresh_tmp = tx_qinfo.conf.tx_thresh.hthresh;
+                               wthresh_tmp = tx_qinfo.conf.tx_thresh.wthresh;
+                               offloads_tmp = tx_qinfo.conf.offloads;
+                               tx_rs_thresh_tmp = tx_qinfo.conf.tx_rs_thresh;
+                       }
 
                        printf("    TX queue: %d\n", qid);
                        printf("      TX desc=%d - TX free threshold=%d\n",
-                               nb_tx_desc_tmp, tx_conf[qid].tx_free_thresh);
+                               nb_tx_desc_tmp, tx_free_thresh_tmp);
                        printf("      TX threshold registers: pthresh=%d hthresh=%d "
                                " wthresh=%d\n",
-                               tx_conf[qid].tx_thresh.pthresh,
-                               tx_conf[qid].tx_thresh.hthresh,
-                               tx_conf[qid].tx_thresh.wthresh);
+                               pthresh_tmp, hthresh_tmp, wthresh_tmp);
                        printf("      TX offloads=0x%"PRIx64" - TX RS bit threshold=%d\n",
-                               tx_conf[qid].offloads, tx_conf->tx_rs_thresh);
+                               offloads_tmp, tx_rs_thresh_tmp);
                }
        }
 }
@@ -2565,55 +2799,6 @@ icmp_echo_config_setup(void)
        }
 }
 
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-static void
-softnic_fwd_config_setup(void)
-{
-       struct rte_port *port;
-       portid_t pid, softnic_portid;
-       queueid_t i;
-       uint8_t softnic_enable = 0;
-
-       RTE_ETH_FOREACH_DEV(pid) {
-                       port = &ports[pid];
-                       const char *driver = port->dev_info.driver_name;
-
-                       if (strcmp(driver, "net_softnic") == 0) {
-                               softnic_portid = pid;
-                               softnic_enable = 1;
-                               break;
-                       }
-       }
-
-       if (softnic_enable == 0) {
-               printf("Softnic mode not configured(%s)!\n", __func__);
-               return;
-       }
-
-       cur_fwd_config.nb_fwd_ports = 1;
-       cur_fwd_config.nb_fwd_streams = (streamid_t) nb_rxq;
-
-       /* Re-initialize forwarding streams */
-       init_fwd_streams();
-
-       /*
-        * In the softnic forwarding test, the number of forwarding cores
-        * is set to one and remaining are used for softnic packet processing.
-        */
-       cur_fwd_config.nb_fwd_lcores = 1;
-       setup_fwd_config_of_each_lcore(&cur_fwd_config);
-
-       for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) {
-               fwd_streams[i]->rx_port   = softnic_portid;
-               fwd_streams[i]->rx_queue  = i;
-               fwd_streams[i]->tx_port   = softnic_portid;
-               fwd_streams[i]->tx_queue  = i;
-               fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
-               fwd_streams[i]->retry_enabled = retry_enabled;
-       }
-}
-#endif
-
 void
 fwd_config_setup(void)
 {
@@ -2623,13 +2808,6 @@ fwd_config_setup(void)
                return;
        }
 
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-       if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
-               softnic_fwd_config_setup();
-               return;
-       }
-#endif
-
        if ((nb_rxq > 1) && (nb_txq > 1)){
                if (dcb_config)
                        dcb_fwd_config_setup();
@@ -3030,17 +3208,41 @@ show_tx_pkt_segments(void)
        printf("Split packet: %s\n", split);
 }
 
+static bool
+nb_segs_is_invalid(unsigned int nb_segs)
+{
+       uint16_t ring_size;
+       uint16_t queue_id;
+       uint16_t port_id;
+       int ret;
+
+       RTE_ETH_FOREACH_DEV(port_id) {
+               for (queue_id = 0; queue_id < nb_txq; queue_id++) {
+                       ret = get_tx_ring_size(port_id, queue_id, &ring_size);
+
+                       if (ret)
+                               return true;
+
+                       if (ring_size < nb_segs) {
+                               printf("nb segments per TX packets=%u >= "
+                                      "TX queue(%u) ring_size=%u - ignored\n",
+                                      nb_segs, queue_id, ring_size);
+                               return true;
+                       }
+               }
+       }
+
+       return false;
+}
+
 void
 set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs)
 {
        uint16_t tx_pkt_len;
        unsigned i;
 
-       if (nb_segs >= (unsigned) nb_txd) {
-               printf("nb segments per TX packets=%u >= nb_txd=%u - ignored\n",
-                      nb_segs, (unsigned int) nb_txd);
+       if (nb_segs_is_invalid(nb_segs))
                return;
-       }
 
        /*
         * Check that each segment length is greater or equal than
@@ -3072,6 +3274,58 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs)
        tx_pkt_nb_segs = (uint8_t) nb_segs;
 }
 
+void
+show_tx_pkt_times(void)
+{
+       printf("Interburst gap: %u\n", tx_pkt_times_inter);
+       printf("Intraburst gap: %u\n", tx_pkt_times_intra);
+}
+
+void
+set_tx_pkt_times(unsigned int *tx_times)
+{
+       uint16_t port_id;
+       int offload_found = 0;
+       int offset;
+       int flag;
+
+       static const struct rte_mbuf_dynfield desc_offs = {
+               .name = RTE_MBUF_DYNFIELD_TIMESTAMP_NAME,
+               .size = sizeof(uint64_t),
+               .align = __alignof__(uint64_t),
+       };
+       static const struct rte_mbuf_dynflag desc_flag = {
+               .name = RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME,
+       };
+
+       RTE_ETH_FOREACH_DEV(port_id) {
+               struct rte_eth_dev_info dev_info = { 0 };
+               int ret;
+
+               ret = rte_eth_dev_info_get(port_id, &dev_info);
+               if (ret == 0 && dev_info.tx_offload_capa &
+                               DEV_TX_OFFLOAD_SEND_ON_TIMESTAMP) {
+                       offload_found = 1;
+                       break;
+               }
+       }
+       if (!offload_found) {
+               printf("No device supporting Tx timestamp scheduling found, "
+                      "dynamic flag and field not registered\n");
+               return;
+       }
+       offset = rte_mbuf_dynfield_register(&desc_offs);
+       if (offset < 0 && rte_errno != EEXIST)
+               printf("Dynamic timestamp field registration error: %d",
+                      rte_errno);
+       flag = rte_mbuf_dynflag_register(&desc_flag);
+       if (flag < 0 && rte_errno != EEXIST)
+               printf("Dynamic timestamp flag registration error: %d",
+                      rte_errno);
+       tx_pkt_times_inter = tx_times[0];
+       tx_pkt_times_intra = tx_times[1];
+}
+
 void
 setup_gro(const char *onoff, portid_t port_id)
 {
@@ -3384,9 +3638,11 @@ vlan_extend_set(portid_t port_id, int on)
        }
 
        diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
-       if (diag < 0)
+       if (diag < 0) {
                printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed "
               "diag=%d\n", port_id, on, diag);
+               return;
+       }
        ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
 }
 
@@ -3411,9 +3667,11 @@ rx_vlan_strip_set(portid_t port_id, int on)
        }
 
        diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
-       if (diag < 0)
+       if (diag < 0) {
                printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed "
               "diag=%d\n", port_id, on, diag);
+               return;
+       }
        ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
 }
 
@@ -3452,9 +3710,11 @@ rx_vlan_filter_set(portid_t port_id, int on)
        }
 
        diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
-       if (diag < 0)
+       if (diag < 0) {
                printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed "
               "diag=%d\n", port_id, on, diag);
+               return;
+       }
        ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
 }
 
@@ -3479,9 +3739,11 @@ rx_vlan_qinq_strip_set(portid_t port_id, int on)
        }
 
        diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
-       if (diag < 0)
+       if (diag < 0) {
                printf("%s(port_pi=%d, on=%d) failed "
               "diag=%d\n", __func__, port_id, on, diag);
+               return;
+       }
        ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
 }
 
@@ -3539,8 +3801,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
        struct rte_eth_dev_info dev_info;
        int ret;
 
-       if (port_id_is_invalid(port_id, ENABLED_WARN))
-               return;
        if (vlan_id_is_invalid(vlan_id))
                return;
 
@@ -3571,8 +3831,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
        struct rte_eth_dev_info dev_info;
        int ret;
 
-       if (port_id_is_invalid(port_id, ENABLED_WARN))
-               return;
        if (vlan_id_is_invalid(vlan_id))
                return;
        if (vlan_id_is_invalid(vlan_id_outer))
@@ -3598,8 +3856,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 void
 tx_vlan_reset(portid_t port_id)
 {
-       if (port_id_is_invalid(port_id, ENABLED_WARN))
-               return;
        ports[port_id].dev_conf.txmode.offloads &=
                                ~(DEV_TX_OFFLOAD_VLAN_INSERT |
                                  DEV_TX_OFFLOAD_QINQ_INSERT);
@@ -3674,6 +3930,18 @@ set_xstats_hide_zero(uint8_t on_off)
        xstats_hide_zero = on_off;
 }
 
+void
+set_record_core_cycles(uint8_t on_off)
+{
+       record_core_cycles = on_off;
+}
+
+void
+set_record_burst_stats(uint8_t on_off)
+{
+       record_burst_stats = on_off;
+}
+
 static inline void
 print_fdir_mask(struct rte_eth_fdir_masks *mask)
 {
@@ -4014,7 +4282,8 @@ set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
        ret = eth_link_get_nowait_print_err(port_id, &link);
        if (ret < 0)
                return 1;
-       if (rate > link.link_speed) {
+       if (link.link_speed != ETH_SPEED_NUM_UNKNOWN &&
+           rate > link.link_speed) {
                printf("Invalid rate value:%u bigger than link speed: %u\n",
                        rate, link.link_speed);
                return 1;