From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E2D25B10E for ; Thu, 12 Jun 2014 02:18:07 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 11 Jun 2014 17:18:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,461,1400050800"; d="scan'208";a="546558804" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga001.fm.intel.com with ESMTP; 11 Jun 2014 17:18:20 -0700 Received: from irsmsx105.ger.corp.intel.com (163.33.3.28) by IRSMSX101.ger.corp.intel.com (163.33.3.153) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 12 Jun 2014 01:18:20 +0100 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.105]) by IRSMSX105.ger.corp.intel.com ([169.254.7.239]) with mapi id 14.03.0123.003; Thu, 12 Jun 2014 01:18:19 +0100 From: "Dumitrescu, Cristian" To: "Richardson, Bruce" , Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH] Add an API to query enabled core index Thread-Index: AQHPhbfwiLqgPtZrgkyLcXy3o/KPOZtsYlCAgAABpICAAA7oAIAACnKAgAAY7SA= Date: Thu, 12 Jun 2014 00:18:19 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891261B1C3DE0@IRSMSX102.ger.corp.intel.com> References: <1402519509-26653-1-git-send-email-Patrick.Lu@intel.com> <9007853.cgh6aaULN3@xps13> <59AF69C657FD0841A61C55336867B5B01AA35210@IRSMSX103.ger.corp.intel.com> <1487472.hZgYJQSpCy@xps13> <59AF69C657FD0841A61C55336867B5B01AA352EF@IRSMSX103.ger.corp.intel.com> In-Reply-To: <59AF69C657FD0841A61C55336867B5B01AA352EF@IRSMSX103.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] Add an API to query enabled core index X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jun 2014 00:18:08 -0000 Maybe we could simplify this discussion by simply creating a new function t= o return the mask of all enabled cores (as provided through -c coremask EAL= option) and have the user utilize this mask to derive whatever info it nee= ds? Right now, to get the mask of enabled cores, a for loop is required to test= each core index one by one and re-create the mask. In several instances, I needed to know just the number of enabled cores (i.= e. number of bits set in -c coremask), and there was no alternative to the = for loop above. But given such a function, we can quickly do: uint64_t coremask =3D rte_eal_coremask(); n_lcores =3D __builtin_popcountll(coremask); For what Patrick needs: = uint32_t lcore_enabled_pos =3D __builtin_popcountll(coremask & RTE_LEN2MAS= K(lcore_index)); Regards, Cristian -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Richardson, Bruce Sent: Thursday, June 12, 2014 12:28 AM To: Thomas Monjalon Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] Add an API to query enabled core index > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Wednesday, June 11, 2014 3:50 PM > To: Richardson, Bruce > Cc: Lu, Patrick; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] Add an API to query enabled core index > = > 2014-06-11 21:57, Richardson, Bruce: > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon > > > 2014-06-11 13:45, Patrick Lu: > > > > The new API rte_lcore_id2() will return an index from enabled lcores > > > > starting from zero. > > > > > > I think core_id2 is not a representative name. > > > What do you think of renaming core_id as lcore_hwid and core_id2 as > > > lcore_index? > > > > I like lcore_index as the name for the new function. However, I'm not s= ure > > in that case that we want/need to rename the old one. > = > I think it would be not easy to distinguish id and index. So I prefer > hwid/index. And lcore is more precise than core. > = The function is already called "rte_lcore_id()" so there is no need to chan= ge it to make it an "lcore" function. That function has been around for a l= ong time and is commonly used, so I'd prefer it not be changed unless it re= ally is necessary. "rte_lcore_index" is a sufficiently different function n= ame, in my opinion. The API documentation should clear up any confusion for= the user anyway. -------------------------------------------------------------- Intel Shannon Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 Business address: Dromore House, East Park, Shannon, Co. Clare This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others = is strictly prohibited. If you are not the intended recipient, please conta= ct the sender and delete all copies.