From patchwork Thu Mar 4 03:27:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ling, WeiX" X-Patchwork-Id: 88442 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 535BDA054F; Thu, 4 Mar 2021 04:28:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A90140684; Thu, 4 Mar 2021 04:28:36 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id A167D40147 for ; Thu, 4 Mar 2021 04:28:34 +0100 (CET) IronPort-SDR: SE0c324wlItTO3iT3qQAJxixcIJFKoTzTaaYTOWX4qI06/HEW3FC0J4DqMJXffcnG5TmgvSDF0 QYA23Iq9zORw== X-IronPort-AV: E=McAfee;i="6000,8403,9912"; a="248731854" X-IronPort-AV: E=Sophos;i="5.81,221,1610438400"; d="scan'208";a="248731854" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2021 19:28:33 -0800 IronPort-SDR: Kklj5WqMyPJJooGZvL4u2als9cEiUwp+ArJUzsbBXTX/UgBqjakZPSiR7J6D5LwvgEurYikHQv bsYX+jpo5FEA== X-IronPort-AV: E=Sophos;i="5.81,221,1610438400"; d="scan'208";a="600377164" Received: from unknown (HELO localhost.localdomain) ([10.240.183.222]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2021 19:28:31 -0800 From: Ling Wei To: dts@dpdk.org Cc: Ling Wei Date: Thu, 4 Mar 2021 11:27:40 +0800 Message-Id: <20210304032740.502729-1-weix.ling@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dts] [PATCH V1] tests/vswitch_sample_cbdma:modify start virtio testpmd param sync with testplan and optimize code 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 Sender: "dts" Modify start virtio testpmd param sync with testplan and move create session and pmdout object from set_up to set_up_all in order to reduce the number of creation. Signed-off-by: Ling Wei Tested-by: Wei Ling --- tests/TestSuite_vswitch_sample_cbdma.py | 41 +++++++++++++++---------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/tests/TestSuite_vswitch_sample_cbdma.py b/tests/TestSuite_vswitch_sample_cbdma.py index ca2a1a04..b067cc09 100644 --- a/tests/TestSuite_vswitch_sample_cbdma.py +++ b/tests/TestSuite_vswitch_sample_cbdma.py @@ -84,7 +84,11 @@ class TestVswitchSampleCBDMA(TestCase): self.app_testpmd_path = self.dut.apps_name['test-pmd'] # create an instance to set stream field setting self.pktgen_helper = PacketGeneratorHelper() - + self.vhost_user = self.dut.new_session(suite="vhost-user") + self.virtio_user0 = self.dut.new_session(suite="virtio-user0") + self.virtio_user1 = self.dut.new_session(suite="virtio-user1") + self.virtio_user0_pmd = PmdOutput(self.dut, self.virtio_user0) + self.virtio_user1_pmd = PmdOutput(self.dut, self.virtio_user1) def set_up(self): """ @@ -92,11 +96,6 @@ class TestVswitchSampleCBDMA(TestCase): """ self.dut.send_expect("rm -rf %s/vhost-net*" % self.base_dir, "#") self.dut.send_expect("killall -I qemu-system-x86_64", '#', 20) - self.vhost_user = self.dut.new_session(suite="vhost-user") - self.virtio_user0 = self.dut.new_session(suite="virtio-user0") - self.virtio_user1 = self.dut.new_session(suite="virtio-user1") - self.virtio_user0_pmd = PmdOutput(self.dut, self.virtio_user0) - self.virtio_user1_pmd = PmdOutput(self.dut, self.virtio_user1) def set_async_threshold(self, async_threshold=256): self.logger.info("Configure async_threshold to {}".format(async_threshold)) @@ -149,19 +148,27 @@ class TestVswitchSampleCBDMA(TestCase): time.sleep(3) def start_virtio_testpmd(self, pmd_session, dev_mac, dev_id, cores, prefix, enable_queues=1, server_mode=False, - nb_cores=1, used_queues=1): + vectorized_path=False, nb_cores=1, used_queues=1): """ launch the testpmd as virtio with vhost_net0 """ if server_mode: - eal_params = " --vdev=net_virtio_user0,mac={},path=./vhost-net{},queues={},server=1".format(dev_mac, dev_id, - enable_queues) + if vectorized_path: + eal_params = " --vdev=net_virtio_user0,mac={},path=./vhost-net{},queues={},server=1," \ + "mrg_rxbuf=0,in_order=1,vectorized=1".format(dev_mac, dev_id, enable_queues) + else: + eal_params = " --vdev=net_virtio_user0,mac={},path=./vhost-net{},queues={},server=1"\ + .format(dev_mac, dev_id, enable_queues) else: - eal_params = " --vdev=net_virtio_user0,mac={},path=./vhost-net{},queues={}".format(dev_mac, dev_id, - enable_queues) + if vectorized_path: + eal_params = " --vdev=net_virtio_user0,mac={},path=./vhost-net{},queues={}," \ + "mrg_rxbuf=0,in_order=1,vectorized=1".format(dev_mac, dev_id, enable_queues) + else: + eal_params = " --vdev=net_virtio_user0,mac={},path=./vhost-net{},queues={}"\ + .format(dev_mac, dev_id, enable_queues) if self.check_2M_env: eal_params += " --single-file-segments" - params = "--nb-cores={} --rxq={} --txq={} --txd=1024 --rxd=1024".format(nb_cores, used_queues, used_queues) + params = "--rxq={} --txq={} --txd=1024 --rxd=1024 --nb-cores={}".format(used_queues, used_queues, nb_cores) pmd_session.start_testpmd(cores=cores, param=params, eal_param=eal_params, no_pci=True, ports=[], prefix=prefix, fixed_prefix=True) @@ -310,7 +317,7 @@ class TestVswitchSampleCBDMA(TestCase): self.start_vhost_app(with_cbdma=with_cbdma, cbdma_num=cbdma_num, socket_num=socket_num, client_mode=False) self.start_virtio_testpmd(pmd_session=self.virtio_user0_pmd, dev_mac=self.virtio_dst_mac0, dev_id=0, cores=self.vuser0_core_list, prefix='testpmd0', enable_queues=1, server_mode=False, - nb_cores=1, used_queues=1) + vectorized_path=False, nb_cores=1, used_queues=1) self.virtio_user0_pmd.execute_cmd('set fwd mac') self.virtio_user0_pmd.execute_cmd('start tx_first') self.virtio_user0_pmd.execute_cmd('stop') @@ -373,7 +380,7 @@ class TestVswitchSampleCBDMA(TestCase): nb_cores=1, used_queues=1) self.start_virtio_testpmd(pmd_session=self.virtio_user1_pmd, dev_mac=self.virtio_dst_mac1, dev_id=1, cores=self.vuser1_core_list, prefix='testpmd1', enable_queues=1, server_mode=True, - nb_cores=1, used_queues=1) + vectorized_path=True, nb_cores=1, used_queues=1) self.virtio_user0_pmd.execute_cmd('set fwd mac') self.virtio_user0_pmd.execute_cmd('start tx_first') self.virtio_user0_pmd.execute_cmd('stop') @@ -459,7 +466,7 @@ class TestVswitchSampleCBDMA(TestCase): nb_cores=1, used_queues=1) self.start_virtio_testpmd(pmd_session=self.virtio_user1_pmd, dev_mac=self.virtio_dst_mac1, dev_id=1, cores=self.vuser1_core_list, prefix='testpmd1', enable_queues=1, server_mode=False, - nb_cores=1, used_queues=1) + vectorized_path=True, nb_cores=1, used_queues=1) self.set_testpmd0_param(self.virtio_user0_pmd, self.virtio_dst_mac1) self.set_testpmd1_param(self.virtio_user1_pmd, self.virtio_dst_mac0) @@ -614,7 +621,6 @@ class TestVswitchSampleCBDMA(TestCase): Run after each test case. """ self.bind_cbdma_device_to_kernel() - self.close_all_session() def tear_down_all(self): """ @@ -622,4 +628,5 @@ class TestVswitchSampleCBDMA(TestCase): """ self.set_max_queues(128) self.set_async_threshold(256) - self.dut.build_install_dpdk(self.target) \ No newline at end of file + self.dut.build_install_dpdk(self.target) + self.close_all_session()