From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <wei.dai@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 1329E530C
 for <dev@dpdk.org>; Wed, 27 Jul 2016 11:15:30 +0200 (CEST)
Received: from fmsmga002.fm.intel.com ([10.253.24.26])
 by fmsmga101.fm.intel.com with ESMTP; 27 Jul 2016 02:15:30 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.28,429,1464678000"; d="scan'208";a="1029981368"
Received: from pgsmsx105.gar.corp.intel.com ([10.221.44.96])
 by fmsmga002.fm.intel.com with ESMTP; 27 Jul 2016 02:15:29 -0700
Received: from pgsmsx110.gar.corp.intel.com (10.221.44.111) by
 PGSMSX105.gar.corp.intel.com (10.221.44.96) with Microsoft SMTP Server (TLS)
 id 14.3.248.2; Wed, 27 Jul 2016 17:15:28 +0800
Received: from pgsmsx106.gar.corp.intel.com ([169.254.9.48]) by
 PGSMSX110.gar.corp.intel.com ([10.221.44.111]) with mapi id 14.03.0248.002;
 Wed, 27 Jul 2016 17:15:28 +0800
From: "Dai, Wei" <wei.dai@intel.com>
To: Adam Bynes <adambynes@outlook.com>, "Ananyev, Konstantin"
 <konstantin.ananyev@intel.com>
CC: "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH v2 1/2] eal: remove redundant codes to parse
 --lcores
Thread-Index: AQHR52Ri0EkFyWrsMkSHzBy9c0+RlaArxIyQ
Date: Wed, 27 Jul 2016 09:15:27 +0000
Message-ID: <49759EB36A64CF4892C1AFEC9231E8D63A266397@PGSMSX106.gar.corp.intel.com>
References: <1469081018-55300-1-git-send-email-wei.dai@intel.com>
 <1469526749-19698-1-git-send-email-wei.dai@intel.com>
 <2601191342CEEE43887BDE71AB97725836B820CA@irsmsx105.ger.corp.intel.com>
 <SG2PR0201MB09985927FC27DBAA84E7B260B60E0@SG2PR0201MB0998.apcprd02.prod.outlook.com>
In-Reply-To: <SG2PR0201MB09985927FC27DBAA84E7B260B60E0@SG2PR0201MB0998.apcprd02.prod.outlook.com>
Accept-Language: zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDcwYmJkYjItYjE4YS00MjBkLWE2NjItNDRjODM4NTVjYWI0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InoxSWw0Z2Nia1UxTUM0UHFZWVlDaWQyOFc3bHZiVm5NQlIwTzZGZDFpVVE9In0=
x-ctpclassification: CTP_IC
x-originating-ip: [172.30.20.205]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v2 1/2] eal: remove redundant codes to parse
 --lcores
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 27 Jul 2016 09:15:31 -0000

Hi, Adam & Ananyev
Thanks for your feedback.

> -----Original Message-----
> From: Adam Bynes [mailto:adambynes@outlook.com]
> Sent: Wednesday, July 27, 2016 1:36 AM
> To: Dai, Wei <wei.dai@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 1/2] eal: remove redundant codes to par=
se
> --lcores
>=20
> On Tue, Jul 26, 2016 at 11:51:57AM +0000, Ananyev, Konstantin wrote:
> >
> >
> hi Wei,
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Dai
> > > Sent: Tuesday, July 26, 2016 10:52 AM
> > > To: dev@dpdk.org
> > > Cc: Dai, Wei <wei.dai@intel.com>
> > > Subject: [dpdk-dev] [PATCH v2 1/2] eal: remove redundant codes to par=
se
> --lcores
> > >
> > > local variable i is not referred by other codes in the function
> eal_parse_lcores( ), so it can be removed.
> > >
> > > Signed-off-by: Wei Dai <wei.dai@intel.com>
> > > ---
> > >  lib/librte_eal/common/eal_common_options.c | 4 ----
> > >  1 file changed, 4 deletions(-)
> > >
> > > diff --git a/lib/librte_eal/common/eal_common_options.c
> b/lib/librte_eal/common/eal_common_options.c
> > > index 481c732..c5bf98c 100644
> > > --- a/lib/librte_eal/common/eal_common_options.c
> > > +++ b/lib/librte_eal/common/eal_common_options.c
> > > @@ -578,7 +578,6 @@ eal_parse_lcores(const char *lcores)
> > >  	struct rte_config *cfg =3D rte_eal_get_configuration();
> > >  	static uint16_t set[RTE_MAX_LCORE];
> > >  	unsigned idx =3D 0;
> > > -	int i;
> > >  	unsigned count =3D 0;
> > >  	const char *lcore_start =3D NULL;
> > >  	const char *end =3D NULL;
> > > @@ -593,9 +592,6 @@ eal_parse_lcores(const char *lcores)
> > >  	/* Remove all blank characters ahead and after */
> > >  	while (isblank(*lcores))
> > >  		lcores++;
> > > -	i =3D strlen(lcores);
> > > -	while ((i > 0) && isblank(lcores[i - 1]))
> > > -		i--;
> >
> > I suppose originally it meant to do something  like that:
> > while ((i > 0) && isblank(lcores[i - 1]))
> > 	lcores[i--] =3D 0;
> totally agreed Konstantin, need to add lcore[i--] =3D '\0'
>=20
> >
> > to get rid of blank characters at the end of the line, no?
> > Konstantin

The tail blank is not necessary to be removed from lcores here for followin=
g reasons:
1. The tail blanks can also be swallowed later in function eal_parse_set( )=
=20
  by "while (isblank(*end)) end++". And such operation/sentence also
  deal with blanks in the middle of arguments (for example: blank before
  - and after (7,8) in '0   -2    ,(3   - 6)@(3-6),7@(7-8)     ,8@(8-10)   =
   '),=20
  so above removal of blank is redundant.
  By the way, with --lcores '(0-3)@(0-3), (4-5)@(4-5)    ', I also find a n=
ew bug.
  After processing cpu set (4-5), the variable end in eal_parse_lcores does=
n't point t
  ',' or '\0',  so this function return an error.
  The tail blank after cpu set (4-5) still need to be swallowed.=20
  The patch v3 will be removed.eal

2. if let lcores[i--] =3D 0 here, due to type of input argument lcores (con=
st char *),=20
  building will fail. And if the type is changed to char *, the type of inp=
ut argument of
  several other function also need to be changed. So according to above rea=
son 1, it
  is not need to change the type.

Thanks
Wei Dai=20

> >
> > >
> > >  	CPU_ZERO(&cpuset);
> > >
> > > --
> > > 2.5.5
> Adam Bynes