app/testpmd: fix command token
[dpdk.git] / app / test-pmd / cmdline.c
index 1e06dcd..a0c1905 100644 (file)
@@ -60,7 +60,7 @@
 #include <rte_eth_bond.h>
 #include <rte_eth_bond_8023ad.h>
 #endif
-#ifdef RTE_LIBRTE_DPAA_PMD
+#if defined RTE_LIBRTE_DPAA_BUS && defined RTE_LIBRTE_DPAA_PMD
 #include <rte_pmd_dpaa.h>
 #endif
 #ifdef RTE_LIBRTE_IXGBE_PMD
@@ -645,10 +645,10 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "       Set default traffic Management hierarchy on a port\n\n"
 
 #endif
-                       "ddp add (port_id) (profile_path[,output_path])\n"
+                       "ddp add (port_id) (profile_path[,backup_profile_path])\n"
                        "    Load a profile package on a port\n\n"
 
-                       "ddp del (port_id) (profile_path)\n"
+                       "ddp del (port_id) (backup_profile_path)\n"
                        "    Delete a profile package from a port\n\n"
 
                        "ptype mapping get (port_id) (valid_only)\n"
@@ -806,6 +806,9 @@ static void cmd_help_long_parsed(void *parsed_result,
                        " duplex (half|full|auto)\n"
                        "    Set speed and duplex for all ports or port_id\n\n"
 
+                       "port config (port_id|all) loopback (mode)\n"
+                       "    Set loopback mode for all ports or port_id\n\n"
+
                        "port config all (rxq|txq|rxd|txd) (value)\n"
                        "    Set number for rxq/txq/rxd/txd.\n\n"
 
@@ -818,8 +821,8 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "    Set crc-strip/scatter/rx-checksum/hardware-vlan/drop_en"
                        " for ports.\n\n"
 
-                       "port config all rss (all|ip|tcp|udp|sctp|ether|port|vxlan|"
-                       "geneve|nvgre|none|<flowtype_id>)\n"
+                       "port config all rss (all|default|ip|tcp|udp|sctp|"
+                       "ether|port|vxlan|geneve|nvgre|none|<flowtype_id>)\n"
                        "    Set the RSS mode.\n\n"
 
                        "port config port-id rss reta (hash,queue)[,(hash,queue)]\n"
@@ -1415,7 +1418,7 @@ cmdline_parse_inst_t cmd_config_speed_all = {
 struct cmd_config_speed_specific {
        cmdline_fixed_string_t port;
        cmdline_fixed_string_t keyword;
-       uint8_t id;
+       portid_t id;
        cmdline_fixed_string_t item1;
        cmdline_fixed_string_t item2;
        cmdline_fixed_string_t value1;
@@ -1455,7 +1458,7 @@ cmdline_parse_token_string_t cmd_config_speed_specific_keyword =
        TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific, keyword,
                                                                "config");
 cmdline_parse_token_num_t cmd_config_speed_specific_id =
-       TOKEN_NUM_INITIALIZER(struct cmd_config_speed_specific, id, UINT8);
+       TOKEN_NUM_INITIALIZER(struct cmd_config_speed_specific, id, UINT16);
 cmdline_parse_token_string_t cmd_config_speed_specific_item1 =
        TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific, item1,
                                                                "speed");
@@ -1487,6 +1490,122 @@ cmdline_parse_inst_t cmd_config_speed_specific = {
        },
 };
 
+/* *** configure loopback for all ports *** */
+struct cmd_config_loopback_all {
+       cmdline_fixed_string_t port;
+       cmdline_fixed_string_t keyword;
+       cmdline_fixed_string_t all;
+       cmdline_fixed_string_t item;
+       uint32_t mode;
+};
+
+static void
+cmd_config_loopback_all_parsed(void *parsed_result,
+                       __attribute__((unused)) struct cmdline *cl,
+                       __attribute__((unused)) void *data)
+{
+       struct cmd_config_loopback_all *res = parsed_result;
+       portid_t pid;
+
+       if (!all_ports_stopped()) {
+               printf("Please stop all ports first\n");
+               return;
+       }
+
+       RTE_ETH_FOREACH_DEV(pid) {
+               ports[pid].dev_conf.lpbk_mode = res->mode;
+       }
+
+       cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);
+}
+
+cmdline_parse_token_string_t cmd_config_loopback_all_port =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_all, port, "port");
+cmdline_parse_token_string_t cmd_config_loopback_all_keyword =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_all, keyword,
+                                                       "config");
+cmdline_parse_token_string_t cmd_config_loopback_all_all =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_all, all, "all");
+cmdline_parse_token_string_t cmd_config_loopback_all_item =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_all, item,
+                                                       "loopback");
+cmdline_parse_token_num_t cmd_config_loopback_all_mode =
+       TOKEN_NUM_INITIALIZER(struct cmd_config_loopback_all, mode, UINT32);
+
+cmdline_parse_inst_t cmd_config_loopback_all = {
+       .f = cmd_config_loopback_all_parsed,
+       .data = NULL,
+       .help_str = "port config all loopback <mode>",
+       .tokens = {
+               (void *)&cmd_config_loopback_all_port,
+               (void *)&cmd_config_loopback_all_keyword,
+               (void *)&cmd_config_loopback_all_all,
+               (void *)&cmd_config_loopback_all_item,
+               (void *)&cmd_config_loopback_all_mode,
+               NULL,
+       },
+};
+
+/* *** configure loopback for specific port *** */
+struct cmd_config_loopback_specific {
+       cmdline_fixed_string_t port;
+       cmdline_fixed_string_t keyword;
+       uint16_t port_id;
+       cmdline_fixed_string_t item;
+       uint32_t mode;
+};
+
+static void
+cmd_config_loopback_specific_parsed(void *parsed_result,
+                               __attribute__((unused)) struct cmdline *cl,
+                               __attribute__((unused)) void *data)
+{
+       struct cmd_config_loopback_specific *res = parsed_result;
+
+       if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+               return;
+
+       if (!port_is_stopped(res->port_id)) {
+               printf("Please stop port %u first\n", res->port_id);
+               return;
+       }
+
+       ports[res->port_id].dev_conf.lpbk_mode = res->mode;
+
+       cmd_reconfig_device_queue(res->port_id, 1, 1);
+}
+
+
+cmdline_parse_token_string_t cmd_config_loopback_specific_port =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_specific, port,
+                                                               "port");
+cmdline_parse_token_string_t cmd_config_loopback_specific_keyword =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_specific, keyword,
+                                                               "config");
+cmdline_parse_token_num_t cmd_config_loopback_specific_id =
+       TOKEN_NUM_INITIALIZER(struct cmd_config_loopback_specific, port_id,
+                                                               UINT16);
+cmdline_parse_token_string_t cmd_config_loopback_specific_item =
+       TOKEN_STRING_INITIALIZER(struct cmd_config_loopback_specific, item,
+                                                               "loopback");
+cmdline_parse_token_num_t cmd_config_loopback_specific_mode =
+       TOKEN_NUM_INITIALIZER(struct cmd_config_loopback_specific, mode,
+                             UINT32);
+
+cmdline_parse_inst_t cmd_config_loopback_specific = {
+       .f = cmd_config_loopback_specific_parsed,
+       .data = NULL,
+       .help_str = "port config <port_id> loopback <mode>",
+       .tokens = {
+               (void *)&cmd_config_loopback_specific_port,
+               (void *)&cmd_config_loopback_specific_keyword,
+               (void *)&cmd_config_loopback_specific_id,
+               (void *)&cmd_config_loopback_specific_item,
+               (void *)&cmd_config_loopback_specific_mode,
+               NULL,
+       },
+};
+
 /* *** configure txq/rxq, txd/rxd *** */
 struct cmd_config_rx_tx {
        cmdline_fixed_string_t port;
@@ -1879,8 +1998,9 @@ cmd_config_rss_parsed(void *parsed_result,
 {
        struct cmd_config_rss *res = parsed_result;
        struct rte_eth_rss_conf rss_conf = { .rss_key_len = 0, };
+       struct rte_eth_dev_info dev_info = { .flow_type_rss_offloads = 0, };
        int diag;
-       uint8_t i;
+       uint16_t i;
 
        if (!strcmp(res->value, "all"))
                rss_conf.rss_hf = ETH_RSS_IP | ETH_RSS_TCP |
@@ -1904,7 +2024,7 @@ cmd_config_rss_parsed(void *parsed_result,
                rss_conf.rss_hf = ETH_RSS_GENEVE;
        else if (!strcmp(res->value, "nvgre"))
                rss_conf.rss_hf = ETH_RSS_NVGRE;
-       else if (!strcmp(res->value, "none"))
+       else if (!strcmp(res->value, "none") || !strcmp(res->value, "default"))
                rss_conf.rss_hf = 0;
        else if (isdigit(res->value[0]) && atoi(res->value) > 0 &&
                                                atoi(res->value) < 64)
@@ -1914,7 +2034,13 @@ cmd_config_rss_parsed(void *parsed_result,
                return;
        }
        rss_conf.rss_key = NULL;
-       for (i = 0; i < rte_eth_dev_count(); i++) {
+       /* Update global configuration for RSS types. */
+       rss_hf = rss_conf.rss_hf;
+       RTE_ETH_FOREACH_DEV(i) {
+               if (!strcmp(res->value, "default")) {
+                       rte_eth_dev_info_get(i, &dev_info);
+                       rss_conf.rss_hf = dev_info.flow_type_rss_offloads;
+               }
                diag = rte_eth_dev_rss_hash_update(i, &rss_conf);
                if (diag < 0)
                        printf("Configuration of RSS hash at ethernet port %d "
@@ -1938,7 +2064,7 @@ cmdline_parse_inst_t cmd_config_rss = {
        .f = cmd_config_rss_parsed,
        .data = NULL,
        .help_str = "port config all rss "
-               "all|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none|<flowtype_id>",
+               "all|default|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none|<flowtype_id>",
        .tokens = {
                (void *)&cmd_config_rss_port,
                (void *)&cmd_config_rss_keyword,
@@ -2152,7 +2278,7 @@ cmdline_parse_inst_t cmd_config_rxtx_queue = {
        .data = NULL,
        .help_str = "port <port_id> rxq|txq <queue_id> start|stop",
        .tokens = {
-               (void *)&cmd_config_speed_all_port,
+               (void *)&cmd_config_rxtx_queue_port,
                (void *)&cmd_config_rxtx_queue_portid,
                (void *)&cmd_config_rxtx_queue_rxtxq,
                (void *)&cmd_config_rxtx_queue_qid,
@@ -2599,6 +2725,8 @@ cmd_config_burst_parsed(void *parsed_result,
                        __attribute__((unused)) void *data)
 {
        struct cmd_config_burst *res = parsed_result;
+       struct rte_eth_dev_info dev_info;
+       uint16_t rec_nb_pkts;
 
        if (!all_ports_stopped()) {
                printf("Please stop all ports first\n");
@@ -2606,11 +2734,34 @@ cmd_config_burst_parsed(void *parsed_result,
        }
 
        if (!strcmp(res->name, "burst")) {
-               if (res->value < 1 || res->value > MAX_PKT_BURST) {
+               if (res->value == 0) {
+                       /* If user gives a value of zero, query the PMD for
+                        * its recommended Rx burst size. Testpmd uses a single
+                        * size for all ports, so assume all ports are the same
+                        * NIC model and use the values from Port 0.
+                        */
+                       rte_eth_dev_info_get(0, &dev_info);
+                       rec_nb_pkts = dev_info.default_rxportconf.burst_size;
+
+                       if (rec_nb_pkts == 0) {
+                               printf("PMD does not recommend a burst size.\n"
+                                       "User provided value must be between"
+                                       " 1 and %d\n", MAX_PKT_BURST);
+                               return;
+                       } else if (rec_nb_pkts > MAX_PKT_BURST) {
+                               printf("PMD recommended burst size of %d"
+                                       " exceeds maximum value of %d\n",
+                                       rec_nb_pkts, MAX_PKT_BURST);
+                               return;
+                       }
+                       printf("Using PMD-provided burst value of %d\n",
+                               rec_nb_pkts);
+                       nb_pkt_per_burst = rec_nb_pkts;
+               } else if (res->value > MAX_PKT_BURST) {
                        printf("burst must be >= 1 && <= %d\n", MAX_PKT_BURST);
                        return;
-               }
-               nb_pkt_per_burst = res->value;
+               } else
+                       nb_pkt_per_burst = res->value;
        } else {
                printf("Unknown parameter\n");
                return;
@@ -4013,6 +4164,12 @@ check_tunnel_tso_nic_support(portid_t port_id)
        if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO))
                printf("Warning: GENEVE TUNNEL TSO not supported therefore "
                       "not enabled for port %d\n", port_id);
+       if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IP_TNL_TSO))
+               printf("Warning: IP TUNNEL TSO not supported therefore "
+                      "not enabled for port %d\n", port_id);
+       if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TNL_TSO))
+               printf("Warning: UDP TUNNEL TSO not supported therefore "
+                      "not enabled for port %d\n", port_id);
        return dev_info;
 }
 
@@ -4040,13 +4197,17 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,
                        ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
                          DEV_TX_OFFLOAD_GRE_TNL_TSO |
                          DEV_TX_OFFLOAD_IPIP_TNL_TSO |
-                         DEV_TX_OFFLOAD_GENEVE_TNL_TSO);
+                         DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+                         DEV_TX_OFFLOAD_IP_TNL_TSO |
+                         DEV_TX_OFFLOAD_UDP_TNL_TSO);
                printf("TSO for tunneled packets is disabled\n");
        } else {
                uint64_t tso_offloads = (DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
                                         DEV_TX_OFFLOAD_GRE_TNL_TSO |
                                         DEV_TX_OFFLOAD_IPIP_TNL_TSO |
-                                        DEV_TX_OFFLOAD_GENEVE_TNL_TSO);
+                                        DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+                                        DEV_TX_OFFLOAD_IP_TNL_TSO |
+                                        DEV_TX_OFFLOAD_UDP_TNL_TSO);
 
                ports[res->port_id].dev_conf.txmode.offloads |=
                        (tso_offloads & dev_info.tx_offload_capa);
@@ -5402,7 +5563,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
                                port_id);
 
                /* Update number of ports */
-               nb_ports = rte_eth_dev_count();
+               nb_ports = rte_eth_dev_count_avail();
                reconfig(port_id, res->socket);
                rte_eth_promiscuous_enable(port_id);
        }
@@ -5511,11 +5672,6 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result,
        struct cmd_set_bond_mon_period_result *res = parsed_result;
        int ret;
 
-       if (res->port_num >= nb_ports) {
-               printf("Port id %d must be less than %d\n", res->port_num, nb_ports);
-               return;
-       }
-
        ret = rte_eth_bond_link_monitoring_set(res->port_num, res->period_ms);
 
        /* check the return value and print it if is < 0 */
@@ -5572,12 +5728,6 @@ cmd_set_bonding_agg_mode(void *parsed_result,
        struct cmd_set_bonding_agg_mode_policy_result *res = parsed_result;
        uint8_t policy = AGG_BANDWIDTH;
 
-       if (res->port_num >= nb_ports) {
-               printf("Port id %d must be less than %d\n",
-                               res->port_num, nb_ports);
-               return;
-       }
-
        if (!strcmp(res->policy, "bandwidth"))
                policy = AGG_BANDWIDTH;
        else if (!strcmp(res->policy, "stable"))
@@ -8621,7 +8771,7 @@ static void cmd_dump_parsed(void *parsed_result,
        else if (!strcmp(res->dump, "dump_mempool"))
                rte_mempool_list_dump(stdout);
        else if (!strcmp(res->dump, "dump_devargs"))
-               rte_eal_devargs_dump(stdout);
+               rte_devargs_dump(stdout);
        else if (!strcmp(res->dump, "dump_log_types"))
                rte_log_dump(stdout);
 }
@@ -9900,11 +10050,11 @@ struct cmd_flow_director_result {
        uint16_t port_dst;
        cmdline_fixed_string_t verify_tag;
        uint32_t verify_tag_value;
-       cmdline_ipaddr_t tos;
+       cmdline_fixed_string_t tos;
        uint8_t tos_value;
-       cmdline_ipaddr_t proto;
+       cmdline_fixed_string_t proto;
        uint8_t proto_value;
-       cmdline_ipaddr_t ttl;
+       cmdline_fixed_string_t ttl;
        uint8_t ttl_value;
        cmdline_fixed_string_t vlan;
        uint16_t vlan_value;
@@ -10515,7 +10665,7 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
                (void *)&cmd_flow_director_flow_type,
                (void *)&cmd_flow_director_src,
                (void *)&cmd_flow_director_ip_src,
-               (void *)&cmd_flow_director_port_dst,
+               (void *)&cmd_flow_director_port_src,
                (void *)&cmd_flow_director_dst,
                (void *)&cmd_flow_director_ip_dst,
                (void *)&cmd_flow_director_port_dst,
@@ -10725,11 +10875,6 @@ cmd_flow_director_mask_parsed(void *parsed_result,
        struct rte_eth_fdir_masks *mask;
        struct rte_port *port;
 
-       if (res->port_id > nb_ports) {
-               printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
-               return;
-       }
-
        port = &ports[res->port_id];
        /** Check if the port is not started **/
        if (port->port_status != RTE_PORT_STOPPED) {
@@ -10926,11 +11071,6 @@ cmd_flow_director_flex_mask_parsed(void *parsed_result,
        uint16_t i;
        int ret;
 
-       if (res->port_id > nb_ports) {
-               printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
-               return;
-       }
-
        port = &ports[res->port_id];
        /** Check if the port is not started **/
        if (port->port_status != RTE_PORT_STOPPED) {
@@ -11082,11 +11222,6 @@ cmd_flow_director_flxpld_parsed(void *parsed_result,
        struct rte_port *port;
        int ret = 0;
 
-       if (res->port_id > nb_ports) {
-               printf("Invalid port, range is [0, %d]\n", nb_ports - 1);
-               return;
-       }
-
        port = &ports[res->port_id];
        /** Check if the port is not started **/
        if (port->port_status != RTE_PORT_STOPPED) {
@@ -11728,7 +11863,7 @@ struct cmd_config_l2_tunnel_eth_type_result {
        cmdline_fixed_string_t port;
        cmdline_fixed_string_t config;
        cmdline_fixed_string_t all;
-       uint8_t id;
+       portid_t id;
        cmdline_fixed_string_t l2_tunnel;
        cmdline_fixed_string_t l2_tunnel_type;
        cmdline_fixed_string_t eth_type;
@@ -11750,7 +11885,7 @@ cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_all_str =
 cmdline_parse_token_num_t cmd_config_l2_tunnel_eth_type_id =
        TOKEN_NUM_INITIALIZER
                (struct cmd_config_l2_tunnel_eth_type_result,
-                id, UINT8);
+                id, UINT16);
 cmdline_parse_token_string_t cmd_config_l2_tunnel_eth_type_l2_tunnel =
        TOKEN_STRING_INITIALIZER
                (struct cmd_config_l2_tunnel_eth_type_result,
@@ -11863,7 +11998,7 @@ struct cmd_config_l2_tunnel_en_dis_result {
        cmdline_fixed_string_t port;
        cmdline_fixed_string_t config;
        cmdline_fixed_string_t all;
-       uint8_t id;
+       portid_t id;
        cmdline_fixed_string_t l2_tunnel;
        cmdline_fixed_string_t l2_tunnel_type;
        cmdline_fixed_string_t en_dis;
@@ -11884,7 +12019,7 @@ cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_all_str =
 cmdline_parse_token_num_t cmd_config_l2_tunnel_en_dis_id =
        TOKEN_NUM_INITIALIZER
                (struct cmd_config_l2_tunnel_en_dis_result,
-                id, UINT8);
+                id, UINT16);
 cmdline_parse_token_string_t cmd_config_l2_tunnel_en_dis_l2_tunnel =
        TOKEN_STRING_INITIALIZER
                (struct cmd_config_l2_tunnel_en_dis_result,
@@ -12861,7 +12996,7 @@ cmd_set_tx_loopback_parsed(
        if (ret == -ENOTSUP)
                ret = rte_pmd_bnxt_set_tx_loopback(res->port_id, is_on);
 #endif
-#ifdef RTE_LIBRTE_DPAA_PMD
+#if defined RTE_LIBRTE_DPAA_BUS && defined RTE_LIBRTE_DPAA_PMD
        if (ret == -ENOTSUP)
                ret = rte_pmd_dpaa_set_tx_loopback(res->port_id, is_on);
 #endif
@@ -14467,11 +14602,6 @@ cmd_ddp_add_parsed(
        int file_num;
        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;
@@ -14511,7 +14641,7 @@ cmd_ddp_add_parsed(
 cmdline_parse_inst_t cmd_ddp_add = {
        .f = cmd_ddp_add_parsed,
        .data = NULL,
-       .help_str = "ddp add <port_id> <profile_path[,output_path]>",
+       .help_str = "ddp add <port_id> <profile_path[,backup_profile_path]>",
        .tokens = {
                (void *)&cmd_ddp_add_ddp,
                (void *)&cmd_ddp_add_add,
@@ -14549,11 +14679,6 @@ cmd_ddp_del_parsed(
        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;
@@ -14581,7 +14706,7 @@ cmd_ddp_del_parsed(
 cmdline_parse_inst_t cmd_ddp_del = {
        .f = cmd_ddp_del_parsed,
        .data = NULL,
-       .help_str = "ddp del <port_id> <profile_path>",
+       .help_str = "ddp del <port_id> <backup_profile_path>",
        .tokens = {
                (void *)&cmd_ddp_del_ddp,
                (void *)&cmd_ddp_del_del,
@@ -14850,12 +14975,12 @@ cmdline_parse_token_num_t cmd_ddp_get_list_port_id =
 
 static void
 cmd_ddp_get_list_parsed(
-       void *parsed_result,
+       __attribute__((unused)) 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 cmd_ddp_get_list_result *res = parsed_result;
        struct rte_pmd_i40e_profile_list *p_list;
        struct rte_pmd_i40e_profile_info *p_info;
        uint32_t p_num;
@@ -14864,11 +14989,6 @@ cmd_ddp_get_list_parsed(
 #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);
@@ -14931,22 +15051,17 @@ struct cmd_cfg_input_set_result {
 
 static void
 cmd_cfg_input_set_parsed(
-       void *parsed_result,
+       __attribute__((unused)) void *parsed_result,
        __attribute__((unused)) struct cmdline *cl,
        __attribute__((unused)) void *data)
 {
-       struct cmd_cfg_input_set_result *res = parsed_result;
 #ifdef RTE_LIBRTE_I40E_PMD
+       struct cmd_cfg_input_set_result *res = parsed_result;
        enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
        struct rte_pmd_i40e_inset inset;
 #endif
        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;
@@ -15059,22 +15174,17 @@ struct cmd_clear_input_set_result {
 
 static void
 cmd_clear_input_set_parsed(
-       void *parsed_result,
+       __attribute__((unused)) void *parsed_result,
        __attribute__((unused)) struct cmdline *cl,
        __attribute__((unused)) void *data)
 {
-       struct cmd_clear_input_set_result *res = parsed_result;
 #ifdef RTE_LIBRTE_I40E_PMD
+       struct cmd_clear_input_set_result *res = parsed_result;
        enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
        struct rte_pmd_i40e_inset inset;
 #endif
        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;
@@ -16130,6 +16240,8 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_operate_detach_port,
        (cmdline_parse_inst_t *)&cmd_config_speed_all,
        (cmdline_parse_inst_t *)&cmd_config_speed_specific,
+       (cmdline_parse_inst_t *)&cmd_config_loopback_all,
+       (cmdline_parse_inst_t *)&cmd_config_loopback_specific,
        (cmdline_parse_inst_t *)&cmd_config_rx_tx,
        (cmdline_parse_inst_t *)&cmd_config_mtu,
        (cmdline_parse_inst_t *)&cmd_config_max_pkt_len,