On 9/1/2017 4:02 PM, Kirill Rybalchenko wrote: > Add new commands to manipulate with dynamic flow type to > pctype mapping table in i40e PMD. > Commands allow to print table, modify it and reset to default value. > > Signed-off-by: Kirill Rybalchenko <kirill.rybalche...@intel.com> > --- > app/test-pmd/cmdline.c | 311 > +++++++++++++++++++++++++++- > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 21 ++ > 2 files changed, 322 insertions(+), 10 deletions(-) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index 0144191..f7d0733 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -637,6 +637,16 @@ static void cmd_help_long_parsed(void *parsed_result, > "ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n" > " Update a ptype mapping item on a port\n\n" > > + "pctype mapping reset (port_id)\n" > + " Reset flow type to pctype mapping on a port\n\n" > + > + "pctype mapping get (port_id)\n" > + " Get flow ptype to pctype mapping on a port\n\n" > + > + "pctype mapping update (port_id) > (pctype_id_0[,pctype_id_1]*)" > + " (flow_type_id)\n" > + " Update a flow type to pctype mapping item on a > port\n\n"
This is another root level command for PMD specific feature, can this be under "port" or "set" command? > + > , list_pkt_forwarding_modes() > ); > } > @@ -681,7 +691,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)\n" > + "port config all rss > (all|ip|tcp|udp|sctp|ether|port|vxlan|" > + "geneve|nvgre|none|<flowtype_id>)\n" Why not use existing defined hash functions but use custom one, is there a missing one in ethdev? > " Set the RSS mode.\n\n" > > "port config port-id rss reta > (hash,queue)[,(hash,queue)]\n" > @@ -878,8 +889,8 @@ static void cmd_help_long_parsed(void *parsed_result, > "set_hash_input_set (port_id) (ipv4|ipv4-frag|" > "ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|" > "ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|" > - "l2_payload) (ovlan|ivlan|src-ipv4|dst-ipv4|src-ipv6|" > - "dst-ipv6|ipv4-tos|ipv4-proto|ipv6-tc|" > + "l2_payload|<flowtype_id>) > (ovlan|ivlan|src-ipv4|dst-ipv4|" > + "src-ipv6|dst-ipv6|ipv4-tos|ipv4-proto|ipv6-tc|" > "ipv6-next-header|udp-src-port|udp-dst-port|" > "tcp-src-port|tcp-dst-port|sctp-src-port|" > "sctp-dst-port|sctp-veri-tag|udp-key|gre-key|fld-1st|" > @@ -1716,6 +1727,8 @@ cmd_config_rss_parsed(void *parsed_result, > rss_conf.rss_hf = ETH_RSS_NVGRE; > else if (!strcmp(res->value, "none")) > rss_conf.rss_hf = 0; > + else if (isdigit(res->value[0]) && atoi(res->value) > 0 && > atoi(res->value) < 64) > + rss_conf.rss_hf = 1ULL << atoi(res->value); > else { > printf("Unknown parameter\n"); > return; > @@ -1739,14 +1752,13 @@ cmdline_parse_token_string_t cmd_config_rss_all = > cmdline_parse_token_string_t cmd_config_rss_name = > TOKEN_STRING_INITIALIZER(struct cmd_config_rss, name, "rss"); > cmdline_parse_token_string_t cmd_config_rss_value = > - TOKEN_STRING_INITIALIZER(struct cmd_config_rss, value, > - "all#ip#tcp#udp#sctp#ether#port#vxlan#geneve#nvgre#none"); > + TOKEN_STRING_INITIALIZER(struct cmd_config_rss, value, NULL); I guess this will prevent auto completion. <...> > +/* pctype mapping get */ > + > +#define FLOW_TYPE_MAX 64 > +#define PCTYPE_MAX 64 These should not be defined by application I believe. <...> > +static void > +cmd_pctype_mapping_update_parsed( > + void *parsed_result, > + __attribute__((unused)) struct cmdline *cl, > + __attribute__((unused)) void *data) > +{ > + struct cmd_pctype_mapping_update_result *res = parsed_result; > + int ret = -ENOTSUP; > +#ifdef RTE_LIBRTE_I40E_PMD > + struct rte_pmd_i40e_flow_type_mapping mapping; > +#endif > + unsigned int nb_item, i; > + unsigned int pctype_list[PCTYPE_MAX]; > + > + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) > + return; > + > + nb_item = parse_item_list(res->pctype_list, "pctypes", PCTYPE_MAX, > + pctype_list, 1); How user knows which values to fill the pctype_list? More importantly, if this is an API call instead of user defined values, how application should know which values to use? I am trying to say pctype values defined in i40e driver somehow needs to public to be used. <...> > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -1310,6 +1310,27 @@ Reset ptype mapping table:: > > testpmd> ptype mapping reset (port_id) > > +pctype mapping > +~~~~~~~~~~~~~ WARNING: .../testpmd_app_ug/testpmd_funcs.rst:1314: (WARNING/2) Title underline too short. pctype mapping ~~~~~~~~~~~~~ <...>