app/testpmd: fix build with bypass without ixgbe
[dpdk.git] / app / test-pmd / cmdline.c
index 1bf42ba..105c71f 100644 (file)
 #ifdef RTE_LIBRTE_IXGBE_PMD
 #include <rte_pmd_ixgbe.h>
 #endif
+#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;
@@ -183,7 +189,7 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "Display:\n"
                        "--------\n\n"
 
-                       "show port (info|stats|xstats|fdir|stat_qmap|dcb_tc) (port_id|all)\n"
+                       "show port (info|stats|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)\n"
                        "    Display information for port_id, or all.\n\n"
 
                        "show port X rss reta (size) (mask0,mask1,...)\n"
@@ -211,6 +217,15 @@ static void cmd_help_long_parsed(void *parsed_result,
 
                        "read txd (port_id) (queue_id) (txd_id)\n"
                        "    Display a TX descriptor of a port TX queue.\n\n"
+
+                       "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"
                );
        }
 
@@ -263,19 +278,21 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "set portlist (x[,y]*)\n"
                        "    Set the list of forwarding ports.\n\n"
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
                        "set tx loopback (port_id) (on|off)\n"
                        "    Enable or disable tx loopback.\n\n"
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
                        "set all queues drop (port_id) (on|off)\n"
                        "    Set drop enable bit for all queues.\n\n"
 
                        "set vf split drop (port_id) (vf_id) (on|off)\n"
                        "    Set split drop enable bit for a VF from the PF.\n\n"
+#endif
 
                        "set vf mac antispoof (port_id) (vf_id) (on|off).\n"
                        "    Set MAC antispoof for a VF from the PF.\n\n"
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
                        "set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)\n"
                        "    Enable MACsec offload.\n\n"
 
@@ -289,13 +306,15 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "    Configure MACsec secure association (SA).\n\n"
 #endif
 
+                       "set vf broadcast (port_id) (vf_id) (on|off)\n"
+                       "    Set VF broadcast for a VF from the PF.\n\n"
+
                        "vlan set strip (on|off) (port_id)\n"
                        "    Set the VLAN strip on a port.\n\n"
 
                        "vlan set stripq (on|off) (port_id,queue_id)\n"
                        "    Set the VLAN strip for a queue on a port.\n\n"
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
                        "set vf vlan stripq (port_id) (vf_id) (on|off)\n"
                        "    Set the VLAN strip for all queues in a pool for a VF from the PF.\n\n"
 
@@ -304,7 +323,24 @@ static void cmd_help_long_parsed(void *parsed_result,
 
                        "set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
                        "    Set VLAN antispoof for a VF from the PF.\n\n"
-#endif
+
+                       "set vf vlan tag (port_id) (vf_id) (on|off)\n"
+                       "    Set VLAN tag for a VF from the PF.\n\n"
+
+                       "set vf tx max-bandwidth (port_id) (vf_id) (bandwidth)\n"
+                       "    Set a VF's max bandwidth(Mbps).\n\n"
+
+                       "set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)\n"
+                       "    Set all TCs' min bandwidth(%%) on a VF.\n\n"
+
+                       "set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (bandwidth)\n"
+                       "    Set a TC's max bandwidth(Mbps) on a VF.\n\n"
+
+                       "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"
@@ -396,13 +432,14 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)\n"
                        "    Remove a MAC address from port_id.\n\n"
 
+                       "mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)\n"
+                       "    Set the default MAC address for port_id.\n\n"
+
                        "mac_addr add port (port_id) vf (vf_id) (mac_address)\n"
                        "    Add a MAC address for a VF on the port.\n\n"
 
-#ifdef RTE_LIBRTE_IXGBE_PMD
                        "set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)\n"
                        "    Set the MAC address for a VF from the PF.\n\n"
-#endif
 
                        "set port (port_id) uta (mac_address|all) (on|off)\n"
                        "    Add/Remove a or all unicast hash filter(s)"
@@ -414,6 +451,12 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "set allmulti (port_id|all) (on|off)\n"
                        "    Set the allmulti mode on port_id, or all.\n\n"
 
+                       "set vf promisc (port_id) (vf_id) (on|off)\n"
+                       "    Set unicast promiscuous mode for a VF from the PF.\n\n"
+
+                       "set vf allmulti (port_id) (vf_id) (on|off)\n"
+                       "    Set multicast promiscuous mode for a VF from the PF.\n\n"
+
                        "set flow_ctrl rx (on|off) tx (on|off) (high_water)"
                        " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd"
                        " (on|off) autoneg (on|off) (port_id)\n"
@@ -483,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"
@@ -506,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"
@@ -562,6 +604,21 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "E-tag set filter del e-tag-id (value) port (port_id)\n"
                        "    Delete an E-tag forwarding filter on a port\n\n"
 
+                       "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()
                );
        }
@@ -849,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"
                );
        }
 }
@@ -1126,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;
        }
 
@@ -2047,7 +2108,9 @@ showport_parse_reta_config(struct rte_eth_rss_reta_entry64 *conf,
        char s[256];
        char *end;
        char *str_fld[8];
-       uint16_t i, num = nb_entries / RTE_RETA_GROUP_SIZE;
+       uint16_t i;
+       uint16_t num = (nb_entries + RTE_RETA_GROUP_SIZE - 1) /
+                       RTE_RETA_GROUP_SIZE;
        int ret;
 
        p = strchr(p0, '(');
@@ -3847,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;
@@ -3864,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 =
@@ -3926,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 =
@@ -4027,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 =
@@ -4088,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",
@@ -4108,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 =
@@ -4167,7 +4247,6 @@ cmdline_parse_inst_t cmd_show_bypass_config = {
                NULL,
        },
 };
-#endif
 
 #ifdef RTE_LIBRTE_PMD_BOND
 /* *** SET BONDING MODE *** */
@@ -4628,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;
        }
 
 }
@@ -4987,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
@@ -5067,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
@@ -5430,7 +5508,7 @@ cmd_link_flow_ctrl_set_parsed(void *parsed_result,
                printf("bad flow contrl parameter, return code = %d \n", ret);
 }
 
-/* *** SETUP ETHERNET PIRORITY FLOW CONTROL *** */
+/* *** SETUP ETHERNET PRIORITY FLOW CONTROL *** */
 struct cmd_priority_flow_ctrl_set_result {
        cmdline_fixed_string_t set;
        cmdline_fixed_string_t pfc_ctrl;
@@ -5801,29 +5879,32 @@ 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"))
+               RTE_ETH_FOREACH_DEV(i)
+                       port_offload_cap_display(i);
 }
 
 cmdline_parse_token_string_t cmd_showportall_show =
@@ -5833,13 +5914,14 @@ cmdline_parse_token_string_t cmd_showportall_port =
        TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, port, "port");
 cmdline_parse_token_string_t cmd_showportall_what =
        TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, what,
-                                "info#stats#xstats#fdir#stat_qmap#dcb_tc");
+                                "info#stats#xstats#fdir#stat_qmap#dcb_tc#cap");
 cmdline_parse_token_string_t cmd_showportall_all =
        TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, all, "all");
 cmdline_parse_inst_t cmd_showportall = {
        .f = cmd_showportall_parsed,
        .data = NULL,
-       .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc all",
+       .help_str = "show|clear port "
+               "info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all",
        .tokens = {
                (void *)&cmd_showportall_show,
                (void *)&cmd_showportall_port,
@@ -5879,6 +5961,8 @@ static void cmd_showport_parsed(void *parsed_result,
                nic_stats_mapping_display(res->portnum);
        else if (!strcmp(res->what, "dcb_tc"))
                port_dcb_info_display(res->portnum);
+       else if (!strcmp(res->what, "cap"))
+               port_offload_cap_display(res->portnum);
 }
 
 cmdline_parse_token_string_t cmd_showport_show =
@@ -5888,14 +5972,15 @@ cmdline_parse_token_string_t cmd_showport_port =
        TOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, "port");
 cmdline_parse_token_string_t cmd_showport_what =
        TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what,
-                                "info#stats#xstats#fdir#stat_qmap#dcb_tc");
+                                "info#stats#xstats#fdir#stat_qmap#dcb_tc#cap");
 cmdline_parse_token_num_t cmd_showport_portnum =
        TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, UINT8);
 
 cmdline_parse_inst_t cmd_showport = {
        .f = cmd_showport_parsed,
        .data = NULL,
-       .help_str = "show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc "
+       .help_str = "show|clear port "
+               "info|stats|xstats|fdir|stat_qmap|dcb_tc|cap "
                "<port_id>",
        .tokens = {
                (void *)&cmd_showport_show,
@@ -6336,6 +6421,9 @@ static void cmd_mac_addr_parsed(void *parsed_result,
 
        if (strcmp(res->what, "add") == 0)
                ret = rte_eth_dev_mac_addr_add(res->port_num, &res->address, 0);
+       else if (strcmp(res->what, "set") == 0)
+               ret = rte_eth_dev_default_mac_addr_set(res->port_num,
+                                                      &res->address);
        else
                ret = rte_eth_dev_mac_addr_remove(res->port_num, &res->address);
 
@@ -6350,7 +6438,7 @@ cmdline_parse_token_string_t cmd_mac_addr_cmd =
                                "mac_addr");
 cmdline_parse_token_string_t cmd_mac_addr_what =
        TOKEN_STRING_INITIALIZER(struct cmd_mac_addr_result, what,
-                               "add#remove");
+                               "add#remove#set");
 cmdline_parse_token_num_t cmd_mac_addr_portnum =
                TOKEN_NUM_INITIALIZER(struct cmd_mac_addr_result, port_num, UINT8);
 cmdline_parse_token_etheraddr_t cmd_mac_addr_addr =
@@ -6359,8 +6447,8 @@ cmdline_parse_token_etheraddr_t cmd_mac_addr_addr =
 cmdline_parse_inst_t cmd_mac_addr = {
        .f = cmd_mac_addr_parsed,
        .data = (void *)0,
-       .help_str = "mac_addr add|remove <port_id> <mac_addr>: "
-                       "Add/Remove MAC address on port_id",
+       .help_str = "mac_addr add|remove|set <port_id> <mac_addr>: "
+                       "Add/Remove/Set MAC address on port_id",
        .tokens = {
                (void *)&cmd_mac_addr_cmd,
                (void *)&cmd_mac_addr_what,
@@ -6654,6 +6742,7 @@ cmdline_parse_inst_t cmd_set_vf_macvlan_filter = {
        },
 };
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 /* *** CONFIGURE VF TRAFFIC CONTROL *** */
 struct cmd_set_vf_traffic {
        cmdline_fixed_string_t set;
@@ -6714,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 {
@@ -6732,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;
 
@@ -6748,7 +6838,16 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
                        rx_mode |= ETH_VMDQ_ACCEPT_MULTICAST;
        }
 
-       ret = rte_eth_dev_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);
@@ -6879,11 +6978,42 @@ cmd_vf_rx_vlan_filter_parsed(void *parsed_result,
                          __attribute__((unused)) void *data)
 {
        struct cmd_vf_rx_vlan_filter *res = parsed_result;
+       int ret = -ENOTSUP;
 
-       if (!strcmp(res->what, "add"))
-               set_vf_rx_vlan(res->port_id, res->vlan_id,res->vf_mask, 1);
-       else
-               set_vf_rx_vlan(res->port_id, res->vlan_id,res->vf_mask, 0);
+       __rte_unused int is_add = (strcmp(res->what, "add") == 0) ? 1 : 0;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_ixgbe_set_vf_vlan_filter(res->port_id,
+                               res->vlan_id, res->vf_mask, is_add);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (ret == -ENOTSUP)
+               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:
+               break;
+       case -EINVAL:
+               printf("invalid vlan_id %d or vf_mask %"PRIu64"\n",
+                               res->vlan_id, res->vf_mask);
+               break;
+       case -ENODEV:
+               printf("invalid port_id %d\n", res->port_id);
+               break;
+       case -ENOTSUP:
+               printf("function not implemented or supported\n");
+               break;
+       default:
+               printf("programming error: (%s)\n", strerror(-ret));
+       }
 }
 
 cmdline_parse_token_string_t cmd_vf_rx_vlan_filter_rx_vlan =
@@ -7447,7 +7577,7 @@ cmdline_parse_inst_t cmd_set_mirror_mask = {
                },
 };
 
-/* *** CONFIGURE VM MIRROR UDLINK/DOWNLINK RULE *** */
+/* *** CONFIGURE VM MIRROR UPLINK/DOWNLINK RULE *** */
 struct cmd_set_mirror_link_result {
        cmdline_fixed_string_t set;
        cmdline_fixed_string_t port;
@@ -7623,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 =
@@ -7632,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 */
@@ -8642,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,
@@ -8674,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,
@@ -10265,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);
        }
 }
@@ -10381,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,
@@ -10843,7 +10978,6 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = {
                NULL,
        },
 };
-#ifdef RTE_LIBRTE_IXGBE_PMD
 
 /* vf vlan anti spoof configuration */
 
@@ -10895,11 +11029,29 @@ cmd_set_vf_vlan_anti_spoof_parsed(
        __attribute__((unused)) void *data)
 {
        struct cmd_vf_vlan_anti_spoof_result *res = parsed_result;
-       int ret = 0;
-       int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+       int ret = -ENOTSUP;
+
+       __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id,
+                               res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (ret == -ENOTSUP)
+               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
 
-       ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, res->vf_id,
-                       is_on);
        switch (ret) {
        case 0:
                break;
@@ -10909,6 +11061,9 @@ cmd_set_vf_vlan_anti_spoof_parsed(
        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));
        }
@@ -10980,11 +11135,29 @@ cmd_set_vf_mac_anti_spoof_parsed(
        __attribute__((unused)) void *data)
 {
        struct cmd_vf_mac_anti_spoof_result *res = parsed_result;
-       int ret;
-       int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+       int ret = -ENOTSUP;
+
+       __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id,
+                       res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (ret == -ENOTSUP)
+               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
 
-       ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, res->vf_id,
-                       is_on);
        switch (ret) {
        case 0:
                break;
@@ -10994,6 +11167,9 @@ cmd_set_vf_mac_anti_spoof_parsed(
        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));
        }
@@ -11065,10 +11241,29 @@ cmd_set_vf_vlan_stripq_parsed(
        __attribute__((unused)) void *data)
 {
        struct cmd_vf_vlan_stripq_result *res = parsed_result;
-       int ret = 0;
-       int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+       int ret = -ENOTSUP;
+
+       __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id,
+                       res->vf_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (ret == -ENOTSUP)
+               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
 
-       ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, res->vf_id, is_on);
        switch (ret) {
        case 0:
                break;
@@ -11078,6 +11273,9 @@ cmd_set_vf_vlan_stripq_parsed(
        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));
        }
@@ -11149,9 +11347,27 @@ cmd_set_vf_vlan_insert_parsed(
        __attribute__((unused)) void *data)
 {
        struct cmd_vf_vlan_insert_result *res = parsed_result;
-       int ret;
+       int ret = -ENOTSUP;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id,
+                       res->vlan_id);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (ret == -ENOTSUP)
+               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
 
-       ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, res->vlan_id);
        switch (ret) {
        case 0:
                break;
@@ -11161,6 +11377,9 @@ cmd_set_vf_vlan_insert_parsed(
        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));
        }
@@ -11222,10 +11441,26 @@ cmd_set_tx_loopback_parsed(
        __attribute__((unused)) void *data)
 {
        struct cmd_tx_loopback_result *res = parsed_result;
-       int ret;
-       int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+       int ret = -ENOTSUP;
+
+       __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+       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
 
-       ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
        switch (ret) {
        case 0:
                break;
@@ -11235,6 +11470,9 @@ cmd_set_tx_loopback_parsed(
        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));
        }
@@ -11299,10 +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;
 
-       ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on);
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#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;
@@ -11312,6 +11560,9 @@ cmd_set_all_queues_drop_en_parsed(
        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));
        }
@@ -11332,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 */
@@ -11385,6 +11637,9 @@ cmd_set_vf_split_drop_en_parsed(
        int ret;
        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_vf_split_drop_en(res->port_id, res->vf_id,
                        is_on);
        switch (ret) {
@@ -11416,6 +11671,7 @@ cmdline_parse_inst_t cmd_set_vf_split_drop_en = {
                NULL,
        },
 };
+#endif
 
 /* vf mac address configuration */
 
@@ -11467,10 +11723,27 @@ cmd_set_vf_mac_addr_parsed(
        __attribute__((unused)) void *data)
 {
        struct cmd_set_vf_mac_addr_result *res = parsed_result;
-       int ret;
+       int ret = -ENOTSUP;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_IXGBE_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id,
+                               &res->mac_addr);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (ret == -ENOTSUP)
+               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
 
-       ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id,
-                       &res->mac_addr);
        switch (ret) {
        case 0:
                break;
@@ -11480,6 +11753,9 @@ cmd_set_vf_mac_addr_parsed(
        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));
        }
@@ -11501,6 +11777,7 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = {
        },
 };
 
+#ifdef RTE_LIBRTE_IXGBE_PMD
 /* MACsec configuration */
 
 /* Common result structure for MACsec offload enable */
@@ -11875,56 +12152,1551 @@ cmdline_parse_inst_t cmd_set_macsec_sa = {
 };
 #endif
 
-/* ******************************************************************************** */
+/* VF unicast promiscuous mode configuration */
 
-/* list of instructions */
-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_showport,
-       (cmdline_parse_inst_t *)&cmd_showqueue,
-       (cmdline_parse_inst_t *)&cmd_showportall,
-       (cmdline_parse_inst_t *)&cmd_showcfg,
-       (cmdline_parse_inst_t *)&cmd_start,
-       (cmdline_parse_inst_t *)&cmd_start_tx_first,
-       (cmdline_parse_inst_t *)&cmd_start_tx_first_n,
-       (cmdline_parse_inst_t *)&cmd_set_link_up,
-       (cmdline_parse_inst_t *)&cmd_set_link_down,
-       (cmdline_parse_inst_t *)&cmd_reset,
-       (cmdline_parse_inst_t *)&cmd_set_numbers,
-       (cmdline_parse_inst_t *)&cmd_set_txpkts,
-       (cmdline_parse_inst_t *)&cmd_set_txsplit,
-       (cmdline_parse_inst_t *)&cmd_set_fwd_list,
-       (cmdline_parse_inst_t *)&cmd_set_fwd_mask,
-       (cmdline_parse_inst_t *)&cmd_set_fwd_mode,
-       (cmdline_parse_inst_t *)&cmd_set_fwd_retry_mode,
-       (cmdline_parse_inst_t *)&cmd_set_burst_tx_retry,
-       (cmdline_parse_inst_t *)&cmd_set_promisc_mode_one,
-       (cmdline_parse_inst_t *)&cmd_set_promisc_mode_all,
-       (cmdline_parse_inst_t *)&cmd_set_allmulti_mode_one,
-       (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,
-       (cmdline_parse_inst_t *) &cmd_set_bonding_primary,
-       (cmdline_parse_inst_t *) &cmd_add_bonding_slave,
-       (cmdline_parse_inst_t *) &cmd_remove_bonding_slave,
-       (cmdline_parse_inst_t *) &cmd_create_bonded_device,
-       (cmdline_parse_inst_t *) &cmd_set_bond_mac_addr,
-       (cmdline_parse_inst_t *) &cmd_set_balance_xmit_policy,
-       (cmdline_parse_inst_t *) &cmd_set_bond_mon_period,
+/* Common result structure for VF unicast promiscuous mode */
+struct cmd_vf_promisc_result {
+       cmdline_fixed_string_t set;
+       cmdline_fixed_string_t vf;
+       cmdline_fixed_string_t promisc;
+       uint8_t port_id;
+       uint32_t vf_id;
+       cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for VF unicast promiscuous mode enable disable */
+cmdline_parse_token_string_t cmd_vf_promisc_set =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_promisc_result,
+                set, "set");
+cmdline_parse_token_string_t cmd_vf_promisc_vf =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_promisc_result,
+                vf, "vf");
+cmdline_parse_token_string_t cmd_vf_promisc_promisc =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_promisc_result,
+                promisc, "promisc");
+cmdline_parse_token_num_t cmd_vf_promisc_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_vf_promisc_result,
+                port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_promisc_vf_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_vf_promisc_result,
+                vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_promisc_on_off =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_promisc_result,
+                on_off, "on#off");
+
+static void
+cmd_set_vf_promisc_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_vf_promisc_result *res = parsed_result;
+       int ret = -ENOTSUP;
+
+       __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       ret = rte_pmd_i40e_set_vf_unicast_promisc(res->port_id,
+                                                 res->vf_id, is_on);
 #endif
-       (cmdline_parse_inst_t *)&cmd_vlan_offload,
-       (cmdline_parse_inst_t *)&cmd_vlan_tpid,
+
+       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_set_vf_promisc = {
+       .f = cmd_set_vf_promisc_parsed,
+       .data = NULL,
+       .help_str = "set vf promisc <port_id> <vf_id> on|off: "
+               "Set unicast promiscuous mode for a VF from the PF",
+       .tokens = {
+               (void *)&cmd_vf_promisc_set,
+               (void *)&cmd_vf_promisc_vf,
+               (void *)&cmd_vf_promisc_promisc,
+               (void *)&cmd_vf_promisc_port_id,
+               (void *)&cmd_vf_promisc_vf_id,
+               (void *)&cmd_vf_promisc_on_off,
+               NULL,
+       },
+};
+
+/* VF multicast promiscuous mode configuration */
+
+/* Common result structure for VF multicast promiscuous mode */
+struct cmd_vf_allmulti_result {
+       cmdline_fixed_string_t set;
+       cmdline_fixed_string_t vf;
+       cmdline_fixed_string_t allmulti;
+       uint8_t port_id;
+       uint32_t vf_id;
+       cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for VF multicast promiscuous mode enable disable */
+cmdline_parse_token_string_t cmd_vf_allmulti_set =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_allmulti_result,
+                set, "set");
+cmdline_parse_token_string_t cmd_vf_allmulti_vf =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_allmulti_result,
+                vf, "vf");
+cmdline_parse_token_string_t cmd_vf_allmulti_allmulti =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_allmulti_result,
+                allmulti, "allmulti");
+cmdline_parse_token_num_t cmd_vf_allmulti_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_vf_allmulti_result,
+                port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_allmulti_vf_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_vf_allmulti_result,
+                vf_id, UINT32);
+cmdline_parse_token_string_t cmd_vf_allmulti_on_off =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_allmulti_result,
+                on_off, "on#off");
+
+static void
+cmd_set_vf_allmulti_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_vf_allmulti_result *res = parsed_result;
+       int ret = -ENOTSUP;
+
+       __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       ret = rte_pmd_i40e_set_vf_multicast_promisc(res->port_id,
+                                                   res->vf_id, is_on);
+#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_set_vf_allmulti = {
+       .f = cmd_set_vf_allmulti_parsed,
+       .data = NULL,
+       .help_str = "set vf allmulti <port_id> <vf_id> on|off: "
+               "Set multicast promiscuous mode for a VF from the PF",
+       .tokens = {
+               (void *)&cmd_vf_allmulti_set,
+               (void *)&cmd_vf_allmulti_vf,
+               (void *)&cmd_vf_allmulti_allmulti,
+               (void *)&cmd_vf_allmulti_port_id,
+               (void *)&cmd_vf_allmulti_vf_id,
+               (void *)&cmd_vf_allmulti_on_off,
+               NULL,
+       },
+};
+
+/* vf broadcast mode configuration */
+
+/* Common result structure for vf broadcast */
+struct cmd_set_vf_broadcast_result {
+       cmdline_fixed_string_t set;
+       cmdline_fixed_string_t vf;
+       cmdline_fixed_string_t broadcast;
+       uint8_t port_id;
+       uint16_t vf_id;
+       cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf broadcast enable disable */
+cmdline_parse_token_string_t cmd_set_vf_broadcast_set =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_set_vf_broadcast_result,
+                set, "set");
+cmdline_parse_token_string_t cmd_set_vf_broadcast_vf =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_set_vf_broadcast_result,
+                vf, "vf");
+cmdline_parse_token_string_t cmd_set_vf_broadcast_broadcast =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_set_vf_broadcast_result,
+                broadcast, "broadcast");
+cmdline_parse_token_num_t cmd_set_vf_broadcast_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_set_vf_broadcast_result,
+                port_id, UINT8);
+cmdline_parse_token_num_t cmd_set_vf_broadcast_vf_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_set_vf_broadcast_result,
+                vf_id, UINT16);
+cmdline_parse_token_string_t cmd_set_vf_broadcast_on_off =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_set_vf_broadcast_result,
+                on_off, "on#off");
+
+static void
+cmd_set_vf_broadcast_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_set_vf_broadcast_result *res = parsed_result;
+       int ret = -ENOTSUP;
+
+       __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       ret = rte_pmd_i40e_set_vf_broadcast(res->port_id,
+                                           res->vf_id, is_on);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+               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_set_vf_broadcast = {
+       .f = cmd_set_vf_broadcast_parsed,
+       .data = NULL,
+       .help_str = "set vf broadcast <port_id> <vf_id> on|off",
+       .tokens = {
+               (void *)&cmd_set_vf_broadcast_set,
+               (void *)&cmd_set_vf_broadcast_vf,
+               (void *)&cmd_set_vf_broadcast_broadcast,
+               (void *)&cmd_set_vf_broadcast_port_id,
+               (void *)&cmd_set_vf_broadcast_vf_id,
+               (void *)&cmd_set_vf_broadcast_on_off,
+               NULL,
+       },
+};
+
+/* vf vlan tag configuration */
+
+/* Common result structure for vf vlan tag */
+struct cmd_set_vf_vlan_tag_result {
+       cmdline_fixed_string_t set;
+       cmdline_fixed_string_t vf;
+       cmdline_fixed_string_t vlan;
+       cmdline_fixed_string_t tag;
+       uint8_t port_id;
+       uint16_t vf_id;
+       cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf vlan tag enable disable */
+cmdline_parse_token_string_t cmd_set_vf_vlan_tag_set =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_set_vf_vlan_tag_result,
+                set, "set");
+cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vf =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_set_vf_vlan_tag_result,
+                vf, "vf");
+cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vlan =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_set_vf_vlan_tag_result,
+                vlan, "vlan");
+cmdline_parse_token_string_t cmd_set_vf_vlan_tag_tag =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_set_vf_vlan_tag_result,
+                tag, "tag");
+cmdline_parse_token_num_t cmd_set_vf_vlan_tag_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_set_vf_vlan_tag_result,
+                port_id, UINT8);
+cmdline_parse_token_num_t cmd_set_vf_vlan_tag_vf_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_set_vf_vlan_tag_result,
+                vf_id, UINT16);
+cmdline_parse_token_string_t cmd_set_vf_vlan_tag_on_off =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_set_vf_vlan_tag_result,
+                on_off, "on#off");
+
+static void
+cmd_set_vf_vlan_tag_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_set_vf_vlan_tag_result *res = parsed_result;
+       int ret = -ENOTSUP;
+
+       __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       ret = rte_pmd_i40e_set_vf_vlan_tag(res->port_id,
+                                          res->vf_id, is_on);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+               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_set_vf_vlan_tag = {
+       .f = cmd_set_vf_vlan_tag_parsed,
+       .data = NULL,
+       .help_str = "set vf vlan tag <port_id> <vf_id> on|off",
+       .tokens = {
+               (void *)&cmd_set_vf_vlan_tag_set,
+               (void *)&cmd_set_vf_vlan_tag_vf,
+               (void *)&cmd_set_vf_vlan_tag_vlan,
+               (void *)&cmd_set_vf_vlan_tag_tag,
+               (void *)&cmd_set_vf_vlan_tag_port_id,
+               (void *)&cmd_set_vf_vlan_tag_vf_id,
+               (void *)&cmd_set_vf_vlan_tag_on_off,
+               NULL,
+       },
+};
+
+/* Common definition of VF and TC TX bandwidth configuration */
+struct cmd_vf_tc_bw_result {
+       cmdline_fixed_string_t set;
+       cmdline_fixed_string_t vf;
+       cmdline_fixed_string_t tc;
+       cmdline_fixed_string_t tx;
+       cmdline_fixed_string_t min_bw;
+       cmdline_fixed_string_t max_bw;
+       cmdline_fixed_string_t strict_link_prio;
+       uint8_t port_id;
+       uint16_t vf_id;
+       uint8_t tc_no;
+       uint32_t bw;
+       cmdline_fixed_string_t bw_list;
+       uint8_t tc_map;
+};
+
+cmdline_parse_token_string_t cmd_vf_tc_bw_set =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                set, "set");
+cmdline_parse_token_string_t cmd_vf_tc_bw_vf =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                vf, "vf");
+cmdline_parse_token_string_t cmd_vf_tc_bw_tc =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                tc, "tc");
+cmdline_parse_token_string_t cmd_vf_tc_bw_tx =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                tx, "tx");
+cmdline_parse_token_string_t cmd_vf_tc_bw_strict_link_prio =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                strict_link_prio, "strict-link-priority");
+cmdline_parse_token_string_t cmd_vf_tc_bw_min_bw =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                min_bw, "min-bandwidth");
+cmdline_parse_token_string_t cmd_vf_tc_bw_max_bw =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                max_bw, "max-bandwidth");
+cmdline_parse_token_num_t cmd_vf_tc_bw_port_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                port_id, UINT8);
+cmdline_parse_token_num_t cmd_vf_tc_bw_vf_id =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                vf_id, UINT16);
+cmdline_parse_token_num_t cmd_vf_tc_bw_tc_no =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                tc_no, UINT8);
+cmdline_parse_token_num_t cmd_vf_tc_bw_bw =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                bw, UINT32);
+cmdline_parse_token_string_t cmd_vf_tc_bw_bw_list =
+       TOKEN_STRING_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                bw_list, NULL);
+cmdline_parse_token_num_t cmd_vf_tc_bw_tc_map =
+       TOKEN_NUM_INITIALIZER
+               (struct cmd_vf_tc_bw_result,
+                tc_map, UINT8);
+
+/* VF max bandwidth setting */
+static void
+cmd_vf_max_bw_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_vf_tc_bw_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_set_vf_max_bw(res->port_id,
+                                        res->vf_id, res->bw);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid vf_id %d or bandwidth %d\n",
+                      res->vf_id, res->bw);
+               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_vf_max_bw = {
+       .f = cmd_vf_max_bw_parsed,
+       .data = NULL,
+       .help_str = "set vf tx max-bandwidth <port_id> <vf_id> <bandwidth>",
+       .tokens = {
+               (void *)&cmd_vf_tc_bw_set,
+               (void *)&cmd_vf_tc_bw_vf,
+               (void *)&cmd_vf_tc_bw_tx,
+               (void *)&cmd_vf_tc_bw_max_bw,
+               (void *)&cmd_vf_tc_bw_port_id,
+               (void *)&cmd_vf_tc_bw_vf_id,
+               (void *)&cmd_vf_tc_bw_bw,
+               NULL,
+       },
+};
+
+static int
+vf_tc_min_bw_parse_bw_list(uint8_t *bw_list,
+                          uint8_t *tc_num,
+                          char *str)
+{
+       uint32_t size;
+       const char *p, *p0 = str;
+       char s[256];
+       char *end;
+       char *str_fld[16];
+       uint16_t i;
+       int ret;
+
+       p = strchr(p0, '(');
+       if (p == NULL) {
+               printf("The bandwidth-list should be '(bw1, bw2, ...)'\n");
+               return -1;
+       }
+       p++;
+       p0 = strchr(p, ')');
+       if (p0 == NULL) {
+               printf("The bandwidth-list should be '(bw1, bw2, ...)'\n");
+               return -1;
+       }
+       size = p0 - p;
+       if (size >= sizeof(s)) {
+               printf("The string size exceeds the internal buffer size\n");
+               return -1;
+       }
+       snprintf(s, sizeof(s), "%.*s", size, p);
+       ret = rte_strsplit(s, sizeof(s), str_fld, 16, ',');
+       if (ret <= 0) {
+               printf("Failed to get the bandwidth list. ");
+               return -1;
+       }
+       *tc_num = ret;
+       for (i = 0; i < ret; i++)
+               bw_list[i] = (uint8_t)strtoul(str_fld[i], &end, 0);
+
+       return 0;
+}
+
+/* TC min bandwidth setting */
+static void
+cmd_vf_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;
+       uint8_t tc_num;
+       uint8_t bw[16];
+       int ret = -ENOTSUP;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+       ret = vf_tc_min_bw_parse_bw_list(bw, &tc_num, res->bw_list);
+       if (ret)
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       ret = rte_pmd_i40e_set_vf_tc_bw_alloc(res->port_id, res->vf_id,
+                                             tc_num, bw);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid vf_id %d or bandwidth\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_vf_tc_min_bw = {
+       .f = cmd_vf_tc_min_bw_parsed,
+       .data = NULL,
+       .help_str = "set vf tc tx min-bandwidth <port_id> <vf_id>"
+                   " <bw1, bw2, ...>",
+       .tokens = {
+               (void *)&cmd_vf_tc_bw_set,
+               (void *)&cmd_vf_tc_bw_vf,
+               (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_vf_id,
+               (void *)&cmd_vf_tc_bw_bw_list,
+               NULL,
+       },
+};
+
+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(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_vf_tc_bw_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_set_vf_tc_max_bw(res->port_id, res->vf_id,
+                                           res->tc_no, res->bw);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid vf_id %d, tc_no %d or bandwidth %d\n",
+                      res->vf_id, res->tc_no, res->bw);
+               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_vf_tc_max_bw = {
+       .f = cmd_vf_tc_max_bw_parsed,
+       .data = NULL,
+       .help_str = "set vf tc tx max-bandwidth <port_id> <vf_id> <tc_no>"
+                   " <bandwidth>",
+       .tokens = {
+               (void *)&cmd_vf_tc_bw_set,
+               (void *)&cmd_vf_tc_bw_vf,
+               (void *)&cmd_vf_tc_bw_tc,
+               (void *)&cmd_vf_tc_bw_tx,
+               (void *)&cmd_vf_tc_bw_max_bw,
+               (void *)&cmd_vf_tc_bw_port_id,
+               (void *)&cmd_vf_tc_bw_vf_id,
+               (void *)&cmd_vf_tc_bw_tc_no,
+               (void *)&cmd_vf_tc_bw_bw,
+               NULL,
+       },
+};
+
+/* Strict link priority scheduling mode setting */
+static void
+cmd_strict_link_prio_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_vf_tc_bw_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_set_tc_strict_prio(res->port_id, res->tc_map);
+#endif
+
+       switch (ret) {
+       case 0:
+               break;
+       case -EINVAL:
+               printf("invalid tc_bitmap 0x%x\n", res->tc_map);
+               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_strict_link_prio = {
+       .f = cmd_strict_link_prio_parsed,
+       .data = NULL,
+       .help_str = "set tx strict-link-priority <port_id> <tc_bitmap>",
+       .tokens = {
+               (void *)&cmd_vf_tc_bw_set,
+               (void *)&cmd_vf_tc_bw_tx,
+               (void *)&cmd_vf_tc_bw_strict_link_prio,
+               (void *)&cmd_vf_tc_bw_port_id,
+               (void *)&cmd_vf_tc_bw_tc_map,
+               NULL,
+       },
+};
+
+/* Load dynamic device personalization*/
+struct cmd_ddp_add_result {
+       cmdline_fixed_string_t ddp;
+       cmdline_fixed_string_t add;
+       uint8_t port_id;
+       char filepath[];
+};
+
+cmdline_parse_token_string_t cmd_ddp_add_ddp =
+       TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result, ddp, "ddp");
+cmdline_parse_token_string_t cmd_ddp_add_add =
+       TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result, add, "add");
+cmdline_parse_token_num_t cmd_ddp_add_port_id =
+       TOKEN_NUM_INITIALIZER(struct cmd_ddp_add_result, port_id, UINT8);
+cmdline_parse_token_string_t cmd_ddp_add_filepath =
+       TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result, filepath, NULL);
+
+static void
+cmd_ddp_add_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_ddp_add_result *res = parsed_result;
+       uint8_t *buff;
+       uint32_t size;
+       int ret = -ENOTSUP;
+
+       if (res->port_id > nb_ports) {
+               printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
+               return;
+       }
+
+       if (!all_ports_stopped()) {
+               printf("Please stop all ports first\n");
+               return;
+       }
+
+       buff = open_ddp_package_file(res->filepath, &size);
+       if (!buff)
+               return;
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_i40e_process_ddp_package(res->port_id,
+                                              buff, size,
+                                              RTE_PMD_I40E_PKG_OP_WR_ADD);
+#endif
+
+       if (ret < 0)
+               printf("Failed to load profile.\n");
+       else if (ret > 0)
+               printf("Profile has already existed.\n");
+
+       close_ddp_package_file(buff);
+}
+
+cmdline_parse_inst_t cmd_ddp_add = {
+       .f = cmd_ddp_add_parsed,
+       .data = NULL,
+       .help_str = "ddp add <port_id> <profile_path>",
+       .tokens = {
+               (void *)&cmd_ddp_add_ddp,
+               (void *)&cmd_ddp_add_add,
+               (void *)&cmd_ddp_add_port_id,
+               (void *)&cmd_ddp_add_filepath,
+               NULL,
+       },
+};
+
+/* Get dynamic device personalization profile info list*/
+#define PROFILE_INFO_SIZE 48
+#define MAX_PROFILE_NUM 16
+
+struct cmd_ddp_get_list_result {
+       cmdline_fixed_string_t ddp;
+       cmdline_fixed_string_t get;
+       cmdline_fixed_string_t list;
+       uint8_t port_id;
+};
+
+cmdline_parse_token_string_t cmd_ddp_get_list_ddp =
+       TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result, ddp, "ddp");
+cmdline_parse_token_string_t cmd_ddp_get_list_get =
+       TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result, get, "get");
+cmdline_parse_token_string_t cmd_ddp_get_list_list =
+       TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result, list, "list");
+cmdline_parse_token_num_t cmd_ddp_get_list_port_id =
+       TOKEN_NUM_INITIALIZER(struct cmd_ddp_get_list_result, port_id, UINT8);
+
+static void
+cmd_ddp_get_list_parsed(
+       void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_ddp_get_list_result *res = parsed_result;
+#ifdef RTE_LIBRTE_I40E_PMD
+       struct rte_pmd_i40e_profile_list *p_list;
+       struct rte_pmd_i40e_profile_info *p_info;
+       uint32_t p_num;
+       uint32_t size;
+       uint32_t i;
+#endif
+       int ret = -ENOTSUP;
+
+       if (res->port_id > nb_ports) {
+               printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
+               return;
+       }
+
+#ifdef RTE_LIBRTE_I40E_PMD
+       size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
+       p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
+       if (!p_list)
+               printf("%s: Failed to malloc buffer\n", __func__);
+
+       if (ret == -ENOTSUP)
+               ret = rte_pmd_i40e_get_ddp_list(res->port_id,
+                                               (uint8_t *)p_list, size);
+
+       if (!ret) {
+               p_num = p_list->p_count;
+               printf("Profile number is: %d\n\n", p_num);
+
+               for (i = 0; i < p_num; i++) {
+                       p_info = &p_list->p_info[i];
+                       printf("Profile %d:\n", i);
+                       printf("Track id:     0x%x\n", p_info->track_id);
+                       printf("Version:      %d.%d.%d.%d\n",
+                              p_info->version.major,
+                              p_info->version.minor,
+                              p_info->version.update,
+                              p_info->version.draft);
+                       printf("Profile name: %s\n\n", p_info->name);
+               }
+       }
+
+       free(p_list);
+#endif
+
+       if (ret < 0)
+               printf("Failed to get ddp list\n");
+}
+
+cmdline_parse_inst_t cmd_ddp_get_list = {
+       .f = cmd_ddp_get_list_parsed,
+       .data = NULL,
+       .help_str = "ddp get list <port_id>",
+       .tokens = {
+               (void *)&cmd_ddp_get_list_ddp,
+               (void *)&cmd_ddp_get_list_get,
+               (void *)&cmd_ddp_get_list_list,
+               (void *)&cmd_ddp_get_list_port_id,
+               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 */
+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,
+       (cmdline_parse_inst_t *)&cmd_showcfg,
+       (cmdline_parse_inst_t *)&cmd_start,
+       (cmdline_parse_inst_t *)&cmd_start_tx_first,
+       (cmdline_parse_inst_t *)&cmd_start_tx_first_n,
+       (cmdline_parse_inst_t *)&cmd_set_link_up,
+       (cmdline_parse_inst_t *)&cmd_set_link_down,
+       (cmdline_parse_inst_t *)&cmd_reset,
+       (cmdline_parse_inst_t *)&cmd_set_numbers,
+       (cmdline_parse_inst_t *)&cmd_set_txpkts,
+       (cmdline_parse_inst_t *)&cmd_set_txsplit,
+       (cmdline_parse_inst_t *)&cmd_set_fwd_list,
+       (cmdline_parse_inst_t *)&cmd_set_fwd_mask,
+       (cmdline_parse_inst_t *)&cmd_set_fwd_mode,
+       (cmdline_parse_inst_t *)&cmd_set_fwd_retry_mode,
+       (cmdline_parse_inst_t *)&cmd_set_burst_tx_retry,
+       (cmdline_parse_inst_t *)&cmd_set_promisc_mode_one,
+       (cmdline_parse_inst_t *)&cmd_set_promisc_mode_all,
+       (cmdline_parse_inst_t *)&cmd_set_allmulti_mode_one,
+       (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,
+       (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,
+#ifdef RTE_LIBRTE_PMD_BOND
+       (cmdline_parse_inst_t *) &cmd_set_bonding_mode,
+       (cmdline_parse_inst_t *) &cmd_show_bonding_config,
+       (cmdline_parse_inst_t *) &cmd_set_bonding_primary,
+       (cmdline_parse_inst_t *) &cmd_add_bonding_slave,
+       (cmdline_parse_inst_t *) &cmd_remove_bonding_slave,
+       (cmdline_parse_inst_t *) &cmd_create_bonded_device,
+       (cmdline_parse_inst_t *) &cmd_set_bond_mac_addr,
+       (cmdline_parse_inst_t *) &cmd_set_balance_xmit_policy,
+       (cmdline_parse_inst_t *) &cmd_set_bond_mon_period,
+#endif
+       (cmdline_parse_inst_t *)&cmd_vlan_offload,
+       (cmdline_parse_inst_t *)&cmd_vlan_tpid,
        (cmdline_parse_inst_t *)&cmd_rx_vlan_filter_all,
        (cmdline_parse_inst_t *)&cmd_rx_vlan_filter,
        (cmdline_parse_inst_t *)&cmd_tx_vlan_set,
@@ -11977,15 +13749,11 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_config_burst,
        (cmdline_parse_inst_t *)&cmd_config_thresh,
        (cmdline_parse_inst_t *)&cmd_config_threshold,
-       (cmdline_parse_inst_t *)&cmd_set_vf_rxmode,
        (cmdline_parse_inst_t *)&cmd_set_uc_hash_filter,
        (cmdline_parse_inst_t *)&cmd_set_uc_all_hash_filter,
        (cmdline_parse_inst_t *)&cmd_vf_mac_addr_filter,
        (cmdline_parse_inst_t *)&cmd_set_vf_macvlan_filter,
-       (cmdline_parse_inst_t *)&cmd_set_vf_traffic,
-       (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
        (cmdline_parse_inst_t *)&cmd_queue_rate_limit,
-       (cmdline_parse_inst_t *)&cmd_vf_rate_limit,
        (cmdline_parse_inst_t *)&cmd_tunnel_filter,
        (cmdline_parse_inst_t *)&cmd_tunnel_udp_config,
        (cmdline_parse_inst_t *)&cmd_global_config,
@@ -12032,23 +13800,65 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_config_e_tag_forwarding_en_dis,
        (cmdline_parse_inst_t *)&cmd_config_e_tag_filter_add,
        (cmdline_parse_inst_t *)&cmd_config_e_tag_filter_del,
-#ifdef RTE_LIBRTE_IXGBE_PMD
        (cmdline_parse_inst_t *)&cmd_set_vf_vlan_anti_spoof,
        (cmdline_parse_inst_t *)&cmd_set_vf_mac_anti_spoof,
        (cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq,
        (cmdline_parse_inst_t *)&cmd_set_vf_vlan_insert,
        (cmdline_parse_inst_t *)&cmd_set_tx_loopback,
+#ifdef RTE_LIBRTE_IXGBE_PMD
        (cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en,
        (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en,
-       (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
        (cmdline_parse_inst_t *)&cmd_set_macsec_offload_on,
        (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_traffic,
 #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,
+       (cmdline_parse_inst_t *)&cmd_set_vf_allmulti,
+       (cmdline_parse_inst_t *)&cmd_set_vf_broadcast,
+       (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag,
+       (cmdline_parse_inst_t *)&cmd_vf_max_bw,
+       (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)
@@ -12077,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;