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 D913DA045E for ; Thu, 30 May 2019 12:47:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A37D94F91; Thu, 30 May 2019 12:47:36 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id B4A4D4CA6 for ; Thu, 30 May 2019 12:47:35 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4UAiwMm001317 for ; Thu, 30 May 2019 03:47:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=Idm5vgzCEGryZEay1bw8sY3rc3M5eFGLDxvsrrKO84A=; b=cV8Y/RvffHk29AwndCUU+7TPwp06tGib6XY9KEIRR9d8fd7lt4wBwP7Wsc9SkspeueFZ C67DfkF3u+yWkM/msXqUHc9Js66yt9x/7AT7/3AUfGZcopsiOEb8DOpDPqLFuQoZPBEX tuTI7NRCRFYICVIf4rb3XKLXFcyMMNqWMn/Vk8rRxr7aVyqBDC4vChsQ28TVd3luhgof c/m+RN6/A2yNen8rOrqPAJ0/XQOvXmTrbZvUS3BqM9Ryb544qD4ZHEAFQCZp0eCdfEDt 8Z9BJIhjGpWBtgwZvbEhacEjpKmkeye1OpxF0smMBrQPuTlQ+wU10t9RKbgCCOFe33Ie 4A== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2st448a3d2-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 30 May 2019 03:47:34 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 30 May 2019 03:47:33 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 30 May 2019 03:47:33 -0700 Received: from phanendra-system.marvell.com (unknown [10.28.11.20]) by maili.marvell.com (Postfix) with ESMTP id CAA393F703F; Thu, 30 May 2019 03:47:31 -0700 (PDT) From: To: CC: , , Phanendra Vukkisala Date: Thu, 30 May 2019 16:17:18 +0530 Message-ID: <1559213238-21721-1-git-send-email-pvukkisala@marvell.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-30_06:, , signatures=0 Subject: [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" From: Phanendra Vukkisala Signed-off-by: Phanendra Vukkisala --- framework/crb.py | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) 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) - def get_core_list(self, config, socket=-1): + def get_core_list(self, config, socket=-1, from_last = 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']) == socket): sockList = [int(n['socket'])] - sockList = list(sockList)[:nr_sockets] + if from_last: + sockList = list(sockList)[-nr_sockets:] + else: + sockList = list(sockList)[:nr_sockets] partial_cores = [n for n in partial_cores if int(n['socket']) in sockList] core_list = set([int(n['core']) for n in partial_cores]) @@ -676,7 +679,10 @@ class Crb(object): for sock in sockList: core_list = set([int( n['core']) for n in partial_cores if int(n['socket']) == sock]) - core_list = list(core_list)[:nr_cores] + if from_last: + core_list = list(core_list)[-nr_cores:] + else: + core_list = list(core_list)[:nr_cores] temp.extend(core_list) core_list = temp @@ -686,7 +692,10 @@ class Crb(object): partial_cores = self.cores sockList = set([int(n['socket']) for n in partial_cores]) - sockList = list(sockList)[:nr_sockets] + if from_last: + sockList = list(sockList)[-nr_sockets:] + else: + sockList = list(sockList)[:nr_sockets] partial_cores = [n for n in partial_cores if int( n['socket']) in sockList] @@ -694,7 +703,10 @@ class Crb(object): for sock in sockList: core_list = list([int(n['thread']) for n in partial_cores if int( n['socket']) == sock]) - core_list = core_list[:nr_cores] + if from_last: + core_list = core_list[-nr_cores:] + else: + core_list = core_list[:nr_cores] temp.extend(core_list) core_list = temp @@ -716,23 +728,32 @@ class Crb(object): for core in coreList_aux: thread_list = list([int(n['thread']) for n in partial_cores if ( (int(n['core']) == core) and (int(n['socket']) == sock))]) - thread_list = thread_list[:nr_threads] + if from_last: + thread_list = thread_list[-nr_threads:] + else: + thread_list = thread_list[:nr_threads] temp.extend(thread_list) thread_list = temp i += 1 return map(str, thread_list) - def get_lcore_id(self, config): + def get_lcore_id(self, config, inverse = False): """ Get lcore id of specified core by config "C{socket.core.thread}" """ - m = re.match("C{([01]).(\d).([01])}", config) + m = re.match("C{([01]).(\d+).([01])}", config) if m: sockid = m.group(1) coreid = int(m.group(2)) + if inverse: + coreid += 1 + coreid = -coreid threadid = int(m.group(3)) + if inverse: + threadid += 1 + threadid = -threadid perSocklCs = [_ for _ in self.cores if _['socket'] == sockid] coreNum = perSocklCs[coreid]['core'] -- 1.7.9.5