From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3EBF1A00C2; Fri, 6 Jan 2023 04:40:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EAA24067C; Fri, 6 Jan 2023 04:40:37 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 5D1F54021F for ; Fri, 6 Jan 2023 04:40:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672976435; x=1704512435; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=m8ThyJxbsKCyF8PxAaJNN1+iZoMZyEASyKNG5ibKDjk=; b=eP36eh969h/Fn1gEJQHwtBAM3rU0uw0YeC/QE2kskwYYA9p4EHGHcAUy 7Vh7V6RChYlDmlxHfiNJLsbRKczg5cgWYuJzORQ33v8HfblXMqUHr0Y9B G3TOy8H0HNYB3L3UsrUj1KjopVV0vsB2LsgYsXdjEl4r5Ihb8/W1vidUC Qb7noqxdKUvbuD+gbgIkLZTNvwlUEP08W9WA86DTzvqeperGona43sum7 NrtEGjs4ZXVTaLp7G8MtTs1ZHlUH5JK98nt2ChQKLCjBXY/jKl2zqo0J+ 36IaE9wq7gG80WF3biYG69PtMuAxXNdEDWuj9UkTdmr/ihqJeumQE/Hmj A==; X-IronPort-AV: E=McAfee;i="6500,9779,10581"; a="324414138" X-IronPort-AV: E=Sophos;i="5.96,304,1665471600"; d="scan'208";a="324414138" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2023 19:40:34 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10581"; a="984541761" X-IronPort-AV: E=Sophos;i="5.96,304,1665471600"; d="scan'208";a="984541761" Received: from unknown (HELO localhost.localdomain) ([10.239.252.222]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2023 19:40:32 -0800 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V3] tests/vm2vm_virtio_pmd: optimization testsuite Date: Fri, 6 Jan 2023 11:31:02 +0800 Message-Id: <20230106033102.1722440-1-weix.ling@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 1.Modify testcase name to discriminate different virtio protocol version. 2.Delete unused function and steps. Signed-off-by: Wei Ling --- tests/TestSuite_vm2vm_virtio_pmd.py | 235 +++++++++------------------- 1 file changed, 75 insertions(+), 160 deletions(-) diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py b/tests/TestSuite_vm2vm_virtio_pmd.py index 5721e829..3f1d873a 100644 --- a/tests/TestSuite_vm2vm_virtio_pmd.py +++ b/tests/TestSuite_vm2vm_virtio_pmd.py @@ -14,23 +14,28 @@ from framework.virt_common import VM class TestVM2VMVirtioPMD(TestCase): def set_up_all(self): + """ + Run at the start of each test suite. + """ self.dut_ports = self.dut.get_ports() - self.bind_nic_driver(self.dut_ports) - self.memory_channel = self.dut.get_memory_channels() + self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) self.vm_num = 2 self.dump_pcap = "/root/pdump-rx.pcap" - socket_num = len(set([int(core["socket"]) for core in self.dut.cores])) - self.socket_mem = ",".join(["1024"] * socket_num) self.base_dir = self.dut.base_dir.replace("~", "/root") - self.vhost_user = self.dut.new_session(suite="vhost") - self.virtio_user0 = None - self.virtio_user1 = None + 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.vhost_user_pmd = PmdOutput(self.dut, self.vhost_user) + self.virtio_user0_pmd = PmdOutput(self.dut, self.virtio_user0) + self.virtio_user1_pmd = PmdOutput(self.dut, self.virtio_user1) + self.cores_list = self.dut.get_core_list(config="all", socket=self.ports_socket) + self.vhost_user_core = self.cores_list[0:2] + self.virtio_user0_core = self.cores_list[2:4] + self.virtio_user1_core = self.cores_list[4:6] self.pci_info = self.dut.ports_info[0]["pci"] - self.app_testpmd_path = self.dut.apps_name["test-pmd"] - self.app_pdump = self.dut.apps_name["pdump"] - self.testpmd_name = self.app_testpmd_path.split("/")[-1] - self.pmd_vhost = PmdOutput(self.dut, self.vhost_user) - self.vm_config = "vhost_sample" + self.testpmd_path = self.dut.apps_name["test-pmd"] + self.pdump_path = self.dut.apps_name["pdump"] + self.testpmd_name = self.testpmd_path.split("/")[-1] def set_up(self): """ @@ -50,33 +55,25 @@ class TestVM2VMVirtioPMD(TestCase): self.vm_dut = [] self.vm = [] - def get_core_list(self, cores_num): - """ - create core mask - """ - self.core_config = "1S/%dC/1T" % cores_num - self.cores_list = self.dut.get_core_list(self.core_config) - self.verify( - len(self.cores_list) >= cores_num, - "There has not enough cores to test this case %s" % self.running_case, - ) - def start_vhost_testpmd(self): """ - launch the testpmd on vhost side + launch the testpmd on vhost-user side """ - vhost_mask = self.cores_list[0:2] - testcmd = self.app_testpmd_path + " " - vdev1 = "--vdev 'net_vhost0,iface=%s/vhost-net0,queues=1' " % self.base_dir - vdev2 = "--vdev 'net_vhost1,iface=%s/vhost-net1,queues=1' " % self.base_dir - eal_params = self.dut.create_eal_parameters( - cores=vhost_mask, no_pci=True, prefix="vhost" + eal_param = ( + "--vdev 'net_vhost0,iface=vhost-net0,queues=1' " + "--vdev 'net_vhost1,iface=vhost-net1,queues=1'" ) - para = " -- -i --nb-cores=1 --txd=1024 --rxd=1024" - self.command_line = testcmd + eal_params + vdev1 + vdev2 + para - self.vhost_user.send_expect(self.command_line, "testpmd> ", 30) - self.vhost_user.send_expect("set fwd mac", "testpmd> ", 30) - self.vhost_user.send_expect("start", "testpmd> ", 30) + param = "--nb-cores=1 --txd=1024 --rxd=1024" + self.vhost_user_pmd.start_testpmd( + cores=self.vhost_user_core, + eal_param=eal_param, + param=param, + no_pci=True, + prefix="vhost-user", + fixed_prefix=True, + ) + self.vhost_user_pmd.execute_cmd("set fwd mac") + self.vhost_user_pmd.execute_cmd("start") @property def check_2M_env(self): @@ -89,46 +86,46 @@ class TestVM2VMVirtioPMD(TestCase): """ launch the testpmd as virtio with vhost_net1 """ - self.virtio_user1 = self.dut.new_session(suite="virtio_user1") - virtio_mask = self.cores_list[2:4] - testcmd = self.app_testpmd_path + " " - vdev = ( - "--vdev=net_virtio_user1,mac=00:01:02:03:04:05,path=./vhost-net1,queues=1,%s " + eal_param = ( + "--vdev=net_virtio_user1,mac=00:01:02:03:04:05,path=vhost-net1,queues=1,%s " % path_mode ) - eal_params = self.dut.create_eal_parameters( - cores=virtio_mask, no_pci=True, prefix="virtio", ports=[self.pci_info] - ) if self.check_2M_env: - eal_params += " --single-file-segments" - para = " -- -i --nb-cores=1 --txd=1024 --rxd=1024 %s" % extern_param - command_line = testcmd + eal_params + vdev + para - self.virtio_user1.send_expect(command_line, "testpmd> ", 30) - self.virtio_user1.send_expect("set fwd rxonly", "testpmd> ", 30) - self.virtio_user1.send_expect("start", "testpmd> ", 30) + eal_param += " --single-file-segments" + param = "--nb-cores=1 --txd=1024 --rxd=1024 %s" % extern_param + self.virtio_user1_pmd.start_testpmd( + cores=self.virtio_user1_core, + eal_param=eal_param, + param=param, + no_pci=True, + prefix="virtio-user1", + fixed_prefix=True, + ) + self.virtio_user1_pmd.execute_cmd("set fwd rxonly") + self.virtio_user1_pmd.execute_cmd("start") def start_virtio_testpmd_with_vhost_net0(self, path_mode, extern_param): """ launch the testpmd as virtio with vhost_net0 """ - self.virtio_user0 = self.dut.new_session(suite="virtio_user0") - virtio_mask = self.cores_list[4:6] - testcmd = self.app_testpmd_path + " " - vdev = ( - "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net0,queues=1,%s " + eal_param = ( + "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=vhost-net0,queues=1,%s " % path_mode ) - eal_params = self.dut.create_eal_parameters( - cores=virtio_mask, no_pci=True, prefix="virtio0", ports=[self.pci_info] - ) if self.check_2M_env: - eal_params += " --single-file-segments " - para = " -- -i --nb-cores=1 --txd=1024 --rxd=1024 %s" % extern_param - command_line = testcmd + eal_params + vdev + para - self.virtio_user0.send_expect(command_line, "testpmd> ", 30) - self.virtio_user0.send_expect("set txpkts 2000,2000,2000,2000", "testpmd> ", 30) - self.virtio_user0.send_expect("set burst 1", "testpmd> ", 30) - self.virtio_user0.send_expect("start tx_first 10", "testpmd> ", 30) + eal_param += " --single-file-segments" + param = "--nb-cores=1 --txd=1024 --rxd=1024 %s" % extern_param + self.virtio_user0_pmd.start_testpmd( + cores=self.virtio_user0_core, + eal_param=eal_param, + param=param, + no_pci=True, + prefix="virtio-user0", + fixed_prefix=True, + ) + self.virtio_user0_pmd.execute_cmd("set txpkts 2000,2000,2000,2000") + self.virtio_user0_pmd.execute_cmd("set burst 1") + self.virtio_user0_pmd.execute_cmd("start tx_first 10") def start_vm_testpmd( self, vm_client, path_mode, extern_param="", virtio_net_pci="" @@ -142,7 +139,7 @@ class TestVM2VMVirtioPMD(TestCase): w_pci_str = " ".join(w_pci_list) if path_mode == "mergeable": command = ( - self.app_testpmd_path + self.testpmd_path + " -c 0x3 -n 4 " + "--file-prefix=virtio -- -i --tx-offloads=0x00 --rx-offloads=0x00002000 " + "--enable-hw-vlan-strip " @@ -151,7 +148,7 @@ class TestVM2VMVirtioPMD(TestCase): vm_client.send_expect(command % extern_param, "testpmd> ", 20) elif path_mode == "normal": command = ( - self.app_testpmd_path + self.testpmd_path + " -c 0x3 -n 4 " + "--file-prefix=virtio -- -i --tx-offloads=0x00 " + "--enable-hw-vlan-strip " @@ -160,21 +157,19 @@ class TestVM2VMVirtioPMD(TestCase): vm_client.send_expect(command % extern_param, "testpmd> ", 20) elif path_mode == "vector_rx": command = ( - self.app_testpmd_path - + " -c 0x3 -n 4 " - + "--file-prefix=virtio %s -- -i " + self.testpmd_path + " -c 0x3 -n 4 " + "--file-prefix=virtio %s -- -i " ) command = command + "--txd=1024 --rxd=1024 %s" vm_client.send_expect(command % (w_pci_str, extern_param), "testpmd> ", 20) def launch_pdump_to_capture_pkt(self, client_dut, dump_port): """ - bootup pdump in VM + launch pdump in VM """ self.pdump_session = client_dut.new_session(suite="pdump") if hasattr(client_dut, "vm_name"): command_line = ( - self.app_pdump + self.pdump_path + " " + "-v --file-prefix=virtio -- " + "--pdump '%s,queue=*,rx-dev=%s,mbuf-size=8000'" @@ -184,7 +179,7 @@ class TestVM2VMVirtioPMD(TestCase): ) else: command_line = ( - self.app_pdump + self.pdump_path + " " + "-v --file-prefix=virtio_%s -- " + "--pdump '%s,queue=*,rx-dev=%s,mbuf-size=8000'" @@ -198,17 +193,16 @@ class TestVM2VMVirtioPMD(TestCase): self, setting_args="", server_mode=False, - opt_queue=None, - vm_config="vhost_sample", + opt_queue=1, ): vm_params = {} - if opt_queue is not None: + if opt_queue > 1: vm_params["opt_queue"] = opt_queue for i in range(self.vm_num): vm_dut = None - vm_info = VM(self.dut, "vm%d" % i, vm_config) + vm_info = VM(self.dut, "vm%d" % i, "vhost_sample") vm_params["driver"] = "vhost-user" if not server_mode: @@ -300,13 +294,12 @@ class TestVM2VMVirtioPMD(TestCase): self.dut.close_session(self.virtio_user0) self.virtio_user0 = None - def test_vm2vm_vhost_user_virtio095_pmd_with_vector_rx_path(self): + def test_vm2vm_vhost_user_virtio95_pmd_with_vector_rx_path(self): """ Test Case 1: VM2VM vhost-user/virtio0.95-pmd with vector_rx path """ path_mode = "vector_rx" setting_args = "disable-modern=true,mrg_rxbuf=off,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on" - self.get_core_list(2) self.start_vhost_testpmd() self.start_vms(setting_args=setting_args) self.start_vm_testpmd( @@ -321,13 +314,12 @@ class TestVM2VMVirtioPMD(TestCase): ) self.send_and_verify(mode="virtio 0.95 vector_rx", path=path_mode) - def test_vm2vm_vhost_user_virtio095_pmd_with_normal_path(self): + def test_vm2vm_vhost_user_virtio95_pmd_with_normal_path(self): """ Test Case 2: VM2VM vhost-user/virtio0.95-pmd with normal path """ setting_args = "disable-modern=true,mrg_rxbuf=off,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on" path_mode = "normal" - self.get_core_list(2) self.start_vhost_testpmd() self.start_vms(setting_args=setting_args) self.start_vm_testpmd(self.vm_dut[0], path_mode) @@ -340,7 +332,6 @@ class TestVM2VMVirtioPMD(TestCase): """ path_mode = "vector_rx" setting_args = "disable-modern=false,mrg_rxbuf=off,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on" - self.get_core_list(2) self.start_vhost_testpmd() self.start_vms(setting_args=setting_args) self.start_vm_testpmd( @@ -355,20 +346,19 @@ class TestVM2VMVirtioPMD(TestCase): ) self.send_and_verify(mode="virtio 1.0 vector_rx", path=path_mode) - def test_vhost_vm2vm_virito_10_pmd_with_normal_path(self): + def test_vm2vm_vhost_user_virito10_pmd_with_normal_path(self): """ Test Case 4: VM2VM vhost-user/virtio1.0-pmd with normal path """ path_mode = "normal" setting_args = "disable-modern=false,mrg_rxbuf=off,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on" - self.get_core_list(2) self.start_vhost_testpmd() self.start_vms(setting_args=setting_args) self.start_vm_testpmd(self.vm_dut[0], path_mode) self.start_vm_testpmd(self.vm_dut[1], path_mode) self.send_and_verify(mode="virtio 1.0 normal path", path=path_mode) - def test_vm2vm_vhost_user_virtio095_pmd_with_mergeable_path_with_payload_valid_check( + def test_vm2vm_vhost_user_virtio95_pmd_with_mergeable_path_with_payload_valid_check( self, ): """ @@ -378,7 +368,6 @@ class TestVM2VMVirtioPMD(TestCase): setting_args = "disable-modern=true,mrg_rxbuf=on,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on" extern_param = "--max-pkt-len=9600" dump_port = "port=0" - self.get_core_list(2) self.start_vhost_testpmd() self.start_vms(setting_args=setting_args) # start testpmd and pdump in VM0 @@ -404,7 +393,6 @@ class TestVM2VMVirtioPMD(TestCase): setting_args = "disable-modern=false,mrg_rxbuf=on,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on" extern_param = "--max-pkt-len=9600" dump_port = "port=0" - self.get_core_list(2) self.start_vhost_testpmd() self.start_vms(setting_args=setting_args) # start testpmd and pdump in VM0 @@ -430,7 +418,6 @@ class TestVM2VMVirtioPMD(TestCase): setting_args = "disable-modern=false,mrg_rxbuf=on,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on,packed=on" extern_param = "--max-pkt-len=9600" dump_port = "port=0" - self.get_core_list(2) self.start_vhost_testpmd() self.start_vms(setting_args=setting_args) # start testpmd and pdump in VM0 @@ -446,13 +433,12 @@ class TestVM2VMVirtioPMD(TestCase): # check the packet in vm0 self.check_packet_payload_valid(self.vm_dut[0]) - def test_vhost_vm2vm_virito_11_pmd_with_normal_path(self): + def test_vm2vm_vhost_user_virito11_pmd_with_normal_path(self): """ Test Case 8: VM2VM vhost-user/virtio1.1-pmd with normal path """ path_mode = "normal" setting_args = "disable-modern=false,mrg_rxbuf=off,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on,packed=on" - self.get_core_list(2) self.start_vhost_testpmd() self.start_vms(setting_args=setting_args) self.start_vm_testpmd(self.vm_dut[0], path_mode) @@ -487,77 +473,6 @@ class TestVM2VMVirtioPMD(TestCase): vm_dut.send_expect("clear port stats all", "testpmd> ", 30) vm_dut.send_expect("start", "testpmd> ", 30) - def prepare_test_env( - self, - no_pci=True, - client_mode=False, - enable_queues=1, - nb_cores=2, - setting_args="", - server_mode=False, - opt_queue=None, - rxq_txq=None, - vm_config="vhost_sample", - ): - self.start_vhost_testpmd_cbdma( - no_pci=no_pci, - client_mode=client_mode, - enable_queues=enable_queues, - nb_cores=nb_cores, - rxq_txq=rxq_txq, - ) - self.start_vms( - setting_args=setting_args, - server_mode=server_mode, - opt_queue=opt_queue, - vm_config=vm_config, - ) - - def start_vhost_testpmd_cbdma( - self, - no_pci=True, - client_mode=False, - enable_queues=1, - nb_cores=2, - rxq_txq=None, - ): - """ - launch the testpmd with different parameters - """ - testcmd = self.app_testpmd_path + " " - if not client_mode: - vdev1 = "--vdev 'net_vhost0,iface=%s/vhost-net0,queues=%d' " % ( - self.base_dir, - enable_queues, - ) - vdev2 = "--vdev 'net_vhost1,iface=%s/vhost-net1,queues=%d' " % ( - self.base_dir, - enable_queues, - ) - else: - vdev1 = "--vdev 'net_vhost0,iface=%s/vhost-net0,client=1,queues=%d' " % ( - self.base_dir, - enable_queues, - ) - vdev2 = "--vdev 'net_vhost1,iface=%s/vhost-net1,client=1,queues=%d' " % ( - self.base_dir, - enable_queues, - ) - eal_params = self.dut.create_eal_parameters( - cores=self.cores_list, prefix="vhost", no_pci=no_pci - ) - if rxq_txq is None: - params = " -- -i --nb-cores=%d --txd=1024 --rxd=1024" % nb_cores - else: - params = " -- -i --nb-cores=%d --txd=1024 --rxd=1024 --rxq=%d --txq=%d" % ( - nb_cores, - rxq_txq, - rxq_txq, - ) - self.command_line = testcmd + eal_params + vdev1 + vdev2 + params - self.pmd_vhost.execute_cmd(self.command_line, timeout=30) - self.pmd_vhost.execute_cmd("start", timeout=30) - def tear_down(self): """ Run after each test case. -- 2.25.1