app/testpmd: set fixed flag for exact link speed
[dpdk.git] / app / test-pmd / cmdline.c
index 51704b5..691d818 100644 (file)
@@ -225,6 +225,11 @@ static void cmd_help_long_parsed(void *parsed_result,
                         "show port tm node stats (port_id) (node_id) (clear)\n"
                         "       Display the port TM node stats.\n\n"
 
+                       "show fwd stats all\n"
+                       "    Display statistics for all fwd engines.\n\n"
+
+                       "clear fwd stats all\n"
+                       "    Clear statistics for all fwd engines.\n\n"
                );
        }
 
@@ -371,12 +376,12 @@ static void cmd_help_long_parsed(void *parsed_result,
                        "filtered for VF(s) from port_id.\n\n"
 
                        "tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) "
-                       "(inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|"
+                       "(inner_vlan) (vxlan|nvgre|ipingre|vxlan-gpe) (imac-ivlan|imac-ivlan-tenid|"
                        "imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n"
                        "   add a tunnel filter of a port.\n\n"
 
                        "tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) "
-                       "(inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|"
+                       "(inner_vlan) (vxlan|nvgre|ipingre|vxlan-gpe) (imac-ivlan|imac-ivlan-tenid|"
                        "imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)\n"
                        "   remove a tunnel filter of a port.\n\n"
 
@@ -794,6 +799,12 @@ static void cmd_help_long_parsed(void *parsed_result,
                        " eth-dst (eth-dst)\n"
                        "       Configure the VXLAN encapsulation for flows.\n\n"
 
+                       "vxlan-tos-ttl ip-version (ipv4|ipv6) vni (vni) udp-src"
+                       " (udp-src) udp-dst (udp-dst) ip-tos (ip-tos) ip-ttl (ip-ttl)"
+                       " ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src)"
+                       " eth-dst (eth-dst)\n"
+                       "       Configure the VXLAN encapsulation for flows.\n\n"
+
                        "nvgre ip-version (ipv4|ipv6) tni (tni) ip-src"
                        " (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst"
                        " (eth-dst)\n"
@@ -852,7 +863,7 @@ static void cmd_help_long_parsed(void *parsed_result,
                        " for ports.\n\n"
 
                        "port config all rss (all|default|ip|tcp|udp|sctp|"
-                       "ether|port|vxlan|geneve|nvgre|none|<flowtype_id>)\n"
+                       "ether|port|vxlan|geneve|nvgre|vxlan-gpe|none|<flowtype_id>)\n"
                        "    Set the RSS mode.\n\n"
 
                        "port config port-id rss reta (hash,queue)[,(hash,queue)]\n"
@@ -1429,17 +1440,17 @@ parse_and_check_speed_duplex(char *speedstr, char *duplexstr, uint32_t *speed)
                        return -1;
                }
                if (!strcmp(speedstr, "1000")) {
-                       *speed = ETH_LINK_SPEED_1G;
+                       *speed = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_FIXED;
                } else if (!strcmp(speedstr, "10000")) {
-                       *speed = ETH_LINK_SPEED_10G;
+                       *speed = ETH_LINK_SPEED_10G | ETH_LINK_SPEED_FIXED;
                } else if (!strcmp(speedstr, "25000")) {
-                       *speed = ETH_LINK_SPEED_25G;
+                       *speed = ETH_LINK_SPEED_25G | ETH_LINK_SPEED_FIXED;
                } else if (!strcmp(speedstr, "40000")) {
-                       *speed = ETH_LINK_SPEED_40G;
+                       *speed = ETH_LINK_SPEED_40G | ETH_LINK_SPEED_FIXED;
                } else if (!strcmp(speedstr, "50000")) {
-                       *speed = ETH_LINK_SPEED_50G;
+                       *speed = ETH_LINK_SPEED_50G | ETH_LINK_SPEED_FIXED;
                } else if (!strcmp(speedstr, "100000")) {
-                       *speed = ETH_LINK_SPEED_100G;
+                       *speed = ETH_LINK_SPEED_100G | ETH_LINK_SPEED_FIXED;
                } else if (!strcmp(speedstr, "auto")) {
                        *speed = ETH_LINK_SPEED_AUTONEG;
                } else {
@@ -2179,7 +2190,7 @@ cmdline_parse_inst_t cmd_config_rss = {
        .f = cmd_config_rss_parsed,
        .data = NULL,
        .help_str = "port config all rss "
-               "all|default|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none|<flowtype_id>",
+               "all|default|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|none|<flowtype_id>",
        .tokens = {
                (void *)&cmd_config_rss_port,
                (void *)&cmd_config_rss_keyword,
@@ -7380,6 +7391,49 @@ cmdline_parse_inst_t cmd_showqueue = {
        },
 };
 
+/* show/clear fwd engine statistics */
+struct fwd_result {
+       cmdline_fixed_string_t action;
+       cmdline_fixed_string_t fwd;
+       cmdline_fixed_string_t stats;
+       cmdline_fixed_string_t all;
+};
+
+cmdline_parse_token_string_t cmd_fwd_action =
+       TOKEN_STRING_INITIALIZER(struct fwd_result, action, "show#clear");
+cmdline_parse_token_string_t cmd_fwd_fwd =
+       TOKEN_STRING_INITIALIZER(struct fwd_result, fwd, "fwd");
+cmdline_parse_token_string_t cmd_fwd_stats =
+       TOKEN_STRING_INITIALIZER(struct fwd_result, stats, "stats");
+cmdline_parse_token_string_t cmd_fwd_all =
+       TOKEN_STRING_INITIALIZER(struct fwd_result, all, "all");
+
+static void
+cmd_showfwdall_parsed(void *parsed_result,
+                     __rte_unused struct cmdline *cl,
+                     __rte_unused void *data)
+{
+       struct fwd_result *res = parsed_result;
+
+       if (!strcmp(res->action, "show"))
+               fwd_stats_display();
+       else
+               fwd_stats_reset();
+}
+
+static cmdline_parse_inst_t cmd_showfwdall = {
+       .f = cmd_showfwdall_parsed,
+       .data = NULL,
+       .help_str = "show|clear fwd stats all",
+       .tokens = {
+               (void *)&cmd_fwd_action,
+               (void *)&cmd_fwd_fwd,
+               (void *)&cmd_fwd_stats,
+               (void *)&cmd_fwd_all,
+               NULL,
+       },
+};
+
 /* *** READ PORT REGISTER *** */
 struct cmd_read_reg_result {
        cmdline_fixed_string_t read;
@@ -8704,6 +8758,8 @@ cmd_tunnel_filter_parsed(void *parsed_result,
 
        if (!strcmp(res->tunnel_type, "vxlan"))
                tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN;
+       else if (!strcmp(res->tunnel_type, "vxlan-gpe"))
+               tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_VXLAN_GPE;
        else if (!strcmp(res->tunnel_type, "nvgre"))
                tunnel_filter_conf.tunnel_type = RTE_TUNNEL_TYPE_NVGRE;
        else if (!strcmp(res->tunnel_type, "ipingre"))
@@ -8753,7 +8809,7 @@ cmdline_parse_token_ipaddr_t cmd_tunnel_filter_ip_value =
        ip_value);
 cmdline_parse_token_string_t cmd_tunnel_filter_tunnel_type =
        TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result,
-       tunnel_type, "vxlan#nvgre#ipingre");
+       tunnel_type, "vxlan#nvgre#ipingre#vxlan-gpe");
 
 cmdline_parse_token_string_t cmd_tunnel_filter_filter_type =
        TOKEN_STRING_INITIALIZER(struct cmd_tunnel_filter_result,
@@ -8877,6 +8933,8 @@ cmd_cfg_tunnel_udp_port_parsed(void *parsed_result,
                tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN;
        } else if (!strcmp(res->tunnel_type, "geneve")) {
                tunnel_udp.prot_type = RTE_TUNNEL_TYPE_GENEVE;
+       } else if (!strcmp(res->tunnel_type, "vxlan-gpe")) {
+               tunnel_udp.prot_type = RTE_TUNNEL_TYPE_VXLAN_GPE;
        } else {
                printf("Invalid tunnel type\n");
                return;
@@ -8911,7 +8969,7 @@ cmdline_parse_token_string_t cmd_config_tunnel_udp_port_action =
                                 "add#rm");
 cmdline_parse_token_string_t cmd_config_tunnel_udp_port_tunnel_type =
        TOKEN_STRING_INITIALIZER(struct cmd_config_tunnel_udp_port, tunnel_type,
-                                "vxlan#geneve");
+                                "vxlan#geneve#vxlan-gpe");
 cmdline_parse_token_num_t cmd_config_tunnel_udp_port_value =
        TOKEN_NUM_INITIALIZER(struct cmd_config_tunnel_udp_port, udp_port,
                              UINT16);
@@ -8919,7 +8977,7 @@ cmdline_parse_token_num_t cmd_config_tunnel_udp_port_value =
 cmdline_parse_inst_t cmd_cfg_tunnel_udp_port = {
        .f = cmd_cfg_tunnel_udp_port_parsed,
        .data = NULL,
-       .help_str = "port config <port_id> udp_tunnel_port add|rm vxlan|geneve <udp_port>",
+       .help_str = "port config <port_id> udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe <udp_port>",
        .tokens = {
                (void *)&cmd_config_tunnel_udp_port_port,
                (void *)&cmd_config_tunnel_udp_port_config,
@@ -11933,6 +11991,7 @@ flowtype_to_str(uint16_t ftype)
                {"vxlan", RTE_ETH_FLOW_VXLAN},
                {"geneve", RTE_ETH_FLOW_GENEVE},
                {"nvgre", RTE_ETH_FLOW_NVGRE},
+               {"vxlan-gpe", RTE_ETH_FLOW_VXLAN_GPE},
        };
 
        for (i = 0; i < RTE_DIM(ftype_table); i++) {
@@ -12070,7 +12129,7 @@ cmd_set_hash_global_config_parsed(void *parsed_result,
                                                        res->port_id);
        else
                printf("Global hash configurations have been set "
-                       "succcessfully by port %d\n", res->port_id);
+                       "successfully by port %d\n", res->port_id);
 }
 
 cmdline_parse_token_string_t cmd_set_hash_global_config_all =
@@ -15034,6 +15093,8 @@ struct cmd_set_vxlan_result {
        cmdline_ipaddr_t ip_src;
        cmdline_ipaddr_t ip_dst;
        uint16_t tci;
+       uint8_t tos;
+       uint8_t ttl;
        struct ether_addr eth_src;
        struct ether_addr eth_dst;
 };
@@ -15042,6 +15103,9 @@ cmdline_parse_token_string_t cmd_set_vxlan_set =
        TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, set, "set");
 cmdline_parse_token_string_t cmd_set_vxlan_vxlan =
        TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, vxlan, "vxlan");
+cmdline_parse_token_string_t cmd_set_vxlan_vxlan_tos_ttl =
+       TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, vxlan,
+                                "vxlan-tos-ttl");
 cmdline_parse_token_string_t cmd_set_vxlan_vxlan_with_vlan =
        TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, vxlan,
                                 "vxlan-with-vlan");
@@ -15066,6 +15130,16 @@ cmdline_parse_token_string_t cmd_set_vxlan_udp_dst =
                                 "udp-dst");
 cmdline_parse_token_num_t cmd_set_vxlan_udp_dst_value =
        TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, udp_dst, UINT16);
+cmdline_parse_token_string_t cmd_set_vxlan_ip_tos =
+       TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+                                "ip-tos");
+cmdline_parse_token_num_t cmd_set_vxlan_ip_tos_value =
+       TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, tos, UINT8);
+cmdline_parse_token_string_t cmd_set_vxlan_ip_ttl =
+       TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+                                "ip-ttl");
+cmdline_parse_token_num_t cmd_set_vxlan_ip_ttl_value =
+       TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, ttl, UINT8);
 cmdline_parse_token_string_t cmd_set_vxlan_ip_src =
        TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
                                 "ip-src");
@@ -15104,10 +15178,15 @@ static void cmd_set_vxlan_parsed(void *parsed_result,
                .vxlan_id = rte_cpu_to_be_32(res->vni) & RTE_BE32(0x00ffffff),
        };
 
+       vxlan_encap_conf.select_tos_ttl = 0;
        if (strcmp(res->vxlan, "vxlan") == 0)
                vxlan_encap_conf.select_vlan = 0;
        else if (strcmp(res->vxlan, "vxlan-with-vlan") == 0)
                vxlan_encap_conf.select_vlan = 1;
+       else if (strcmp(res->vxlan, "vxlan-tos-ttl") == 0) {
+               vxlan_encap_conf.select_vlan = 0;
+               vxlan_encap_conf.select_tos_ttl = 1;
+       }
        if (strcmp(res->ip_version, "ipv4") == 0)
                vxlan_encap_conf.select_ipv4 = 1;
        else if (strcmp(res->ip_version, "ipv6") == 0)
@@ -15117,6 +15196,8 @@ static void cmd_set_vxlan_parsed(void *parsed_result,
        rte_memcpy(vxlan_encap_conf.vni, &id.vni[1], 3);
        vxlan_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src);
        vxlan_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst);
+       vxlan_encap_conf.ip_tos = res->tos;
+       vxlan_encap_conf.ip_ttl = res->ttl;
        if (vxlan_encap_conf.select_ipv4) {
                IPV4_ADDR_TO_UINT(res->ip_src, vxlan_encap_conf.ipv4_src);
                IPV4_ADDR_TO_UINT(res->ip_dst, vxlan_encap_conf.ipv4_dst);
@@ -15161,6 +15242,40 @@ cmdline_parse_inst_t cmd_set_vxlan = {
        },
 };
 
+cmdline_parse_inst_t cmd_set_vxlan_tos_ttl = {
+       .f = cmd_set_vxlan_parsed,
+       .data = NULL,
+       .help_str = "set vxlan-tos-ttl ip-version ipv4|ipv6 vni <vni> udp-src"
+               " <udp-src> udp-dst <udp-dst> ip-tos <ip-tos> ip-ttl <ip-ttl>"
+               " ip-src <ip-src> ip-dst <ip-dst> eth-src <eth-src>"
+               " eth-dst <eth-dst>",
+       .tokens = {
+               (void *)&cmd_set_vxlan_set,
+               (void *)&cmd_set_vxlan_vxlan_tos_ttl,
+               (void *)&cmd_set_vxlan_ip_version,
+               (void *)&cmd_set_vxlan_ip_version_value,
+               (void *)&cmd_set_vxlan_vni,
+               (void *)&cmd_set_vxlan_vni_value,
+               (void *)&cmd_set_vxlan_udp_src,
+               (void *)&cmd_set_vxlan_udp_src_value,
+               (void *)&cmd_set_vxlan_udp_dst,
+               (void *)&cmd_set_vxlan_udp_dst_value,
+               (void *)&cmd_set_vxlan_ip_tos,
+               (void *)&cmd_set_vxlan_ip_tos_value,
+               (void *)&cmd_set_vxlan_ip_ttl,
+               (void *)&cmd_set_vxlan_ip_ttl_value,
+               (void *)&cmd_set_vxlan_ip_src,
+               (void *)&cmd_set_vxlan_ip_src_value,
+               (void *)&cmd_set_vxlan_ip_dst,
+               (void *)&cmd_set_vxlan_ip_dst_value,
+               (void *)&cmd_set_vxlan_eth_src,
+               (void *)&cmd_set_vxlan_eth_src_value,
+               (void *)&cmd_set_vxlan_eth_dst,
+               (void *)&cmd_set_vxlan_eth_dst_value,
+               NULL,
+       },
+};
+
 cmdline_parse_inst_t cmd_set_vxlan_with_vlan = {
        .f = cmd_set_vxlan_parsed,
        .data = NULL,
@@ -18497,6 +18612,7 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_showqueue,
        (cmdline_parse_inst_t *)&cmd_showportall,
        (cmdline_parse_inst_t *)&cmd_showcfg,
+       (cmdline_parse_inst_t *)&cmd_showfwdall,
        (cmdline_parse_inst_t *)&cmd_start,
        (cmdline_parse_inst_t *)&cmd_start_tx_first,
        (cmdline_parse_inst_t *)&cmd_start_tx_first_n,
@@ -18696,6 +18812,7 @@ cmdline_parse_ctx_t main_ctx[] = {
        (cmdline_parse_inst_t *)&cmd_set_port_tm_hierarchy_default,
 #endif
        (cmdline_parse_inst_t *)&cmd_set_vxlan,
+       (cmdline_parse_inst_t *)&cmd_set_vxlan_tos_ttl,
        (cmdline_parse_inst_t *)&cmd_set_vxlan_with_vlan,
        (cmdline_parse_inst_t *)&cmd_set_nvgre,
        (cmdline_parse_inst_t *)&cmd_set_nvgre_with_vlan,