From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 20147A04A5; Wed, 17 Jun 2020 10:36:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1802D4C90; Wed, 17 Jun 2020 10:36:58 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 89BA71252 for ; Wed, 17 Jun 2020 10:36:56 +0200 (CEST) IronPort-SDR: cf4v0d/fSwCMWgdm/cILV+5gqYnKJuAJKBmAsqffM3UPJJKdA6Bpg4L6JHiMZD+Y0oClIuEpEx fT6R3rQuJO2w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2020 01:36:56 -0700 IronPort-SDR: ru75o0xsKZ8JPC6rAkv83fNClZnji6VX5Im9wxSw9uY2DZnyF03RlTBl9ZUnnScpE5SJPB1DMg 9C88ocp0FEZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,522,1583222400"; d="scan'208";a="450162214" Received: from dpdk-moyufen06.sh.intel.com ([10.67.116.208]) by orsmga005.jf.intel.com with ESMTP; 17 Jun 2020 01:36:54 -0700 From: yufengmx To: dts@dpdk.org, lijuan.tu@intel.com Cc: yufengmx Date: Wed, 17 Jun 2020 16:36:59 +0800 Message-Id: <20200617083659.4719-8-yufengx.mo@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200617083659.4719-1-yufengx.mo@intel.com> References: <20200617083659.4719-1-yufengx.mo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V1 7/7] tests/l3fwd_base: change core/thread/queue definition 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" change core/thread/queue definition. Signed-off-by: yufengmx --- tests/l3fwd_base.py | 63 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/tests/l3fwd_base.py b/tests/l3fwd_base.py index 2b4934c..e210201 100644 --- a/tests/l3fwd_base.py +++ b/tests/l3fwd_base.py @@ -33,6 +33,7 @@ Layer-3 forwarding test script base class. """ import os +import re import time import traceback import texttable @@ -172,6 +173,19 @@ class L3fwdBase(object): self.verify(total > 0, 'cpu socket should not be zero') return total + @property + def __core_thread_num(self): + cpu_topos = self.dut.get_all_cores() + core_index = cpu_topos[-1]['core'] + thread_index = int(cpu_topos[-1]['thread']) + if not core_index: + msg = 'wrong core index' + raise VerifyFailure(msg) + if not thread_index: + msg = 'wrong thread index' + raise VerifyFailure(msg) + return thread_index//core_index + def __pmd_con(self, cmd): if not self.__pmd_session: return @@ -675,7 +689,8 @@ class L3fwdBase(object): # It is aimed to make sure packet generator detect link up status. wait_time = self.__l3fwd_wait_up if self.__l3fwd_wait_up else \ 2 * len(self.__valports) - self.logger.debug(f"wait {wait_time} seconds for port link up") + self.logger.debug( + f"wait {wait_time} seconds for port link up") time.sleep(wait_time) def __l3fwd_restart_check(self, command_line): @@ -950,17 +965,48 @@ class L3fwdBase(object): if except_content: raise VerifyFailure(except_content) - def __parse_port_config(self, config): - cores, total_threads, queue = config.split('/') + def __parse_port_config(self, config, cores_for_all): + ''' + [n]C/[mT]-[i]Q + + n: how many physical core use for polling. + m: how many cpu thread use for polling, if Hyper-threading disabled + in BIOS, m equals n, if enabled, m is 2 times as n. + i: how many queues use per port, so total queues = i x nb_port + ''' + # old format + pat = '(.*)\/(.*)\/(.*)' + result1 = re.findall(pat, config) + # new format + pat = '(.*)\/(.*)-(.*)' + result2 = re.findall(pat, config) + result = result1 if result1 else result2 + if not result: + msg = f"{config} is wrong format, please check" + raise VerifyFailure(msg) + cores, total_threads, queue = result[0] _thread_num = int(int(total_threads[:-1]) // int(cores[:-1])) + _thread_num = self.__core_thread_num \ + if _thread_num > self.__core_thread_num else _thread_num _thread = str(_thread_num) + 'T' - _cores = str(self.__core_offset + int(cores[:-1]) * len(self.__valports)) + 'C' + multiple = 1 if cores_for_all else len(self.__valports) + _cores = str(self.__core_offset + int(cores[:-1]) * multiple) + 'C' + if len(self.__valports) == 1 and int(total_threads[:-1]) > int(queue[:-1]) * len(self.__valports): + msg = f"Invalid configuration: {config}, please check" + self.logger.warning(msg) + if int(total_threads[:-1]) not in [self.__core_thread_num * int(cores[:-1]), int(cores[:-1])]: + support_num = f"1 or {self.__core_thread_num}" \ + if self.__core_thread_num > 1 else "1" + msg = ( + f"Invalid configuration: {config}, " + f"threads should be {support_num} times of cores") + self.logger.warning(msg) # only use one socket cores_config = '/'.join(['1S', _cores, _thread]) queues_per_port = int(queue[:-1]) return cores_config, _thread_num, queues_per_port - def __get_test_configs(self, options, ports, socket): + def __get_test_configs(self, options, ports, socket, cores_for_all): if not options: msg = "'test_parameters' not set in suite configuration file" raise VerifyFailure(msg) @@ -969,7 +1015,7 @@ class L3fwdBase(object): for test_item, frame_sizes in sorted(options.items()): _frame_sizes = [int(frame_size) for frame_size in frame_sizes] frame_sizes_grp.extend([int(item) for item in _frame_sizes]) - cores, thread_num, queues_per_port = self.__parse_port_config(test_item) + cores, thread_num, queues_per_port = self.__parse_port_config(test_item, cores_for_all) grp = [list(item) for item in product(range(queues_per_port), range(ports))] corelist = self.dut.get_core_list( @@ -1072,9 +1118,12 @@ class L3fwdBase(object): self.__traffic_stop_wait_time = \ test_content.get('traffic_stop_wait_time', 0) # parse port config of l3fwd suite + cores_for_all = test_content.get('cores_for_all', False) port_configs, frame_sizes = self.__get_test_configs( test_content.get('test_parameters'), - len(self.__valports), self.__socket) + len(self.__valports), + self.__socket, + cores_for_all) test_content['port_configs'] = port_configs test_content['frame_sizes'] = frame_sizes self.logger.debug(pformat(test_content)) -- 2.21.0