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 09C53A04DD; Thu, 19 Nov 2020 06:20:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C14B8F90; Thu, 19 Nov 2020 06:20:22 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 07CBC3B5 for ; Thu, 19 Nov 2020 06:20:20 +0100 (CET) IronPort-SDR: LDNEEWWTIDJPtgVMoANvh1INgQQacQhhvUqHR3QyPsoPChjrCOR9W2EvXUBJXMsElhVyGtVkes j3CV4hICn1Zg== X-IronPort-AV: E=McAfee;i="6000,8403,9809"; a="158268010" X-IronPort-AV: E=Sophos;i="5.77,489,1596524400"; d="scan'208";a="158268010" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2020 21:20:18 -0800 IronPort-SDR: e5+NpplkGasrWAm+0jS1hbgjdg5EMREHb3/dN8mgyFx/GAO4m4tedHPKqd/JACKZ7zqnAf+jfR vKf5xxBEUBbg== X-IronPort-AV: E=Sophos;i="5.77,489,1596524400"; d="scan'208";a="476670762" Received: from unknown (HELO localhost.localdomain) ([10.240.183.77]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2020 21:20:17 -0800 From: JiangYuX To: dts@dpdk.org Cc: JiangYu Date: Thu, 19 Nov 2020 13:19:25 +0000 Message-Id: <20201119131925.2053604-1-yux.jiang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH V1] tests/perf_virtio_user_loopback: Add one new case and Optimize script 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: JiangYu 1,Automate new case:TC10 perf_loopback_packed_ring_vectorized_path 2,Optimize testpmd function Signed-off-by: JiangYu --- tests/TestSuite_perf_virtio_user_loopback.py | 78 ++++++++++++++++------------ 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/tests/TestSuite_perf_virtio_user_loopback.py b/tests/TestSuite_perf_virtio_user_loopback.py index 9f40d36..4408786 100644 --- a/tests/TestSuite_perf_virtio_user_loopback.py +++ b/tests/TestSuite_perf_virtio_user_loopback.py @@ -43,6 +43,7 @@ import re import json import rst import os +from pmd_output import PmdOutput from copy import deepcopy from test_case import TestCase from settings import UPDATE_EXPECTED, load_global_setting @@ -70,6 +71,8 @@ class TestPerfVirtioUserLoopback(TestCase): self.vhost = self.dut.new_session(suite="vhost") self.virtio_user = self.dut.new_session(suite="virtio-user") + self.vhost_pmd = PmdOutput(self.dut, self.vhost) + self.virtio_user_pmd = PmdOutput(self.dut, self.virtio_user) self.save_result_flag = True self.json_obj = dict() self.path=self.dut.apps_name['test-pmd'] @@ -106,36 +109,31 @@ class TestPerfVirtioUserLoopback(TestCase): """ start testpmd on vhost """ - eal_params = self.dut.create_eal_parameters(cores=self.core_list_host, - no_pci=True, prefix='vhost') - command_line_client = self.path + " %s " + \ - "--socket-mem %s --vdev " + \ - "'net_vhost0,iface=vhost-net,queues=%d' -- -i --nb-cores=%d " + \ - "--rxq=%d --txq=%d --txd=%d --rxd=%d" - command_line_client = command_line_client % ( - eal_params, self.socket_mem, self.queue_number, - self.nb_cores, self.queue_number, self.queue_number, - nb_desc, nb_desc) - self.vhost.send_expect(command_line_client, "testpmd> ", 120) - self.vhost.send_expect("set fwd mac", "testpmd> ", 120) + vdevs = "'net_vhost0,iface=vhost-net,queues={},client=0'".format(self.queue_number) + eal_params = "--socket-mem {} --vdev {}".format(self.socket_mem, vdevs) + param = "--nb-cores={} --rxq={} --txq={} --txd={} --rxd={}".format(self.nb_cores, self.queue_number, self.queue_number, nb_desc, nb_desc) + self.vhost_pmd.start_testpmd(self.core_list_host, param=param, no_pci=True, ports=[], eal_param=eal_params, prefix='vhost', fixed_prefix=True) + self.vhost_pmd.execute_cmd("set fwd mac", "testpmd> ", 120) def start_virtio_testpmd(self, nb_desc, args): """ start testpmd on virtio """ - eal_params = self.dut.create_eal_parameters(cores=self.core_list_user, - no_pci=True, prefix='virtio') - command_line_user = self.path+ " %s " + \ - " --socket-mem %s " + \ - "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,queues=%d,%s " + \ - "-- -i %s --rss-ip --nb-cores=%d --rxq=%d --txq=%d --txd=%d --rxd=%d" - command_line_user = command_line_user % ( - eal_params, self.socket_mem, - self.queue_number, args["version"], args["path"], self.nb_cores, - self.queue_number, self.queue_number, nb_desc, nb_desc) - self.virtio_user.send_expect(command_line_user, "testpmd> ", 120) - self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120) - self.virtio_user.send_expect("start", "testpmd> ", 120) + eal_param = "--socket-mem {} --vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,queues={},{}".format(self.socket_mem, self.queue_number, args["version"]) + if self.check_2M_env: + eal_param += " --single-file-segments" + if 'vectorized_path' in self.running_case: + eal_param += " --force-max-simd-bitwidth=512" + param = "{} --rss-ip --nb-cores={} --rxq={} --txq={} --txd={} --rxd={}".format(args["path"], self.nb_cores, self.queue_number, self.queue_number, nb_desc, nb_desc) + self.virtio_user_pmd.start_testpmd(cores=self.core_list_user, param=param, eal_param=eal_param, \ + no_pci=True, ports=[], prefix="virtio", fixed_prefix=True) + self.virtio_user_pmd.execute_cmd("set fwd mac", "testpmd> ", 120) + self.virtio_user_pmd.execute_cmd("start", "testpmd> ", 120) + + @property + def check_2M_env(self): + out = self.dut.send_expect("cat /proc/meminfo |grep Hugepagesize|awk '{print($2)}'", "# ") + return True if out == '2048' else False def calculate_avg_throughput(self): """ @@ -143,10 +141,10 @@ class TestPerfVirtioUserLoopback(TestCase): """ results = 0.0 results_row = [] - out = self.vhost.send_expect("show port stats all", "testpmd>", 60) + out = self.vhost_pmd.execute_cmd("show port stats all", "testpmd>", 60) time.sleep(5) for i in range(10): - out = self.vhost.send_expect("show port stats all", "testpmd>", 60) + out = self.vhost_pmd.execute_cmd("show port stats all", "testpmd>", 60) time.sleep(5) lines = re.search("Rx-pps:\s*(\d*)", out) result = lines.group(1) @@ -161,22 +159,22 @@ class TestPerfVirtioUserLoopback(TestCase): """ for frame_size in self.frame_sizes: self.throughput[frame_size] = dict() - self.vhost.send_expect("set txpkts %d" % frame_size, "testpmd> ", 30) - self.vhost.send_expect("start tx_first 32", "testpmd> ", 30) + self.vhost_pmd.execute_cmd("set txpkts %d" % frame_size, "testpmd> ", 30) + self.vhost_pmd.execute_cmd("start tx_first 32", "testpmd> ", 30) Mpps = self.calculate_avg_throughput() self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size)) self.throughput[frame_size][nb_desc] = Mpps self.logger.info("Trouthput of " + "framesize: {}, rxd/txd: {} is :{} Mpps".format( frame_size, nb_desc, Mpps)) - self.vhost.send_expect("stop", "testpmd> ", 60) + self.vhost_pmd.execute_cmd("stop", "testpmd> ", 60) def close_all_testpmd(self): """ close all testpmd of vhost and virtio """ - self.vhost.send_expect("quit", "#", 60) - self.virtio_user.send_expect("quit", "#", 60) + self.vhost_pmd.execute_cmd("quit", "#", 60) + self.virtio_user_pmd.execute_cmd("quit", "#", 60) def close_all_session(self): """ @@ -422,6 +420,22 @@ class TestPerfVirtioUserLoopback(TestCase): self.handle_expected() self.handle_results() + def test_perf_loopback_packed_ring_vectorized_path(self): + """ + Test Case 10: loopback test with packed ring vectorized path + """ + self.test_target = "packed_ring_vectorized_path" + virtio_pmd_arg = {"version": "packed_vq=1,in_order=1,mrg_rxbuf=0,vectorized=1", + "path": "--tx-offloads=0x0"} + self.expected_throughput = self.get_suite_cfg()['expected_throughput'][self.test_target] + nb_desc = self.test_parameters[64][0] + self.start_vhost_testpmd(nb_desc) + self.start_virtio_testpmd(nb_desc, virtio_pmd_arg) + self.send_and_verify(nb_desc, "virtio_1.1 vectorized") + self.close_all_testpmd() + self.handle_expected() + self.handle_results() + def tear_down(self): """ Run after each test case. -- 2.7.4