From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 89E0CA0096 for ; Wed, 5 Jun 2019 04:18:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7299D1B945; Wed, 5 Jun 2019 04:18:43 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id CB6042A6A for ; Wed, 5 Jun 2019 04:18:41 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2019 19:18:41 -0700 X-ExtLoop1: 1 Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga001.jf.intel.com with ESMTP; 04 Jun 2019 19:18:40 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 4 Jun 2019 19:18:40 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 4 Jun 2019 19:18:40 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.10]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.153]) with mapi id 14.03.0415.000; Wed, 5 Jun 2019 10:18:38 +0800 From: "Tu, Lijuan" To: "pvukkisala@marvell.com" , "dts@dpdk.org" CC: "avijay@marvell.com" , "fmasood@marvell.com" Thread-Topic: [dts] [PATCH] crb.py: Support getting cores list from last core Thread-Index: AQHVFtUjkyNe3TvuPU6MQ7gtE3k9GKaMXESg Date: Wed, 5 Jun 2019 02:18:37 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BAA05E0@SHSMSX101.ccr.corp.intel.com> References: <1559213238-21721-1-git-send-email-pvukkisala@marvell.com> In-Reply-To: <1559213238-21721-1-git-send-email-pvukkisala@marvell.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmJiMmJiZWEtNDVmYS00NDU2LWI4OTktNjNlMjZiNTYwNGYwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRE5MR1A2U09ndzByamppVmNYaXJkbzBDTjIwRVNpMjVnRTVCVFp0QkphVWlwbDhtdTlhbXNxR2oxMG54bnlReSJ9 x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH] crb.py: Support getting cores list from last core X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of > pvukkisala@marvell.com > Sent: Thursday, May 30, 2019 6:47 PM > To: dts@dpdk.org > Cc: avijay@marvell.com; fmasood@marvell.com; Phanendra Vukkisala > > Subject: [dts] [PATCH] crb.py: Support getting cores list from last core >=20 > From: Phanendra Vukkisala >=20 > Signed-off-by: Phanendra Vukkisala > --- > framework/crb.py | 37 +++++++++++++++++++++++++++++-------- > 1 file changed, 29 insertions(+), 8 deletions(-) >=20 > diff --git a/framework/crb.py b/framework/crb.py index 0a2fa80..6e5f56f > 100644 > --- a/framework/crb.py > +++ b/framework/crb.py > @@ -630,7 +630,7 @@ class Crb(object): > # return thread list > return map(str, thread_list) >=20 > - def get_core_list(self, config, socket=3D-1): > + def get_core_list(self, config, socket=3D-1, from_last =3D False): > """ > Get lcore array according to the core config like "all", "1S/1C/= 1T". > We can specify the physical CPU socket by the "socket" parameter= . > @@ -663,7 +663,10 @@ class Crb(object): > if (int(n['socket']) =3D=3D socket): > sockList =3D [int(n['socket'])] >=20 > - sockList =3D list(sockList)[:nr_sockets] > + if from_last: > + sockList =3D list(sockList)[-nr_sockets:] > + else: > + sockList =3D list(sockList)[:nr_sockets] > partial_cores =3D [n for n in partial_cores if int(n['socket= ']) > in sockList] > core_list =3D set([int(n['core']) for n in partial_cores]) @= @ -676,7 > +679,10 @@ class Crb(object): > for sock in sockList: > core_list =3D set([int( > n['core']) for n in partial_cores if int(n['socket']= ) =3D=3D sock]) > - core_list =3D list(core_list)[:nr_cores] > + if from_last: > + core_list =3D list(core_list)[-nr_cores:] > + else: > + core_list =3D list(core_list)[:nr_cores] > temp.extend(core_list) >=20 > core_list =3D temp > @@ -686,7 +692,10 @@ class Crb(object): > partial_cores =3D self.cores > sockList =3D set([int(n['socket']) for n in partial_core= s]) >=20 > - sockList =3D list(sockList)[:nr_sockets] > + if from_last: > + sockList =3D list(sockList)[-nr_sockets:] > + else: > + sockList =3D list(sockList)[:nr_sockets] > partial_cores =3D [n for n in partial_cores if int( > n['socket']) in sockList] >=20 > @@ -694,7 +703,10 @@ class Crb(object): > for sock in sockList: > core_list =3D list([int(n['thread']) for n in partia= l_cores if int( > n['socket']) =3D=3D sock]) > - core_list =3D core_list[:nr_cores] > + if from_last: > + core_list =3D core_list[-nr_cores:] > + else: > + core_list =3D core_list[:nr_cores] > temp.extend(core_list) >=20 > core_list =3D temp > @@ -716,23 +728,32 @@ class Crb(object): > for core in coreList_aux: > thread_list =3D list([int(n['thread']) for n in part= ial_cores if ( > (int(n['core']) =3D=3D core) and (int(n['socket'= ]) =3D=3D sock))]) > - thread_list =3D thread_list[:nr_threads] > + if from_last: > + thread_list =3D thread_list[-nr_threads:] > + else: > + thread_list =3D thread_list[:nr_threads] > temp.extend(thread_list) > thread_list =3D temp > i +=3D 1 > return map(str, thread_list) >=20 > - def get_lcore_id(self, config): > + def get_lcore_id(self, config, inverse =3D False): > """ > Get lcore id of specified core by config "C{socket.core.thread}" > """ >=20 > - m =3D re.match("C{([01]).(\d).([01])}", config) > + m =3D re.match("C{([01]).(\d+).([01])}", config) >=20 > if m: > sockid =3D m.group(1) > coreid =3D int(m.group(2)) > + if inverse: > + coreid +=3D 1 > + coreid =3D -coreid > threadid =3D int(m.group(3)) > + if inverse: > + threadid +=3D 1 > + threadid =3D -threadid >=20 > perSocklCs =3D [_ for _ in self.cores if _['socket'] =3D=3D = sockid] > coreNum =3D perSocklCs[coreid]['core'] > -- > 1.7.9.5