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 E39A3A00C2; Tue, 3 Jan 2023 09:14:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B666240693; Tue, 3 Jan 2023 09:14:15 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 2332C40689 for ; Tue, 3 Jan 2023 09:14:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672733653; x=1704269653; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=yRl7ZXH0fJm9UY1zp4h9zojV2rHNbEsO7dV4PpZRdQs=; b=V+lrYfMnB8uRBCBisKttvaJJiZiszaePSBhy/rZg2dUm6cHGC7HGKNCn 9AUBmTmLz0wIqpGIUfE2XwxfYRzR4lpx2pMAastBSDDhGiaDrTBzquPhH lPNtk5EYBgW22G4gGuWPGHG4fMaVK8e4dfpK3wVFK5+IeWuCq2hbgW86Q Ue2NoMxUzpF+xI4AoAWV8FVIbgbJxUtBnnJkb23e2DbwbgXfSUQi3vdKp H7kh+kMi9rZStn7bsPccNbM+C4Rwt0nsvETRtyZqZBRSfDWHg7QrEcyrq rTtqh8kbchfGupPXKey05ss6VyZnjrQ6RPtLti6ne9NC3UWIGz4gftBz0 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="305113871" X-IronPort-AV: E=Sophos;i="5.96,296,1665471600"; d="scan'208";a="305113871" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2023 00:14:11 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="632367825" X-IronPort-AV: E=Sophos;i="5.96,296,1665471600"; d="scan'208";a="632367825" Received: from unknown (HELO localhost.localdomain) ([10.239.252.222]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2023 00:14:10 -0800 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V2] tests/vm2vm_virtio_pmd: optimization testsuite Date: Tue, 3 Jan 2023 16:05:04 +0800 Message-Id: <20230103080504.8913-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 | 234 +++++++++------------------- 1 file changed, 75 insertions(+), 159 deletions(-) diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py b/tests/TestSuite_vm2vm_virtio_pmd.py index 5721e829..293ea034 100644 --- a/tests/TestSuite_vm2vm_virtio_pmd.py +++ b/tests/TestSuite_vm2vm_virtio_pmd.py @@ -4,7 +4,6 @@ import re import time - import framework.utils as utils from framework.packet import Packet from framework.pmd_output import PmdOutput @@ -14,23 +13,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 +54,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'" + ) + 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, ) - 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) + self.vhost_user_pmd.execute_cmd("set fwd mac") + self.vhost_user_pmd.execute_cmd("start") @property def check_2M_env(self): @@ -89,46 +85,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 +138,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 +147,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,7 +156,7 @@ class TestVM2VMVirtioPMD(TestCase): vm_client.send_expect(command % extern_param, "testpmd> ", 20) elif path_mode == "vector_rx": command = ( - self.app_testpmd_path + self.testpmd_path + " -c 0x3 -n 4 " + "--file-prefix=virtio %s -- -i " ) @@ -169,12 +165,12 @@ class TestVM2VMVirtioPMD(TestCase): 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 +180,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 +194,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 +295,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 +315,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 +333,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 +347,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 +369,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 +394,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 +419,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 +434,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 +474,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