From patchwork Wed Sep 7 13:31:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yingya Han X-Patchwork-Id: 116019 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 82601A054A; Wed, 7 Sep 2022 07:32:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BE35400D6; Wed, 7 Sep 2022 07:32:57 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 84E9A40042 for ; Wed, 7 Sep 2022 07:32:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662528775; x=1694064775; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Ie9211vY8e7bE4ppvU2xzxb8KIsrh5BiBOJj2ICvJ6M=; b=MBpxHT1PVasd0jzuUk4WUZgucG1cr2lMXwFFLUDBPXU6+zb2ii7eHmNJ qR19/rxFnfZ8rRph7i5ZlrOgSNZU3iAVsdLRGgXvU8rKq02/x7OuPApEP /Ws1x14L2cz7klzqE5eC9Zi7exNSm34RvmgbybSrvv29Iq296VcbVZlXl O+iNpBdGxF5AjAWh5yChyGz+clS2b/DHUfz48wY/1C5axbnsD+VUtQmUT O0nJdlWH7MBK5zBn4CiaS/LyUw4EhEWf9s3qk4WdhZeW+md2nMhM3Oy+n 2zlLKT2tu0CnZqnJMS2dSJeBV7euQtT2Yhqdf0OT3KSqRJ85uh2zPIcGv w==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="276523840" X-IronPort-AV: E=Sophos;i="5.93,295,1654585200"; d="scan'208";a="276523840" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 22:32:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,295,1654585200"; d="scan'208";a="942747971" Received: from dpdk-lijuan-icelake4.sh.intel.com ([10.67.119.50]) by fmsmga005.fm.intel.com with ESMTP; 06 Sep 2022 22:32:45 -0700 From: Yingya Han To: dts@dpdk.org Cc: Yingya Han Subject: [dts][PATCH V1]tests/tso: optimize performance test script code Date: Wed, 7 Sep 2022 21:31:16 +0800 Message-Id: <20220907133116.10000-1-yingyax.han@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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 Signed-off-by: Yingya Han --- tests/TestSuite_tso.py | 144 +++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 85 deletions(-) diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index 49db011d..9f4e27a3 100644 --- a/tests/TestSuite_tso.py +++ b/tests/TestSuite_tso.py @@ -36,25 +36,21 @@ class TestTSO(TestCase): self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") # Verify that enough threads are available - self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all")) self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) + core_config = "1S/2C/1T" + cores = self.dut.get_core_list(core_config, socket=self.ports_socket) + self.verify(cores is not None, "Insufficient cores for speed testing") self.loading_sizes = [128, 800, 801, 1700, 2500] - self.rxfreet_values = [0, 8, 16, 32, 64, 128] - - self.test_cycles = [{"cores": "", "Mpps": {}, "pct": {}}] - self.table_header = ["Frame Size"] - for test_cycle in self.test_cycles: - self.table_header.append("%s Mpps" % test_cycle["cores"]) - self.table_header.append("% linerate") + self.test_result = {"header": [], "data": []} self.eal_param = self.dut.create_eal_parameters( - cores="1S/2C/1T", socket=self.ports_socket, ports=self.dut_ports + cores=core_config, socket=self.ports_socket, ports=self.dut_ports ) - self.headers_size = HEADER_SIZE["eth"] + HEADER_SIZE["ip"] + HEADER_SIZE["tcp"] + self.tester.send_expect( "ifconfig %s mtu %s" % ( @@ -192,9 +188,6 @@ class TestTSO(TestCase): ) mac = self.dut.get_mac_address(self.dut_ports[0]) - cores = self.dut.get_core_list("1S/2C/2T") - self.verify(cores is not None, "Insufficient cores for speed testing") - self.coreMask = utils.create_mask(cores) self.tester.send_expect( "ethtool -K %s rx off tx off tso off gso off gro off lro off" @@ -345,10 +338,6 @@ class TestTSO(TestCase): mac = self.dut.get_mac_address(self.dut_ports[0]) - cores = self.dut.get_core_list("1S/2C/2T") - self.verify(cores is not None, "Insufficient cores for speed testing") - self.coreMask = utils.create_mask(cores) - self.tester.send_expect( "ethtool -K %s rx off tx off tso off gso off gro off lro off" % tx_interface, @@ -492,66 +481,61 @@ class TestTSO(TestCase): TSO Performance Benchmarking with 2 ports. """ + # set header table + header_row = ["Fwd Core", "Frame Size", "Throughput", "Rate"] + self.test_result["header"] = header_row + self.result_table_create(header_row) + self.test_result["data"] = [] + + test_configs = ["1S/1C/1T", "1S/1C/2T", "1S/2C/2T"] + core_offset = 3 # prepare traffic generator input tgen_input = [] # run testpmd for each core config - for test_cycle in self.test_cycles: - core_config = test_cycle["cores"] - cores = self.dut.get_core_list(core_config, socket=self.ports_socket) - self.coreMask = utils.create_mask(cores) - if len(cores) > 2: - queues = len(cores) // 2 - else: - queues = 1 - + for configs in test_configs: + cores = configs.split("/")[1] + thread = configs.split("/")[-1] + thread_num = int(int(thread[:-1]) // int(cores[:-1])) + _cores = str(core_offset + int(cores[0])) + "C" + core_config = "/".join(["1S", _cores, str(thread_num) + "T"]) + corelist = self.dut.get_core_list(core_config, self.ports_socket) + core_list = corelist[(core_offset - 1) * thread_num :] + if "2T" in core_config: + core_list = core_list[1:2] + core_list[0::2] + core_list[1::2][1:] + _core_list = core_list[thread_num - 1 :] + self.eal_param = self.dut.create_eal_parameters( + cores=_core_list, socket=self.ports_socket, ports=self.dut_ports + ) command_line = ( "%s %s -- -i --rxd=512 --txd=512 --burst=32 --rxfreet=64 --mbcache=128 --portmask=%s --max-pkt-len=%s --txpt=36 --txht=0 --txwt=0 --txfreet=32 --txrst=32 " % (self.path, self.eal_param, self.portMask, TSO_MTU) ) - info = "Executing PMD using %s\n" % test_cycle["cores"] + info = "Executing PMD using cores: {0} of config {1}".format( + _core_list, configs + ) self.logger.info(info) - self.rst_report(info, annex=True) - self.rst_report(command_line + "\n\n", frame=True, annex=True) - self.dut.send_expect(command_line, "testpmd> ", 120) self.dut.send_expect("port stop all", "testpmd> ", 120) - self.dut.send_expect( - "csum set ip hw %d" % self.dut_ports[0], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set udp hw %d" % self.dut_ports[0], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set tcp hw %d" % self.dut_ports[0], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set sctp hw %d" % self.dut_ports[0], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set outer-ip hw %d" % self.dut_ports[0], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum parse-tunnel on %d" % self.dut_ports[0], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set ip hw %d" % self.dut_ports[1], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set udp hw %d" % self.dut_ports[1], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set tcp hw %d" % self.dut_ports[1], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set sctp hw %d" % self.dut_ports[1], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set outer-ip hw %d" % self.dut_ports[1], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum parse-tunnel on %d" % self.dut_ports[1], "testpmd> ", 120 - ) + for i in range(2): + self.dut.send_expect( + "csum set ip hw %d" % self.dut_ports[i], "testpmd> ", 120 + ) + self.dut.send_expect( + "csum set udp hw %d" % self.dut_ports[i], "testpmd> ", 120 + ) + self.dut.send_expect( + "csum set tcp hw %d" % self.dut_ports[i], "testpmd> ", 120 + ) + self.dut.send_expect( + "csum set sctp hw %d" % self.dut_ports[i], "testpmd> ", 120 + ) + self.dut.send_expect( + "csum set outer-ip hw %d" % self.dut_ports[i], "testpmd> ", 120 + ) + self.dut.send_expect( + "csum parse-tunnel on %d" % self.dut_ports[i], "testpmd> ", 120 + ) self.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120) self.dut.send_expect("set fwd csum", "testpmd> ", 120) self.dut.send_expect("port start all", "testpmd> ", 120) @@ -588,31 +572,21 @@ class TestTSO(TestCase): tgen_input, 100, None, self.tester.pktgen ) _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams) - + self.verify(pps > 0, "No traffic detected") pps /= 1000000.0 - test_cycle["Mpps"][loading_size] = pps - test_cycle["pct"][loading_size] = pps * 100 // wirespeed - + percentage = pps * 100 / wirespeed + data_row = [ + configs, + frame_size, + "{:.3f} Mpps".format(pps), + "{:.3f}%".format(percentage), + ] + self.result_table_add(data_row) self.dut.send_expect("stop", "testpmd> ") self.dut.send_expect("quit", "# ", 30) time.sleep(5) - for n in range(len(self.test_cycles)): - for loading_size in self.loading_sizes: - self.verify( - self.test_cycles[n]["Mpps"][loading_size] > 0, "No traffic detected" - ) - # Print results - self.result_table_create(self.table_header) - for loading_size in self.loading_sizes: - table_row = [loading_size] - for test_cycle in self.test_cycles: - table_row.append(test_cycle["Mpps"][loading_size]) - table_row.append(test_cycle["pct"][loading_size]) - - self.result_table_add(table_row) - self.result_table_print() def tear_down(self):