app/testpmd: fix build with bypass without ixgbe
[dpdk.git] / app / test-pmd / cmdline.c
index 2e23e20..105c71f 100644 (file)
@@ -94,6 +94,9 @@
 #ifdef RTE_LIBRTE_I40E_PMD
 #include <rte_pmd_i40e.h>
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+#include <rte_pmd_bnxt.h>
+#endif
 #include "testpmd.h"
 
 static struct cmdline *testpmd_cl;
@@ -217,6 +220,12 @@ static void cmd_help_long_parsed(void *parsed_result,
 
                        "ddp get list (port_id)\n"
                        "    Get ddp profile info list\n\n"
+
+                       "show vf stats (port_id) (vf_id)\n"
+                       "    Display a VF's statistics.\n\n"
+
+                       "clear vf stats (port_id) (vf_id)\n"
+                       "    Reset a VF's statistics.\n\n"
                );
        }
 
@@ -330,6 +339,9 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "set tx strict-link-priority (port_id) (tc_bitmap)\n"
                        "    Set some TCs' strict link priority mode on a physical port.\n\n"
 
+                       "set tc tx min-bandwidth (port_id) (bw1, bw2, ...)\n"
+                       "    Set all TCs' min bandwidth(%%) for all PF and VFs.\n\n"
+
                        "vlan set filter (on|off) (port_id)\n"
                        "    Set the VLAN filter on a port.\n\n"
 
@@ -514,7 +526,6 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "   Flush (default) or don't flush RX streams before"
                        " forwarding. Mainly used with PCAP drivers.\n\n"
 
-                       #ifdef RTE_NIC_BYPASS
                        "set bypass mode (normal|bypass|isolate) (port_id)\n"
                        "   Set the bypass mode for the lowest port on bypass enabled"
                        " NIC.\n\n"
@@ -537,7 +548,7 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "show bypass config (port_id)\n"
                        "   Show the bypass configuration for a bypass enabled NIC"
                        " using the lowest port on the NIC.\n\n"
-#endif
+
 #ifdef RTE_LIBRTE_PMD_BOND
                        "create bonded device (mode) (socket)\n"
                        "       Create a new bonded device with specific bonding mode and socket.\n\n"
@@ -596,6 +607,18 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "ddp add (port_id) (profile_path)\n"
                        "    Load a profile package on a port\n\n"
 
+                       "ptype mapping get (port_id) (valid_only)\n"
+                       "    Get ptype mapping on a port\n\n"
+
+                       "ptype mapping replace (port_id) (target) (mask) (pky_type)\n"
+                       "    Replace target with the pkt_type in ptype mapping\n\n"
+
+                       "ptype mapping reset (port_id)\n"
+                       "    Reset ptype mapping on a port\n\n"
+
+                       "ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
+                       "    Update a ptype mapping item on a port\n\n"
+
                        , list_pkt_forwarding_modes()
                );
        }
@@ -883,6 +906,10 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "flow list {port_id} [group {group_id}] [...]\n"
                        "    List existing flow rules sorted by priority,"
                        " filtered by group identifiers.\n\n"
+
+                       "flow isolate {port_id} {boolean}\n"
+                       "    Restrict ingress traffic to the defined"
+                       " flow rules\n\n"
                );
        }
 }
@@ -1160,7 +1187,7 @@ cmd_config_speed_all_parsed(void *parsed_result,
                        &link_speed) < 0)
                return;
 
-       FOREACH_PORT(pid, ports) {
+       RTE_ETH_FOREACH_DEV(pid) {
                ports[pid].dev_conf.link_speeds = link_speed;
        }
 
@@ -3883,7 +3910,6 @@ cmdline_parse_inst_t cmd_set_link_check = {
        },
 };
 
-#ifdef RTE_NIC_BYPASS
 /* *** SET NIC BYPASS MODE *** */
 struct cmd_set_bypass_mode_result {
        cmdline_fixed_string_t set;
@@ -3900,19 +3926,23 @@ cmd_set_bypass_mode_parsed(void *parsed_result,
 {
        struct cmd_set_bypass_mode_result *res = parsed_result;
        portid_t port_id = res->port_id;
-       uint32_t bypass_mode = RTE_BYPASS_MODE_NORMAL;
+       int32_t rc = -EINVAL;
+
+#if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS
+       uint32_t bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_NORMAL;
 
        if (!strcmp(res->value, "bypass"))
-               bypass_mode = RTE_BYPASS_MODE_BYPASS;
+               bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_BYPASS;
        else if (!strcmp(res->value, "isolate"))
-               bypass_mode = RTE_BYPASS_MODE_ISOLATE;
+               bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_ISOLATE;
        else
-               bypass_mode = RTE_BYPASS_MODE_NORMAL;
+               bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_NORMAL;
 
        /* Set the bypass mode for the relevant port. */
-       if (0 != rte_eth_dev_bypass_state_set(port_id, &bypass_mode)) {
+       rc = rte_pmd_ixgbe_bypass_state_set(port_id, &bypass_mode);
+#endif
+       if (rc != 0)
                printf("\t Failed to set bypass mode for port = %d.\n", port_id);
-       }
 }
 
 cmdline_parse_token_string_t cmd_setbypass_mode_set =
@@ -3962,51 +3992,57 @@ cmd_set_bypass_event_parsed(void *parsed_result,
                __attribute__((unused)) struct cmdline *cl,
                __attribute__((unused)) void *data)
 {
-       int32_t rc;
+       int32_t rc = -EINVAL;
        struct cmd_set_bypass_event_result *res = parsed_result;
        portid_t port_id = res->port_id;
-       uint32_t bypass_event = RTE_BYPASS_EVENT_NONE;
-       uint32_t bypass_mode = RTE_BYPASS_MODE_NORMAL;
+
+#if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS
+       uint32_t bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_NONE;
+       uint32_t bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_NORMAL;
 
        if (!strcmp(res->event_value, "timeout"))
-               bypass_event = RTE_BYPASS_EVENT_TIMEOUT;
+               bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT;
        else if (!strcmp(res->event_value, "os_on"))
-               bypass_event = RTE_BYPASS_EVENT_OS_ON;
+               bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_OS_ON;
        else if (!strcmp(res->event_value, "os_off"))
-               bypass_event = RTE_BYPASS_EVENT_OS_OFF;
+               bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_OS_OFF;
        else if (!strcmp(res->event_value, "power_on"))
-               bypass_event = RTE_BYPASS_EVENT_POWER_ON;
+               bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_POWER_ON;
        else if (!strcmp(res->event_value, "power_off"))
-               bypass_event = RTE_BYPASS_EVENT_POWER_OFF;
+               bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_POWER_OFF;
        else
-               bypass_event = RTE_BYPASS_EVENT_NONE;
+               bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_NONE;
 
        if (!strcmp(res->mode_value, "bypass"))
-               bypass_mode = RTE_BYPASS_MODE_BYPASS;
+               bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_BYPASS;
        else if (!strcmp(res->mode_value, "isolate"))
-               bypass_mode = RTE_BYPASS_MODE_ISOLATE;
+               bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_ISOLATE;
        else
-               bypass_mode = RTE_BYPASS_MODE_NORMAL;
+               bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_NORMAL;
 
        /* Set the watchdog timeout. */
-       if (bypass_event == RTE_BYPASS_EVENT_TIMEOUT) {
+       if (bypass_event == RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT) {
 
                rc = -EINVAL;
-               if (!RTE_BYPASS_TMT_VALID(bypass_timeout) ||
-                               (rc = rte_eth_dev_wd_timeout_store(port_id,
-                               bypass_timeout)) != 0) {
+               if (RTE_PMD_IXGBE_BYPASS_TMT_VALID(bypass_timeout)) {
+                       rc = rte_pmd_ixgbe_bypass_wd_timeout_store(port_id,
+                                                          bypass_timeout);
+               }
+               if (rc != 0) {
                        printf("Failed to set timeout value %u "
-                               "for port %d, errto code: %d.\n",
-                               bypass_timeout, port_id, rc);
+                       "for port %d, errto code: %d.\n",
+                       bypass_timeout, port_id, rc);
                }
        }
 
        /* Set the bypass event to transition to bypass mode. */
-       if (0 != rte_eth_dev_bypass_event_store(port_id,
-                       bypass_event, bypass_mode)) {
-               printf("\t Failed to set bypass event for port = %d.\n", port_id);
-       }
+       rc = rte_pmd_ixgbe_bypass_event_store(port_id, bypass_event,
+                                             bypass_mode);
+#endif
 
+       if (rc != 0)
+               printf("\t Failed to set bypass event for port = %d.\n",
+                      port_id);
 }
 
 cmdline_parse_token_string_t cmd_setbypass_event_set =
@@ -4063,24 +4099,26 @@ cmd_set_bypass_timeout_parsed(void *parsed_result,
                __attribute__((unused)) struct cmdline *cl,
                __attribute__((unused)) void *data)
 {
-       struct cmd_set_bypass_timeout_result *res = parsed_result;
+       __rte_unused struct cmd_set_bypass_timeout_result *res = parsed_result;
 
+#if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS
        if (!strcmp(res->value, "1.5"))
-               bypass_timeout = RTE_BYPASS_TMT_1_5_SEC;
+               bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_1_5_SEC;
        else if (!strcmp(res->value, "2"))
-               bypass_timeout = RTE_BYPASS_TMT_2_SEC;
+               bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_2_SEC;
        else if (!strcmp(res->value, "3"))
-               bypass_timeout = RTE_BYPASS_TMT_3_SEC;
+               bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_3_SEC;
        else if (!strcmp(res->value, "4"))
-               bypass_timeout = RTE_BYPASS_TMT_4_SEC;
+               bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_4_SEC;
        else if (!strcmp(res->value, "8"))
-               bypass_timeout = RTE_BYPASS_TMT_8_SEC;
+               bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_8_SEC;
        else if (!strcmp(res->value, "16"))
-               bypass_timeout = RTE_BYPASS_TMT_16_SEC;
+               bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_16_SEC;
        else if (!strcmp(res->value, "32"))
-               bypass_timeout = RTE_BYPASS_TMT_32_SEC;
+               bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_32_SEC;
        else
-               bypass_timeout = RTE_BYPASS_TMT_OFF;
+               bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_OFF;
+#endif
 }
 
 cmdline_parse_token_string_t cmd_setbypass_timeout_set =
@@ -4124,17 +4162,19 @@ cmd_show_bypass_config_parsed(void *parsed_result,
                __attribute__((unused)) void *data)
 {
        struct cmd_show_bypass_config_result *res = parsed_result;
+       portid_t port_id = res->port_id;
+       int rc = -EINVAL;
+#if defined RTE_LIBRTE_IXGBE_PMD && defined RTE_LIBRTE_IXGBE_BYPASS
        uint32_t event_mode;
        uint32_t bypass_mode;
-       portid_t port_id = res->port_id;
        uint32_t timeout = bypass_timeout;
        int i;
 
-       static const char * const timeouts[RTE_BYPASS_TMT_NUM] =
+       static const char * const timeouts[RTE_PMD_IXGBE_BYPASS_TMT_NUM] =
                {"off", "1.5", "2", "3", "4", "8", "16", "32"};
-       static const char * const modes[RTE_BYPASS_MODE_NUM] =
+       static const char * const modes[RTE_PMD_IXGBE_BYPASS_MODE_NUM] =
                {"UNKNOWN", "normal", "bypass", "isolate"};
-       static const char * const events[RTE_BYPASS_EVENT_NUM] = {
+       static const char * const events[RTE_PMD_IXGBE_BYPASS_EVENT_NUM] = {
                "NONE",
                "OS/board on",
                "power supply on",
@@ -4144,37 +4184,41 @@ cmd_show_bypass_config_parsed(void *parsed_result,
        int num_events = (sizeof events) / (sizeof events[0]);
 
        /* Display the bypass mode.*/
-       if (0 != rte_eth_dev_bypass_state_show(port_id, &bypass_mode)) {
+       if (rte_pmd_ixgbe_bypass_state_show(port_id, &bypass_mode) != 0) {
                printf("\tFailed to get bypass mode for port = %d\n", port_id);
                return;
        }
        else {
-               if (!RTE_BYPASS_MODE_VALID(bypass_mode))
-                       bypass_mode = RTE_BYPASS_MODE_NONE;
+               if (!RTE_PMD_IXGBE_BYPASS_MODE_VALID(bypass_mode))
+                       bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_NONE;
 
                printf("\tbypass mode    = %s\n",  modes[bypass_mode]);
        }
 
        /* Display the bypass timeout.*/
-       if (!RTE_BYPASS_TMT_VALID(timeout))
-               timeout = RTE_BYPASS_TMT_OFF;
+       if (!RTE_PMD_IXGBE_BYPASS_TMT_VALID(timeout))
+               timeout = RTE_PMD_IXGBE_BYPASS_TMT_OFF;
 
        printf("\tbypass timeout = %s\n", timeouts[timeout]);
 
        /* Display the bypass events and associated modes. */
-       for (i = RTE_BYPASS_EVENT_START; i < num_events; i++) {
+       for (i = RTE_PMD_IXGBE_BYPASS_EVENT_START; i < num_events; i++) {
 
-               if (0 != rte_eth_dev_bypass_event_show(port_id, i, &event_mode)) {
+               if (rte_pmd_ixgbe_bypass_event_show(port_id, i, &event_mode)) {
                        printf("\tFailed to get bypass mode for event = %s\n",
                                events[i]);
                } else {
-                       if (!RTE_BYPASS_MODE_VALID(event_mode))
-                               event_mode = RTE_BYPASS_MODE_NONE;
+                       if (!RTE_PMD_IXGBE_BYPASS_MODE_VALID(event_mode))
+                               event_mode = RTE_PMD_IXGBE_BYPASS_MODE_NONE;
 
                        printf("\tbypass event: %-16s = %s\n", events[i],
                                modes[event_mode]);
                }
        }
+#endif
+       if (rc != 0)
+               printf("\tFailed to get bypass configuration for port = %d\n",
+                      port_id);
 }
 
 cmdline_parse_token_string_t cmd_showbypass_config_show =
@@ -4203,7 +4247,6 @@ cmdline_parse_inst_t cmd_show_bypass_config = {
                NULL,
        },
 };
-#endif
 
 #ifdef RTE_LIBRTE_PMD_BOND
 /* *** SET BONDING MODE *** */
@@ -4664,7 +4707,6 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
                nb_ports = rte_eth_dev_count();
                reconfig(port_id, res->socket);
                rte_eth_promiscuous_enable(port_id);
-               ports[port_id].enabled = 1;
        }
 
 }
@@ -5023,7 +5065,7 @@ static void cmd_set_promisc_mode_parsed(void *parsed_result,
 
        /* all ports */
        if (allports) {
-               FOREACH_PORT(i, ports) {
+               RTE_ETH_FOREACH_DEV(i) {
                        if (enable)
                                rte_eth_promiscuous_enable(i);
                        else
@@ -5103,7 +5145,7 @@ static void cmd_set_allmulti_mode_parsed(void *parsed_result,
 
        /* all ports */
        if (allports) {
-               FOREACH_PORT(i, ports) {
+               RTE_ETH_FOREACH_DEV(i) {
                        if (enable)
                                rte_eth_allmulticast_enable(i);
                        else
@@ -5837,31 +5879,31 @@ static void cmd_showportall_parsed(void *parsed_result,
        struct cmd_showportall_result *res = parsed_result;
        if (!strcmp(res->show, "clear")) {
                if (!strcmp(res->what, "stats"))
-                       FOREACH_PORT(i, ports)
+                       RTE_ETH_FOREACH_DEV(i)
                                nic_stats_clear(i);
                else if (!strcmp(res->what, "xstats"))
-                       FOREACH_PORT(i, ports)
+                       RTE_ETH_FOREACH_DEV(i)
                                nic_xstats_clear(i);
        } else if (!strcmp(res->what, "info"))
-               FOREACH_PORT(i, ports)
+               RTE_ETH_FOREACH_DEV(i)
                        port_infos_display(i);
        else if (!strcmp(res->what, "stats"))
-               FOREACH_PORT(i, ports)
+               RTE_ETH_FOREACH_DEV(i)
                        nic_stats_display(i);
        else if (!strcmp(res->what, "xstats"))
-               FOREACH_PORT(i, ports)
+               RTE_ETH_FOREACH_DEV(i)
                        nic_xstats_display(i);
        else if (!strcmp(res->what, "fdir"))
-               FOREACH_PORT(i, ports)
+               RTE_ETH_FOREACH_DEV(i)
                        fdir_get_infos(i);
        else if (!strcmp(res->what, "stat_qmap"))
-               FOREACH_PORT(i, ports)
+               RTE_ETH_FOREACH_DEV(i)
                        nic_stats_mapping_display(i);
        else if (!strcmp(res->what, "dcb_tc"))
-               FOREACH_PORT(i, ports)
+               RTE_ETH_FOREACH_DEV(i)
                        port_dcb_info_display(i);
        else if (!strcmp(res->what, "cap"))
-               FOREACH_PORT(i, ports)
+               RTE_ETH_FOREACH_DEV(i)
                        port_offload_cap_display(i);
 }
 
@@ -6761,6 +6803,7 @@ cmdline_parse_inst_t cmd_set_vf_traffic = {
                NULL,
        },
 };
+#endif /* RTE_LIBRTE_IXGBE_PMD */
 
 /* *** CONFIGURE VF RECEIVE MODE *** */
 struct cmd_set_vf_rxmode {
@@ -6779,7 +6822,7 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
                       __attribute__((unused)) struct cmdline *cl,
                       __attribute__((unused)) void *data)
 {
-       int ret;
+       int ret = -ENOTSUP;
        uint16_t rx_mode = 0;
        struct cmd_set_vf_rxmode *res = parsed_result;
 
@@ -6795,7 +6838,16 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
                        rx_mode |= ETH_VMDQ_ACCEPT_MULTICAST;
        }
 
-       ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id, rx_mode, (uint8_t)is_on);
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_ixgbe_set_vf_rxmode(res->port_id, res->vf_id,
+                                                 rx_mode, (uint8_t)is_on);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_set_vf_rxmode(res->port_id, res->vf_id,
+                                                rx_mode, (uint8_t)is_on);
+#endif
        if (ret < 0)
                printf("bad VF receive mode parameter, return code = %d \n",
                ret);
@@ -6843,7 +6895,6 @@ cmdline_parse_inst_t cmd_set_vf_rxmode = {
                NULL,
        },
 };
-#endif
 
 /* *** ADD MAC ADDRESS FILTER FOR A VF OF A PORT *** */
 struct cmd_vf_mac_addr_result {
@@ -6941,6 +6992,11 @@ cmd_vf_rx_vlan_filter_parsed(void *parsed_result,
                ret = rte_pmd_i40e_set_vf_vlan_filter(res->port_id,
                                res->vlan_id, res->vf_mask, is_add);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_set_vf_vlan_filter(res->port_id,
+                               res->vlan_id, res->vf_mask, is_add);
+#endif
 
        switch (ret) {
        case 0:
@@ -7066,7 +7122,6 @@ cmdline_parse_inst_t cmd_queue_rate_limit = {
        },
 };
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** SET RATE LIMIT FOR A VF OF A PORT *** */
 struct cmd_vf_rate_limit_result {
        cmdline_fixed_string_t set;
@@ -7145,7 +7200,6 @@ cmdline_parse_inst_t cmd_vf_rate_limit = {
                NULL,
        },
 };
-#endif
 
 /* *** ADD TUNNEL FILTER OF A PORT *** */
 struct cmd_tunnel_filter_result {
@@ -7699,6 +7753,8 @@ static void cmd_dump_parsed(void *parsed_result,
                rte_mempool_list_dump(stdout);
        else if (!strcmp(res->dump, "dump_devargs"))
                rte_eal_devargs_dump(stdout);
+       else if (!strcmp(res->dump, "dump_log_types"))
+               rte_log_dump(stdout);
 }
 
 cmdline_parse_token_string_t cmd_dump_dump =
@@ -7708,7 +7764,8 @@ cmdline_parse_token_string_t cmd_dump_dump =
                "dump_struct_sizes#"
                "dump_ring#"
                "dump_mempool#"
-               "dump_devargs");
+               "dump_devargs#"
+               "dump_log_types");
 
 cmdline_parse_inst_t cmd_dump = {
        .f = cmd_dump_parsed,  /* function to call */
@@ -8718,6 +8775,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
        case RTE_ETH_FLOW_FRAG_IPV4:
        case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
                entry.input.flow.ip4_flow.proto = res->proto_value;
+               /* fall-through */
        case RTE_ETH_FLOW_NONFRAG_IPV4_UDP:
        case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
                IPV4_ADDR_TO_UINT(res->ip_dst,
@@ -8750,6 +8808,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
        case RTE_ETH_FLOW_FRAG_IPV6:
        case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER:
                entry.input.flow.ipv6_flow.proto = res->proto_value;
+               /* fall-through */
        case RTE_ETH_FLOW_NONFRAG_IPV6_UDP:
        case RTE_ETH_FLOW_NONFRAG_IPV6_TCP:
                IPV6_ADDR_TO_ARRAY(res->ip_dst,
@@ -10341,7 +10400,7 @@ cmd_config_l2_tunnel_eth_type_all_parsed
        entry.l2_tunnel_type = str2fdir_l2_tunnel_type(res->l2_tunnel_type);
        entry.ether_type = res->eth_type_val;
 
-       FOREACH_PORT(pid, ports) {
+       RTE_ETH_FOREACH_DEV(pid) {
                rte_eth_dev_l2_tunnel_eth_type_conf(pid, &entry);
        }
 }
@@ -10457,7 +10516,7 @@ cmd_config_l2_tunnel_en_dis_all_parsed(
        else
                en = 0;
 
-       FOREACH_PORT(pid, ports) {
+       RTE_ETH_FOREACH_DEV(pid) {
                rte_eth_dev_l2_tunnel_offload_set(pid,
                                                  &entry,
                                                  ETH_L2_TUNNEL_ENABLE_MASK,
@@ -10987,6 +11046,11 @@ cmd_set_vf_vlan_anti_spoof_parsed(
                ret = rte_pmd_i40e_set_vf_vlan_anti_spoof(res->port_id,
                                res->vf_id, is_on);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_set_vf_vlan_anti_spoof(res->port_id,
+                               res->vf_id, is_on);
+#endif
 
        switch (ret) {
        case 0:
@@ -11088,6 +11152,11 @@ cmd_set_vf_mac_anti_spoof_parsed(
                ret = rte_pmd_i40e_set_vf_mac_anti_spoof(res->port_id,
                        res->vf_id, is_on);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_set_vf_mac_anti_spoof(res->port_id,
+                       res->vf_id, is_on);
+#endif
 
        switch (ret) {
        case 0:
@@ -11189,6 +11258,11 @@ cmd_set_vf_vlan_stripq_parsed(
                ret = rte_pmd_i40e_set_vf_vlan_stripq(res->port_id,
                        res->vf_id, is_on);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_set_vf_vlan_stripq(res->port_id,
+                       res->vf_id, is_on);
+#endif
 
        switch (ret) {
        case 0:
@@ -11288,6 +11362,11 @@ cmd_set_vf_vlan_insert_parsed(
                ret = rte_pmd_i40e_set_vf_vlan_insert(res->port_id, res->vf_id,
                        res->vlan_id);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_set_vf_vlan_insert(res->port_id, res->vf_id,
+                       res->vlan_id);
+#endif
 
        switch (ret) {
        case 0:
@@ -11377,6 +11456,10 @@ cmd_set_tx_loopback_parsed(
        if (ret == -ENOTSUP)
                ret = rte_pmd_i40e_set_tx_loopback(res->port_id, is_on);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_set_tx_loopback(res->port_id, is_on);
+#endif
 
        switch (ret) {
        case 0:
@@ -11409,7 +11492,6 @@ cmdline_parse_inst_t cmd_set_tx_loopback = {
        },
 };
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
 /* all queues drop enable configuration */
 
 /* Common result structure for all queues drop enable */
@@ -11455,13 +11537,20 @@ cmd_set_all_queues_drop_en_parsed(
        __attribute__((unused)) void *data)
 {
        struct cmd_all_queues_drop_en_result *res = parsed_result;
-       int ret = 0;
+       int ret = -ENOTSUP;
        int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
 
        if (port_id_is_invalid(res->port_id, ENABLED_WARN))
                return;
 
-       ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on);
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_set_all_queues_drop_en(res->port_id, is_on);
+#endif
        switch (ret) {
        case 0:
                break;
@@ -11494,6 +11583,7 @@ cmdline_parse_inst_t cmd_set_all_queues_drop_en = {
        },
 };
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 /* vf split drop enable configuration */
 
 /* Common result structure for vf split drop enable */
@@ -11648,6 +11738,11 @@ cmd_set_vf_mac_addr_parsed(
                ret = rte_pmd_i40e_set_vf_mac_addr(res->port_id, res->vf_id,
                                &res->mac_addr);
 #endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_set_vf_mac_addr(res->port_id, res->vf_id,
+                               &res->mac_addr);
+#endif
 
        switch (ret) {
        case 0:
@@ -12644,6 +12739,68 @@ cmdline_parse_inst_t cmd_vf_tc_min_bw = {
        },
 };
 
+static void
+cmd_tc_min_bw_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_vf_tc_bw_result *res = parsed_result;
+       struct rte_port *port;
+       uint8_t tc_num;
+       uint8_t bw[16];
+       int ret = -ENOTSUP;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+       port = &ports[res->port_id];
+       /** Check if the port is not started **/
+       if (port->port_status != RTE_PORT_STOPPED) {
+               printf("Please stop port %d first\n", res->port_id);
+               return;
+       }
+
+       ret = vf_tc_min_bw_parse_bw_list(bw, &tc_num, res->bw_list);
+       if (ret)
+               return;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       ret = rte_pmd_ixgbe_set_tc_bw_alloc(res->port_id, tc_num, bw);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid bandwidth\n");
+               break;
+       case -ENODEV:
+               printf("invalid port_id %d\n", res->port_id);
+               break;
+       case -ENOTSUP:
+               printf("function not implemented\n");
+               break;
+       default:
+               printf("programming error: (%s)\n", strerror(-ret));
+       }
+}
+
+cmdline_parse_inst_t cmd_tc_min_bw = {
+       .f = cmd_tc_min_bw_parsed,
+       .data = NULL,
+       .help_str = "set tc tx min-bandwidth <port_id> <bw1, bw2, ...>",
+       .tokens = {
+               (void *)&cmd_vf_tc_bw_set,
+               (void *)&cmd_vf_tc_bw_tc,
+               (void *)&cmd_vf_tc_bw_tx,
+               (void *)&cmd_vf_tc_bw_min_bw,
+               (void *)&cmd_vf_tc_bw_port_id,
+               (void *)&cmd_vf_tc_bw_bw_list,
+               NULL,
+       },
+};
+
 /* TC max bandwidth setting */
 static void
 cmd_vf_tc_max_bw_parsed(
@@ -12904,6 +13061,593 @@ cmdline_parse_inst_t cmd_ddp_get_list = {
                NULL,
        },
 };
+
+/* show vf stats */
+
+/* Common result structure for show vf stats */
+struct cmd_show_vf_stats_result {
+       cmdline_fixed_string_t show;
+       cmdline_fixed_string_t vf;
+       cmdline_fixed_string_t stats;
+       uint8_t port_id;
+       uint16_t vf_id;
+};
+
+/* Common CLI fields show vf stats*/
+cmdline_parse_token_string_t cmd_show_vf_stats_show =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_show_vf_stats_result,
+                show, "show");
+cmdline_parse_token_string_t cmd_show_vf_stats_vf =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_show_vf_stats_result,
+                vf, "vf");
+cmdline_parse_token_string_t cmd_show_vf_stats_stats =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_show_vf_stats_result,
+                stats, "stats");
+cmdline_parse_token_num_t cmd_show_vf_stats_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_show_vf_stats_result,
+                port_id, UINT8);
+cmdline_parse_token_num_t cmd_show_vf_stats_vf_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_show_vf_stats_result,
+                vf_id, UINT16);
+
+static void
+cmd_show_vf_stats_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_show_vf_stats_result *res = parsed_result;
+       struct rte_eth_stats stats;
+       int ret = -ENOTSUP;
+       static const char *nic_stats_border = "########################";
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+       memset(&stats, 0, sizeof(stats));
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_i40e_get_vf_stats(res->port_id,
+                                               res->vf_id,
+                                               &stats);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_get_vf_stats(res->port_id,
+                                               res->vf_id,
+                                               &stats);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid vf_id %d\n", res->vf_id);
+               break;
+       case -ENODEV:
+               printf("invalid port_id %d\n", res->port_id);
+               break;
+       case -ENOTSUP:
+               printf("function not implemented\n");
+               break;
+       default:
+               printf("programming error: (%s)\n", strerror(-ret));
+       }
+
+       printf("\n  %s NIC statistics for port %-2d vf %-2d %s\n",
+               nic_stats_border, res->port_id, res->vf_id, nic_stats_border);
+
+       printf("  RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-bytes:  "
+              "%-"PRIu64"\n",
+              stats.ipackets, stats.imissed, stats.ibytes);
+       printf("  RX-errors: %-"PRIu64"\n", stats.ierrors);
+       printf("  RX-nombuf:  %-10"PRIu64"\n",
+              stats.rx_nombuf);
+       printf("  TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-bytes:  "
+              "%-"PRIu64"\n",
+              stats.opackets, stats.oerrors, stats.obytes);
+
+       printf("  %s############################%s\n",
+                              nic_stats_border, nic_stats_border);
+}
+
+cmdline_parse_inst_t cmd_show_vf_stats = {
+       .f = cmd_show_vf_stats_parsed,
+       .data = NULL,
+       .help_str = "show vf stats <port_id> <vf_id>",
+       .tokens = {
+               (void *)&cmd_show_vf_stats_show,
+               (void *)&cmd_show_vf_stats_vf,
+               (void *)&cmd_show_vf_stats_stats,
+               (void *)&cmd_show_vf_stats_port_id,
+               (void *)&cmd_show_vf_stats_vf_id,
+               NULL,
+       },
+};
+
+/* clear vf stats */
+
+/* Common result structure for clear vf stats */
+struct cmd_clear_vf_stats_result {
+       cmdline_fixed_string_t clear;
+       cmdline_fixed_string_t vf;
+       cmdline_fixed_string_t stats;
+       uint8_t port_id;
+       uint16_t vf_id;
+};
+
+/* Common CLI fields clear vf stats*/
+cmdline_parse_token_string_t cmd_clear_vf_stats_clear =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_clear_vf_stats_result,
+                clear, "clear");
+cmdline_parse_token_string_t cmd_clear_vf_stats_vf =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_clear_vf_stats_result,
+                vf, "vf");
+cmdline_parse_token_string_t cmd_clear_vf_stats_stats =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_clear_vf_stats_result,
+                stats, "stats");
+cmdline_parse_token_num_t cmd_clear_vf_stats_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_clear_vf_stats_result,
+                port_id, UINT8);
+cmdline_parse_token_num_t cmd_clear_vf_stats_vf_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_clear_vf_stats_result,
+                vf_id, UINT16);
+
+static void
+cmd_clear_vf_stats_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_clear_vf_stats_result *res = parsed_result;
+       int ret = -ENOTSUP;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_i40e_reset_vf_stats(res->port_id,
+                                                 res->vf_id);
+#endif
+#ifdef RTE_LIBRTE_BNXT_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_bnxt_reset_vf_stats(res->port_id,
+                                                 res->vf_id);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid vf_id %d\n", res->vf_id);
+               break;
+       case -ENODEV:
+               printf("invalid port_id %d\n", res->port_id);
+               break;
+       case -ENOTSUP:
+               printf("function not implemented\n");
+               break;
+       default:
+               printf("programming error: (%s)\n", strerror(-ret));
+       }
+}
+
+cmdline_parse_inst_t cmd_clear_vf_stats = {
+       .f = cmd_clear_vf_stats_parsed,
+       .data = NULL,
+       .help_str = "clear vf stats <port_id> <vf_id>",
+       .tokens = {
+               (void *)&cmd_clear_vf_stats_clear,
+               (void *)&cmd_clear_vf_stats_vf,
+               (void *)&cmd_clear_vf_stats_stats,
+               (void *)&cmd_clear_vf_stats_port_id,
+               (void *)&cmd_clear_vf_stats_vf_id,
+               NULL,
+       },
+};
+
+/* ptype mapping get */
+
+/* Common result structure for ptype mapping get */
+struct cmd_ptype_mapping_get_result {
+       cmdline_fixed_string_t ptype;
+       cmdline_fixed_string_t mapping;
+       cmdline_fixed_string_t get;
+       uint8_t port_id;
+       uint8_t valid_only;
+};
+
+/* Common CLI fields for ptype mapping get */
+cmdline_parse_token_string_t cmd_ptype_mapping_get_ptype =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_get_result,
+                ptype, "ptype");
+cmdline_parse_token_string_t cmd_ptype_mapping_get_mapping =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_get_result,
+                mapping, "mapping");
+cmdline_parse_token_string_t cmd_ptype_mapping_get_get =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_get_result,
+                get, "get");
+cmdline_parse_token_num_t cmd_ptype_mapping_get_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_ptype_mapping_get_result,
+                port_id, UINT8);
+cmdline_parse_token_num_t cmd_ptype_mapping_get_valid_only =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_ptype_mapping_get_result,
+                valid_only, UINT8);
+
+static void
+cmd_ptype_mapping_get_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_ptype_mapping_get_result *res = parsed_result;
+       int ret = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+       int max_ptype_num = 256;
+       struct rte_pmd_i40e_ptype_mapping mapping[max_ptype_num];
+       uint16_t count;
+       int i;
+#endif
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       ret = rte_pmd_i40e_ptype_mapping_get(res->port_id,
+                                       mapping,
+                                       max_ptype_num,
+                                       &count,
+                                       res->valid_only);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -ENODEV:
+               printf("invalid port_id %d\n", res->port_id);
+               break;
+       case -ENOTSUP:
+               printf("function not implemented\n");
+               break;
+       default:
+               printf("programming error: (%s)\n", strerror(-ret));
+       }
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (!ret) {
+               for (i = 0; i < count; i++)
+                       printf("%3d\t0x%08x\n",
+                               mapping[i].hw_ptype, mapping[i].sw_ptype);
+       }
+#endif
+}
+
+cmdline_parse_inst_t cmd_ptype_mapping_get = {
+       .f = cmd_ptype_mapping_get_parsed,
+       .data = NULL,
+       .help_str = "ptype mapping get <port_id> <valid_only>",
+       .tokens = {
+               (void *)&cmd_ptype_mapping_get_ptype,
+               (void *)&cmd_ptype_mapping_get_mapping,
+               (void *)&cmd_ptype_mapping_get_get,
+               (void *)&cmd_ptype_mapping_get_port_id,
+               (void *)&cmd_ptype_mapping_get_valid_only,
+               NULL,
+       },
+};
+
+/* ptype mapping replace */
+
+/* Common result structure for ptype mapping replace */
+struct cmd_ptype_mapping_replace_result {
+       cmdline_fixed_string_t ptype;
+       cmdline_fixed_string_t mapping;
+       cmdline_fixed_string_t replace;
+       uint8_t port_id;
+       uint32_t target;
+       uint8_t mask;
+       uint32_t pkt_type;
+};
+
+/* Common CLI fields for ptype mapping replace */
+cmdline_parse_token_string_t cmd_ptype_mapping_replace_ptype =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_replace_result,
+                ptype, "ptype");
+cmdline_parse_token_string_t cmd_ptype_mapping_replace_mapping =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_replace_result,
+                mapping, "mapping");
+cmdline_parse_token_string_t cmd_ptype_mapping_replace_replace =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_replace_result,
+                replace, "replace");
+cmdline_parse_token_num_t cmd_ptype_mapping_replace_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_ptype_mapping_replace_result,
+                port_id, UINT8);
+cmdline_parse_token_num_t cmd_ptype_mapping_replace_target =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_ptype_mapping_replace_result,
+                target, UINT32);
+cmdline_parse_token_num_t cmd_ptype_mapping_replace_mask =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_ptype_mapping_replace_result,
+                mask, UINT8);
+cmdline_parse_token_num_t cmd_ptype_mapping_replace_pkt_type =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_ptype_mapping_replace_result,
+                pkt_type, UINT32);
+
+static void
+cmd_ptype_mapping_replace_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_ptype_mapping_replace_result *res = parsed_result;
+       int ret = -ENOTSUP;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       ret = rte_pmd_i40e_ptype_mapping_replace(res->port_id,
+                                       res->target,
+                                       res->mask,
+                                       res->pkt_type);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid ptype 0x%8x or 0x%8x\n",
+                               res->target, res->pkt_type);
+               break;
+       case -ENODEV:
+               printf("invalid port_id %d\n", res->port_id);
+               break;
+       case -ENOTSUP:
+               printf("function not implemented\n");
+               break;
+       default:
+               printf("programming error: (%s)\n", strerror(-ret));
+       }
+}
+
+cmdline_parse_inst_t cmd_ptype_mapping_replace = {
+       .f = cmd_ptype_mapping_replace_parsed,
+       .data = NULL,
+       .help_str =
+               "ptype mapping replace <port_id> <target> <mask> <pkt_type>",
+       .tokens = {
+               (void *)&cmd_ptype_mapping_replace_ptype,
+               (void *)&cmd_ptype_mapping_replace_mapping,
+               (void *)&cmd_ptype_mapping_replace_replace,
+               (void *)&cmd_ptype_mapping_replace_port_id,
+               (void *)&cmd_ptype_mapping_replace_target,
+               (void *)&cmd_ptype_mapping_replace_mask,
+               (void *)&cmd_ptype_mapping_replace_pkt_type,
+               NULL,
+       },
+};
+
+/* ptype mapping reset */
+
+/* Common result structure for ptype mapping reset */
+struct cmd_ptype_mapping_reset_result {
+       cmdline_fixed_string_t ptype;
+       cmdline_fixed_string_t mapping;
+       cmdline_fixed_string_t reset;
+       uint8_t port_id;
+};
+
+/* Common CLI fields for ptype mapping reset*/
+cmdline_parse_token_string_t cmd_ptype_mapping_reset_ptype =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_reset_result,
+                ptype, "ptype");
+cmdline_parse_token_string_t cmd_ptype_mapping_reset_mapping =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_reset_result,
+                mapping, "mapping");
+cmdline_parse_token_string_t cmd_ptype_mapping_reset_reset =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_reset_result,
+                reset, "reset");
+cmdline_parse_token_num_t cmd_ptype_mapping_reset_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_ptype_mapping_reset_result,
+                port_id, UINT8);
+
+static void
+cmd_ptype_mapping_reset_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_ptype_mapping_reset_result *res = parsed_result;
+       int ret = -ENOTSUP;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       ret = rte_pmd_i40e_ptype_mapping_reset(res->port_id);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -ENODEV:
+               printf("invalid port_id %d\n", res->port_id);
+               break;
+       case -ENOTSUP:
+               printf("function not implemented\n");
+               break;
+       default:
+               printf("programming error: (%s)\n", strerror(-ret));
+       }
+}
+
+cmdline_parse_inst_t cmd_ptype_mapping_reset = {
+       .f = cmd_ptype_mapping_reset_parsed,
+       .data = NULL,
+       .help_str = "ptype mapping reset <port_id>",
+       .tokens = {
+               (void *)&cmd_ptype_mapping_reset_ptype,
+               (void *)&cmd_ptype_mapping_reset_mapping,
+               (void *)&cmd_ptype_mapping_reset_reset,
+               (void *)&cmd_ptype_mapping_reset_port_id,
+               NULL,
+       },
+};
+
+/* ptype mapping update */
+
+/* Common result structure for ptype mapping update */
+struct cmd_ptype_mapping_update_result {
+       cmdline_fixed_string_t ptype;
+       cmdline_fixed_string_t mapping;
+       cmdline_fixed_string_t reset;
+       uint8_t port_id;
+       uint8_t hw_ptype;
+       uint32_t sw_ptype;
+};
+
+/* Common CLI fields for ptype mapping update*/
+cmdline_parse_token_string_t cmd_ptype_mapping_update_ptype =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_update_result,
+                ptype, "ptype");
+cmdline_parse_token_string_t cmd_ptype_mapping_update_mapping =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_update_result,
+                mapping, "mapping");
+cmdline_parse_token_string_t cmd_ptype_mapping_update_update =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_ptype_mapping_update_result,
+                reset, "update");
+cmdline_parse_token_num_t cmd_ptype_mapping_update_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_ptype_mapping_update_result,
+                port_id, UINT8);
+cmdline_parse_token_num_t cmd_ptype_mapping_update_hw_ptype =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_ptype_mapping_update_result,
+                hw_ptype, UINT8);
+cmdline_parse_token_num_t cmd_ptype_mapping_update_sw_ptype =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_ptype_mapping_update_result,
+                sw_ptype, UINT32);
+
+static void
+cmd_ptype_mapping_update_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_ptype_mapping_update_result *res = parsed_result;
+       int ret = -ENOTSUP;
+#ifdef RTE_LIBRTE_I40E_PMD
+       struct rte_pmd_i40e_ptype_mapping mapping;
+#endif
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       mapping.hw_ptype = res->hw_ptype;
+       mapping.sw_ptype = res->sw_ptype;
+       ret = rte_pmd_i40e_ptype_mapping_update(res->port_id,
+                                               &mapping,
+                                               1,
+                                               0);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid ptype 0x%8x\n", res->sw_ptype);
+               break;
+       case -ENODEV:
+               printf("invalid port_id %d\n", res->port_id);
+               break;
+       case -ENOTSUP:
+               printf("function not implemented\n");
+               break;
+       default:
+               printf("programming error: (%s)\n", strerror(-ret));
+       }
+}
+
+cmdline_parse_inst_t cmd_ptype_mapping_update = {
+       .f = cmd_ptype_mapping_update_parsed,
+       .data = NULL,
+       .help_str = "ptype mapping update <port_id> <hw_ptype> <sw_ptype>",
+       .tokens = {
+               (void *)&cmd_ptype_mapping_update_ptype,
+               (void *)&cmd_ptype_mapping_update_mapping,
+               (void *)&cmd_ptype_mapping_update_update,
+               (void *)&cmd_ptype_mapping_update_port_id,
+               (void *)&cmd_ptype_mapping_update_hw_ptype,
+               (void *)&cmd_ptype_mapping_update_sw_ptype,
+               NULL,
+       },
+};
+
+/* Common result structure for file commands */
+struct cmd_cmdfile_result {
+       cmdline_fixed_string_t load;
+       cmdline_fixed_string_t filename;
+};
+
+/* Common CLI fields for file commands */
+cmdline_parse_token_string_t cmd_load_cmdfile =
+       TOKEN_STRING_INITIALIZER(struct cmd_cmdfile_result, load, "load");
+cmdline_parse_token_string_t cmd_load_cmdfile_filename =
+       TOKEN_STRING_INITIALIZER(struct cmd_cmdfile_result, filename, NULL);
+
+static void
+cmd_load_from_file_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_cmdfile_result *res = parsed_result;
+
+       cmdline_read_from_file(res->filename);
+}
+
+cmdline_parse_inst_t cmd_load_from_file = {
+       .f = cmd_load_from_file_parsed,
+       .data = NULL,
+       .help_str = "load <filename>",
+       .tokens = {
+               (void *)&cmd_load_cmdfile,
+               (void *)&cmd_load_cmdfile_filename,
+               NULL,
+       },
+};
+
 /* ******************************************************************************** */
 
 /* list of instructions */
@@ -12911,6 +13655,7 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_help_brief,
        (cmdline_parse_inst_t *)&cmd_help_long,
        (cmdline_parse_inst_t *)&cmd_quit,
+       (cmdline_parse_inst_t *)&cmd_load_from_file,
        (cmdline_parse_inst_t *)&cmd_showport,
        (cmdline_parse_inst_t *)&cmd_showqueue,
        (cmdline_parse_inst_t *)&cmd_showportall,
@@ -12935,12 +13680,10 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_set_allmulti_mode_all,
        (cmdline_parse_inst_t *)&cmd_set_flush_rx,
        (cmdline_parse_inst_t *)&cmd_set_link_check,
-#ifdef RTE_NIC_BYPASS
        (cmdline_parse_inst_t *)&cmd_set_bypass_mode,
        (cmdline_parse_inst_t *)&cmd_set_bypass_event,
        (cmdline_parse_inst_t *)&cmd_set_bypass_timeout,
        (cmdline_parse_inst_t *)&cmd_show_bypass_config,
-#endif
 #ifdef RTE_LIBRTE_PMD_BOND
        (cmdline_parse_inst_t *) &cmd_set_bonding_mode,
        (cmdline_parse_inst_t *) &cmd_show_bonding_config,
@@ -13069,10 +13812,10 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_set_macsec_offload_off,
        (cmdline_parse_inst_t *)&cmd_set_macsec_sc,
        (cmdline_parse_inst_t *)&cmd_set_macsec_sa,
-       (cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
        (cmdline_parse_inst_t *)&cmd_set_vf_traffic,
-       (cmdline_parse_inst_t *)&cmd_vf_rate_limit,
 #endif
+       (cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
+       (cmdline_parse_inst_t *)&cmd_vf_rate_limit,
        (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
        (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
        (cmdline_parse_inst_t *)&cmd_set_vf_promisc,
@@ -13083,11 +13826,39 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_vf_tc_min_bw,
        (cmdline_parse_inst_t *)&cmd_vf_tc_max_bw,
        (cmdline_parse_inst_t *)&cmd_strict_link_prio,
+       (cmdline_parse_inst_t *)&cmd_tc_min_bw,
        (cmdline_parse_inst_t *)&cmd_ddp_add,
        (cmdline_parse_inst_t *)&cmd_ddp_get_list,
+       (cmdline_parse_inst_t *)&cmd_show_vf_stats,
+       (cmdline_parse_inst_t *)&cmd_clear_vf_stats,
+       (cmdline_parse_inst_t *)&cmd_ptype_mapping_get,
+       (cmdline_parse_inst_t *)&cmd_ptype_mapping_replace,
+       (cmdline_parse_inst_t *)&cmd_ptype_mapping_reset,
+       (cmdline_parse_inst_t *)&cmd_ptype_mapping_update,
        NULL,
 };
 
+/* read cmdline commands from file */
+void
+cmdline_read_from_file(const char *filename)
+{
+       struct cmdline *cl;
+
+       cl = cmdline_file_new(main_ctx, "testpmd> ", filename);
+       if (cl == NULL) {
+               printf("Failed to create file based cmdline context: %s\n",
+                      filename);
+               return;
+       }
+
+       cmdline_interact(cl);
+       cmdline_quit(cl);
+
+       cmdline_free(cl);
+
+       printf("Read CLI commands from %s\n", filename);
+}
+
 /* prompt function, called from main on MASTER lcore */
 void
 prompt(void)
@@ -13116,7 +13887,7 @@ cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue)
        if (id == (portid_t)RTE_PORT_ALL) {
                portid_t pid;
 
-               FOREACH_PORT(pid, ports) {
+               RTE_ETH_FOREACH_DEV(pid) {
                        /* check if need_reconfig has been set to 1 */
                        if (ports[pid].need_reconfig == 0)
                                ports[pid].need_reconfig = dev;