[dpdk-dev] [PATCH v3 4/4] app/testpmd: display/clear forwarding stats on demand

David Marchand david.marchand at redhat.com
Thu Mar 21 21:34:42 CET 2019


On Thu, Mar 21, 2019 at 7:50 PM Ferruh Yigit <ferruh.yigit at intel.com> wrote:

> On 3/20/2019 10:02 AM, David Marchand wrote:
> > Add a new "show/clear fwd stats all" command to display fwd and port
> > statistics on the fly.
> >
> > To be able to do so, the (testpmd only) rte_port structure can't be used
> > to maintain any statistics.
> > Moved the stats dump parts from stop_packet_forwarding() and merge with
> > fwd_port_stats_display() into fwd_stats_display().
> > fwd engine statistics are then aggregated into a local per port array.
> >
> > Signed-off-by: David Marchand <david.marchand at redhat.com>
>
> <...>
>
> > +/* 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");
>
> Do we need "all"?
> Normally we have it when there is selection between specific <port_id> or
> all,
> here only option is all.
>

Well, the thing is that if we add a specific <fwd_id> later, we would have
to introduce this "all".
And since a lot of people are going to use this command, this would break
their scripts ;-)

I find it consistent with "show port stats all" as well.


> > +
> > +static void
> > +cmd_fwd_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_fwdall = {
> > +     .f = cmd_fwd_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,
> > +     },
> > +};
>
> in 'app/test-pmd/cmdline.c', there is 'cmd_help_long_parsed()' function to
> display the help output, can you please add new command information there
> too?
>

Indeed, will do.



> > +
> >  /* *** READ PORT REGISTER *** */
> >  struct cmd_read_reg_result {
> >       cmdline_fixed_string_t read;
> > @@ -18559,6 +18602,7 @@ struct cmd_show_tx_metadata_result {
> >       (cmdline_parse_inst_t *)&cmd_showqueue,
> >       (cmdline_parse_inst_t *)&cmd_showportall,
> >       (cmdline_parse_inst_t *)&cmd_showcfg,
> > +     (cmdline_parse_inst_t *)&cmd_fwdall,
>
> command name looks misleading 'fwdall', it feels like it is something doing
> forwarding more than display, what about following same syntax with above
> 'cmd_showportall', so 'cmd_showfwdall' or 'cmd_showfwd' based on your
> answer to
> drop "all"?
>

I would go with cmd_showfwdall.


> <...>
>
> > +#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
> > +             fwd_cycles += fs->core_cycles;
> > +#endif
>
> Ahh, it seems I missed this config option, looks useful :)
> I wonder if it is documented anywhere.
>

Well, it does seem quite unknown.
I am not sure of the accuracy, just tried it to check if it was really
broken or not, seems to work.


-- 
David Marchand


More information about the dev mailing list