[PATCH 2/4] app/testpmd: fix burst option parsing

David Marchand david.marchand at redhat.com
Wed Mar 13 08:24:22 CET 2024


On Tue, Mar 12, 2024 at 5:47 PM Ferruh Yigit <ferruh.yigit at amd.com> wrote:
>
> On 3/8/2024 2:48 PM, David Marchand wrote:
> > rte_eth_dev_info_get() is not supposed to fail for a valid port_id, but
> > for the theoretical case when it would fail, raise an error rather than
> > skip subsequent options.
> >
> > Fixes: 6f51deb903b2 ("app/testpmd: check status of getting ethdev info")
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand at redhat.com>
> > ---
> >  app/test-pmd/parameters.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> > index d715750bb8..8c21744009 100644
> > --- a/app/test-pmd/parameters.c
> > +++ b/app/test-pmd/parameters.c
> > @@ -1128,9 +1128,9 @@ launch_args_parse(int argc, char** argv)
> >                                                               0,
> >                                                               &dev_info);
> >                                       if (ret != 0)
> > -                                             return;
> > -
> > -                                     rec_nb_pkts = dev_info
> > +                                             rec_nb_pkts = 0;
> > +                                     else
> > +                                             rec_nb_pkts = dev_info
> >                                               .default_rxportconf.burst_size;
> >
> >                                       if (rec_nb_pkts == 0)
>
> 'eth_dev_info_get_print_err()' already fail, but it may not be very
> clear to the user,
> OK to print a failure log, but setting 'rec_nb_pkts = 0;' as above also
> will generate an error message that also may be confusing to the user.
>
> What about print an explicit error message for the
> 'eth_dev_info_get_print_err()' failed case?

rte_exit(EXIT_FAILURE, "Failed to retrieve device info, this is
probably a driver bug. "
        "To workaround this issue, please provide a value between 1
and %d\n", MAX_PKT_BURST);

Does it work for you?


-- 
David Marchand



More information about the stable mailing list