DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: David Marchand <david.marchand@redhat.com>
Cc: dev@dpdk.org, Aman Singh <aman.deep.singh@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>
Subject: Re: [PATCH 3/4] app/testpmd: check queue count for related options
Date: Wed, 13 Mar 2024 10:42:36 +0000	[thread overview]
Message-ID: <378f35ad-d1cc-4d55-aa1b-7a2aec582cd8@amd.com> (raw)
In-Reply-To: <CAJFAV8yWO=cLB6Ov2pA5QKqu15n6rUgYHEvt-h0AVdLrFbOtXA@mail.gmail.com>

On 3/13/2024 7:37 AM, David Marchand wrote:
> On Tue, Mar 12, 2024 at 5:59 PM Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>>
>> On 3/8/2024 2:48 PM, David Marchand wrote:
>>> Checking the number of rxq/txq in the middle of option parsing is
>>> confusing. Move the check where nb_rxq / nb_txq are modified.
>>>
>>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>>> ---
>>>  app/test-pmd/parameters.c | 8 ++++----
>>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
>>> index 8c21744009..271f0c995a 100644
>>> --- a/app/test-pmd/parameters.c
>>> +++ b/app/test-pmd/parameters.c
>>> @@ -1063,6 +1063,8 @@ launch_args_parse(int argc, char** argv)
>>>                                       rte_exit(EXIT_FAILURE, "rxq %d invalid - must be"
>>>                                                 " >= 0 && <= %u\n", n,
>>>                                                 get_allowed_max_nb_rxq(&pid));
>>> +                             if (!nb_rxq && !nb_txq)
>>> +                                     rte_exit(EXIT_FAILURE, "Either rx or tx queues should be non-zero\n");
>>>                       }
>>>                       if (!strcmp(lgopts[opt_idx].name, "txq")) {
>>>                               n = atoi(optarg);
>>> @@ -1072,6 +1074,8 @@ launch_args_parse(int argc, char** argv)
>>>                                       rte_exit(EXIT_FAILURE, "txq %d invalid - must be"
>>>                                                 " >= 0 && <= %u\n", n,
>>>                                                 get_allowed_max_nb_txq(&pid));
>>> +                             if (!nb_rxq && !nb_txq)
>>> +                                     rte_exit(EXIT_FAILURE, "Either rx or tx queues should be non-zero\n");
>>>                       }
>>>                       if (!strcmp(lgopts[opt_idx].name, "hairpinq")) {
>>>                               n = atoi(optarg);
>>> @@ -1098,10 +1102,6 @@ launch_args_parse(int argc, char** argv)
>>>                                                 n + nb_rxq,
>>>                                                 get_allowed_max_nb_rxq(&pid));
>>>                       }
>>> -                     if (!nb_rxq && !nb_txq) {
>>> -                             rte_exit(EXIT_FAILURE, "Either rx or tx queues should "
>>> -                                             "be non-zero\n");
>>> -                     }
>>>                       if (!strcmp(lgopts[opt_idx].name, "hairpin-mode")) {
>>>                               char *end = NULL;
>>>                               unsigned int n;
>>
>> There is already a runtime check for queues [1], perhaps we can remove
>> it altogether from arg parse.
> 
> Good catch.
> 
> This other check comes after parsing args, so I suspect it is just dead code.
> I guess I'll change it into a rte_exit(EXIT_FAILURE..).
> Is this what you propose?
> 

I think that check is the main check for nb_rxq and nb_txq.

The one you removed is for the 'hairpinq' parameter, which is not a very
common usecase.
But nb_rxq and nb_txq requirement is very common and it is protected in
the main after parameter parsing.

I am not suggesting adding 'rte_exit()' for that case, probably it will
fail in some other part and error log can provide the required hint.
And I am worried if it breaks some unexpected usecase with exit.

I was just thinking the check can be removed from 'hairpinq' parameter.

> 
>>
>> Also I think the order of the 'hairpinq' and queue number parameter
>> processing depends on order user provided, so this may not be very
>> reliable anyway.
> 
> Indeed.
> 
> 


  reply	other threads:[~2024-03-13 10:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 14:48 [PATCH 0/4] testpmd options parsing cleanup David Marchand
2024-03-08 14:48 ` [PATCH 1/4] app/testpmd: fix stats-period option check David Marchand
2024-03-12 16:43   ` Ferruh Yigit
2024-03-08 14:48 ` [PATCH 2/4] app/testpmd: fix burst option parsing David Marchand
2024-03-12 16:47   ` Ferruh Yigit
2024-03-13  7:24     ` David Marchand
2024-03-13 10:37       ` Ferruh Yigit
2024-03-13 11:13         ` David Marchand
2024-03-13 12:09           ` Ferruh Yigit
2024-03-13 16:32             ` Stephen Hemminger
2024-03-08 14:48 ` [PATCH 3/4] app/testpmd: check queue count for related options David Marchand
2024-03-12 16:59   ` Ferruh Yigit
2024-03-13  7:37     ` David Marchand
2024-03-13 10:42       ` Ferruh Yigit [this message]
2024-03-13 11:10         ` David Marchand
2024-03-13 12:18           ` Ferruh Yigit
2024-03-08 14:48 ` [PATCH 4/4] app/testpmd: enhance getopt_long usage David Marchand
2024-03-12 17:03   ` Ferruh Yigit
2024-03-13 16:51     ` David Marchand
2024-03-13 17:20       ` David Marchand
2024-03-13 23:28         ` Ferruh Yigit
2024-03-13 23:28       ` Ferruh Yigit
2024-03-14  9:17 ` [PATCH v2 0/6] testpmd options parsing cleanup David Marchand
2024-03-14  9:17   ` [PATCH v2 1/6] app/testpmd: fix stats-period option check David Marchand
2024-03-14  9:17   ` [PATCH v2 2/6] app/testpmd: fix burst option parsing David Marchand
2024-03-14  9:22     ` Ferruh Yigit
2024-03-14  9:17   ` [PATCH v2 3/6] app/testpmd: fix error message for invalid option David Marchand
2024-03-14  9:23     ` Ferruh Yigit
2024-03-14  9:17   ` [PATCH v2 4/6] app/testpmd: enhance queue count check David Marchand
2024-03-14  9:23     ` Ferruh Yigit
2024-03-14  9:17   ` [PATCH v2 5/6] app/testpmd: remove dead code for disabling cmdline library David Marchand
2024-03-14 11:33     ` Ferruh Yigit
2024-03-14  9:17   ` [PATCH v2 6/6] app/testpmd: enhance getopt_long usage David Marchand
2024-03-14 11:43     ` Ferruh Yigit
2024-03-14 12:43   ` [PATCH v2 0/6] testpmd options parsing cleanup Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=378f35ad-d1cc-4d55-aa1b-7a2aec582cd8@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=aman.deep.singh@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=yuying.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).