From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id AC72D43746
	for <public@inbox.dpdk.org>; Tue, 19 Dec 2023 16:10:37 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id A346D42E11;
	Tue, 19 Dec 2023 16:10:37 +0100 (CET)
Received: from frasgout.his.huawei.com (frasgout.his.huawei.com
 [185.176.79.56])
 by mails.dpdk.org (Postfix) with ESMTP id 6E4B3402E0;
 Tue, 19 Dec 2023 16:10:34 +0100 (CET)
Received: from mail.maildlp.com (unknown [172.18.186.231])
 by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Svg7K3rckz6K8vt;
 Tue, 19 Dec 2023 23:08:29 +0800 (CST)
Received: from frapeml100007.china.huawei.com (unknown [7.182.85.133])
 by mail.maildlp.com (Postfix) with ESMTPS id 4B5D71400DB;
 Tue, 19 Dec 2023 23:10:18 +0800 (CST)
Received: from frapeml500007.china.huawei.com (7.182.85.172) by
 frapeml100007.china.huawei.com (7.182.85.133) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.35; Tue, 19 Dec 2023 16:10:01 +0100
Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by
 frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.035;
 Tue, 19 Dec 2023 16:10:01 +0100
From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
To: "Tummala, Sivaprasad" <Sivaprasad.Tummala@amd.com>, "david.hunt@intel.com"
 <david.hunt@intel.com>, "anatoly.burakov@intel.com"
 <anatoly.burakov@intel.com>, "jerinj@marvell.com" <jerinj@marvell.com>,
 "radu.nicolau@intel.com" <radu.nicolau@intel.com>, "gakhil@marvell.com"
 <gakhil@marvell.com>, "cristian.dumitrescu@intel.com"
 <cristian.dumitrescu@intel.com>, "Yigit, Ferruh" <Ferruh.Yigit@amd.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH v2 1/6] examples/l3fwd: fix lcore ID restriction
Thread-Topic: [PATCH v2 1/6] examples/l3fwd: fix lcore ID restriction
Thread-Index: AQHaMiuEVTKpsBDLF0CQ9pPlPVi3J7CwguIwgAAGihCAAA3igIAAHpIw
Date: Tue, 19 Dec 2023 15:10:00 +0000
Message-ID: <2a21fc7ad41243ce935cdc6d80b0eb96@huawei.com>
References: <20231218074905.42749-1-sivaprasad.tummala@amd.com>
 <20231219032826.4814-1-sivaprasad.tummala@amd.com>
 <20231219032826.4814-2-sivaprasad.tummala@amd.com>
 <0897bc70dd984126a02c3f5046495c1c@huawei.com>
 <ffb423304869478a8182092a4d03f8b4@huawei.com>
 <DM3PR12MB9286CAAD899052CF805509078697A@DM3PR12MB9286.namprd12.prod.outlook.com>
In-Reply-To: <DM3PR12MB9286CAAD899052CF805509078697A@DM3PR12MB9286.namprd12.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.206.138.42]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org


Hi Sivaprasad,

>=20
> Hi Konstantin,
>=20
> > -----Original Message-----
> > From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> > Sent: Tuesday, December 19, 2023 6:00 PM
> > To: Konstantin Ananyev <konstantin.ananyev@huawei.com>; Tummala, Sivapr=
asad
> > <Sivaprasad.Tummala@amd.com>; david.hunt@intel.com;
> > anatoly.burakov@intel.com; jerinj@marvell.com; radu.nicolau@intel.com;
> > gakhil@marvell.com; cristian.dumitrescu@intel.com; Yigit, Ferruh
> > <Ferruh.Yigit@amd.com>
> > Cc: dev@dpdk.org; stable@dpdk.org
> > Subject: RE: [PATCH v2 1/6] examples/l3fwd: fix lcore ID restriction
> >
> > Caution: This message originated from an External Source. Use proper ca=
ution
> > when opening attachments, clicking links, or responding.
> >
> >
> > >
> > > > Currently the config option allows lcore IDs up to 255, irrespectiv=
e
> > > > of RTE_MAX_LCORES and needs to be fixed.
> > > >
> > > > The patch allows config options based on DPDK config.
> > > >
> > > > Fixes: af75078fece3 ("first public release")
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
> > > > ---
> > > >  examples/l3fwd/main.c | 19 +++++++++++--------
> > > >  1 file changed, 11 insertions(+), 8 deletions(-)
> > > >
> > > > diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index
> > > > 3bf28aec0c..ed116da09c 100644
> > > > --- a/examples/l3fwd/main.c
> > > > +++ b/examples/l3fwd/main.c
> > > > @@ -99,7 +99,7 @@ struct parm_cfg parm_config;  struct lcore_params
> > > > {
> > > >     uint16_t port_id;
> > > >     uint8_t queue_id;
> >
> > Actually one comment:
> > As lcore_id becomes uint16_t it might be worth to do the same queue_id,=
 they
> > usually are very much related.
> Yes, that's a valid statement for one network interface.
> With multiple interfaces, it's a combination of port/queue that maps to a=
 specific lcore.
> If there a NICs that support more than 256 queues, then it makes sense to=
 change the
> queue_id type as well.

AFAIK, majority of modern NICs do support more than 256 queues.
That's why in rte_ethev API queue_id is uint16_t.

>=20
> Please let me know your thoughts.
> >
> > > > -   uint8_t lcore_id;
> > > > +   uint16_t lcore_id;
> > > >  } __rte_cache_aligned;
> > > >
> > > >  static struct lcore_params lcore_params_array[MAX_LCORE_PARAMS];
> > > > @@ -292,8 +292,8 @@ setup_l3fwd_lookup_tables(void)  static int
> > > >  check_lcore_params(void)
> > > >  {
> > > > -   uint8_t queue, lcore;
> > > > -   uint16_t i;
> > > > +   uint8_t queue;
> > > > +   uint16_t i, lcore;
> > > >     int socketid;
> > > >
> > > >     for (i =3D 0; i < nb_lcore_params; ++i) { @@ -304,12 +304,12 @@
> > > > check_lcore_params(void)
> > > >             }
> > > >             lcore =3D lcore_params[i].lcore_id;
> > > >             if (!rte_lcore_is_enabled(lcore)) {
> > > > -                   printf("error: lcore %hhu is not enabled in lco=
re mask\n", lcore);
> > > > +                   printf("error: lcore %hu is not enabled in lcor=
e
> > > > + mask\n", lcore);
> > > >                     return -1;
> > > >             }
> > > >             if ((socketid =3D rte_lcore_to_socket_id(lcore) !=3D 0)=
 &&
> > > >                     (numa_on =3D=3D 0)) {
> > > > -                   printf("warning: lcore %hhu is on socket %d wit=
h numa off \n",
> > > > +                   printf("warning: lcore %hu is on socket %d with
> > > > + numa off\n",
> > > >                             lcore, socketid);
> > > >             }
> > > >     }
> > > > @@ -359,7 +359,7 @@ static int
> > > >  init_lcore_rx_queues(void)
> > > >  {
> > > >     uint16_t i, nb_rx_queue;
> > > > -   uint8_t lcore;
> > > > +   uint16_t lcore;
> > > >
> > > >     for (i =3D 0; i < nb_lcore_params; ++i) {
> > > >             lcore =3D lcore_params[i].lcore_id; @@ -500,6 +500,8 @@
> > > > parse_config(const char *q_arg)
> > > >     char *str_fld[_NUM_FLD];
> > > >     int i;
> > > >     unsigned size;
> > > > +   unsigned int max_fld[_NUM_FLD] =3D {RTE_MAX_ETHPORTS,
> > > > +                                   255, RTE_MAX_LCORE};
> > > >
> > > >     nb_lcore_params =3D 0;
> > > >
> > > > @@ -518,7 +520,8 @@ parse_config(const char *q_arg)
> > > >             for (i =3D 0; i < _NUM_FLD; i++){
> > > >                     errno =3D 0;
> > > >                     int_fld[i] =3D strtoul(str_fld[i], &end, 0);
> > > > -                   if (errno !=3D 0 || end =3D=3D str_fld[i] || in=
t_fld[i] > 255)
> > > > +                   if (errno !=3D 0 || end =3D=3D str_fld[i] || in=
t_fld[i] >
> > > > +
> > > > + max_fld[i])
> > > >                             return -1;
> > > >             }
> > > >             if (nb_lcore_params >=3D MAX_LCORE_PARAMS) { @@ -531,7
> > > > +534,7 @@ parse_config(const char *q_arg)
> > > >             lcore_params_array[nb_lcore_params].queue_id =3D
> > > >                     (uint8_t)int_fld[FLD_QUEUE];
> > > >             lcore_params_array[nb_lcore_params].lcore_id =3D
> > > > -                   (uint8_t)int_fld[FLD_LCORE];
> > > > +                   (uint16_t)int_fld[FLD_LCORE];
> > > >             ++nb_lcore_params;
> > > >     }
> > > >     lcore_params =3D lcore_params_array;
> > > > --
> > >
> > > Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> > >
> > >
> > > > 2.25.1