X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Fcmdline.c;h=2ab03c11131631f4d8c8f48b7192c99643ccc4a9;hb=169a9fed1f4cbca7e432fdc9ad1d44922ad783f6;hp=1275074108768bc92aab0418d1661dc733e095f5;hpb=054075ea9031edb5d3355cb76e821c0794410ca4;p=dpdk.git diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 1275074108..2ab03c1113 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -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|)\n" + "ether|port|vxlan|geneve|nvgre|vxlan-gpe|none|)\n" " Set the RSS mode.\n\n" "port config port-id rss reta (hash,queue)[,(hash,queue)]\n" @@ -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|", + "all|default|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|none|", .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 udp_tunnel_port add|rm vxlan|geneve ", + .help_str = "port config udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe ", .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 udp-src" + " udp-dst ip-tos ip-ttl " + " ip-src ip-dst eth-src " + " 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, @@ -15567,10 +15682,9 @@ static void cmd_set_mplsogre_encap_parsed(void *parsed_result, struct cmd_set_mplsogre_encap_result *res = parsed_result; union { uint32_t mplsogre_label; - uint8_t label[3]; + uint8_t label[4]; } id = { - .mplsogre_label = - rte_cpu_to_be_32(res->label) & RTE_BE32(0x00ffffff), + .mplsogre_label = rte_cpu_to_be_32(res->label<<12), }; if (strcmp(res->mplsogre, "mplsogre_encap") == 0) @@ -15583,7 +15697,7 @@ static void cmd_set_mplsogre_encap_parsed(void *parsed_result, mplsogre_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(mplsogre_encap_conf.label, &id.label[1], 3); + rte_memcpy(mplsogre_encap_conf.label, &id.label, 3); if (mplsogre_encap_conf.select_ipv4) { IPV4_ADDR_TO_UINT(res->ip_src, mplsogre_encap_conf.ipv4_src); IPV4_ADDR_TO_UINT(res->ip_dst, mplsogre_encap_conf.ipv4_dst); @@ -15804,10 +15918,9 @@ static void cmd_set_mplsoudp_encap_parsed(void *parsed_result, struct cmd_set_mplsoudp_encap_result *res = parsed_result; union { uint32_t mplsoudp_label; - uint8_t label[3]; + uint8_t label[4]; } id = { - .mplsoudp_label = - rte_cpu_to_be_32(res->label) & RTE_BE32(0x00ffffff), + .mplsoudp_label = rte_cpu_to_be_32(res->label<<12), }; if (strcmp(res->mplsoudp, "mplsoudp_encap") == 0) @@ -15820,7 +15933,7 @@ static void cmd_set_mplsoudp_encap_parsed(void *parsed_result, mplsoudp_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(mplsoudp_encap_conf.label, &id.label[1], 3); + rte_memcpy(mplsoudp_encap_conf.label, &id.label, 3); mplsoudp_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src); mplsoudp_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst); if (mplsoudp_encap_conf.select_ipv4) { @@ -18457,7 +18570,7 @@ cmd_show_tx_metadata_parsed(void *parsed_result, } if (!strcmp(res->cmd_keyword, "tx_metadata")) { printf("Port %u tx_metadata: %u\n", res->cmd_pid, - ports[res->cmd_pid].tx_metadata); + rte_be_to_cpu_32(ports[res->cmd_pid].tx_metadata)); } } @@ -18499,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, @@ -18698,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,