From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id BF49543C9C;
	Wed, 13 Mar 2024 08:38:15 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 7F488406FF;
	Wed, 13 Mar 2024 08:38:15 +0100 (CET)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.129.124])
 by mails.dpdk.org (Postfix) with ESMTP id 7AA664069D
 for <dev@dpdk.org>; Wed, 13 Mar 2024 08:38:13 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1710315493;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=/Du8EaGSaFil3Jn3hrgGqC7uw1y/1GYtiCJvFyXjx2E=;
 b=fSH44c/1DoW0lZuDFwC3Ek5rpQDrmVdZc2sPyNpc4DFdXR+oiejiBVKHjmos3XVuRTTjy4
 IR4T4TOyuB+gZYPnbJWOsUvTG7gKCrk+rF89n5iHgwuUquxEl2XSdq95o4oK2SaPs6uUOi
 IhYE8rGWeyiEbHyrOGH0Qc/EB49cTMw=
Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com
 [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
 us-mta-389-rywxLP7IOBiOJv4IybL8UQ-1; Wed, 13 Mar 2024 03:38:11 -0400
X-MC-Unique: rywxLP7IOBiOJv4IybL8UQ-1
Received: by mail-lj1-f200.google.com with SMTP id
 38308e7fff4ca-2d45f5bd000so12733761fa.1
 for <dev@dpdk.org>; Wed, 13 Mar 2024 00:38:11 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1710315490; x=1710920290;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=/Du8EaGSaFil3Jn3hrgGqC7uw1y/1GYtiCJvFyXjx2E=;
 b=U1vTkMUZZqFq0rrmrNYb6rdQpWcyYZq0ULLMxO1yHytq1DhES/Dw4xVlvGy5U4AE7s
 d9YpJSpFJW/Bz4dPpUhRUehqkRwgGSvGWlLUk0rKCp5sTwnO03bYYePFRhCcy/75PsRY
 iHFlrYTp22izlHgH6/DIG3tt9uZJKr1xR5gmY6aHIMPxwdW9xfLEMDZpwYz9LEvKvhue
 3/pPyHwygCyMPgF7v9m1ieUd+7CKOYXQnYy4jjMSk2OCJI4xS9mW1C95hE4LCQAAnK+D
 vPeyBpFilzs5X/+fssyfWD4fNOD3N96T1oD8jrOsZ92HMf7FfE+rWz71uoQI98Fn58RV
 7H8Q==
X-Gm-Message-State: AOJu0YxEAjYRMZ06aa18B4Jno1FYDwWLgv7Si8i1eLhGm6/vsEkzSXCJ
 Z73kW0AF0Pp6LVtO7YM2UXR8bHVdsAl9qsm8ARBtTapSxsvdkVoauE3cFkJ/kpQPkCBraQFk6gv
 OhTPQLAEVlTrlbkQmwmTsWnQ1FWui9U6U8kSF/cCBItmscXvHuQX0baETLbpHRtgLne+7Bg6SK8
 VARNjcUZdZDpTia7o=
X-Received: by 2002:a2e:9946:0:b0:2d3:17e6:3b3f with SMTP id
 r6-20020a2e9946000000b002d317e63b3fmr7818406ljj.39.1710315490096; 
 Wed, 13 Mar 2024 00:38:10 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHLdoK+/S/fnsgg+JcD7nseY3v5+288vb3vxbAXhFqpF4QniTcEWLTl3pXZZ90TJbSbh7vgcEYN2LRMy3Kx0ro=
X-Received: by 2002:a2e:9946:0:b0:2d3:17e6:3b3f with SMTP id
 r6-20020a2e9946000000b002d317e63b3fmr7818398ljj.39.1710315489760; Wed, 13 Mar
 2024 00:38:09 -0700 (PDT)
MIME-Version: 1.0
References: <20240308144841.3615262-1-david.marchand@redhat.com>
 <20240308144841.3615262-4-david.marchand@redhat.com>
 <5d2efba1-ad6e-4e51-86bd-77d299b73697@amd.com>
In-Reply-To: <5d2efba1-ad6e-4e51-86bd-77d299b73697@amd.com>
From: David Marchand <david.marchand@redhat.com>
Date: Wed, 13 Mar 2024 08:37:58 +0100
Message-ID: <CAJFAV8yWO=cLB6Ov2pA5QKqu15n6rUgYHEvt-h0AVdLrFbOtXA@mail.gmail.com>
Subject: Re: [PATCH 3/4] app/testpmd: check queue count for related options
To: Ferruh Yigit <ferruh.yigit@amd.com>
Cc: dev@dpdk.org, Aman Singh <aman.deep.singh@intel.com>, 
 Yuying Zhang <yuying.zhang@intel.com>
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Tue, Mar 12, 2024 at 5:59=E2=80=AFPM 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 in=
valid - must be"
> >                                                 " >=3D 0 && <=3D %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 =3D atoi(optarg);
> > @@ -1072,6 +1074,8 @@ launch_args_parse(int argc, char** argv)
> >                                       rte_exit(EXIT_FAILURE, "txq %d in=
valid - must be"
> >                                                 " >=3D 0 && <=3D %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 =3D 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 q=
ueues should "
> > -                                             "be non-zero\n");
> > -                     }
> >                       if (!strcmp(lgopts[opt_idx].name, "hairpin-mode")=
) {
> >                               char *end =3D 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 cod=
e.
I guess I'll change it into a rte_exit(EXIT_FAILURE..).
Is this what you propose?


>
> 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.


--=20
David Marchand