diff mbox series

[V1] tests/vm2vm_virtio_pmd: fix script issues

Message ID 20210729101157.87409-1-linglix.chen@intel.com (mailing list archive)
State Superseded
Headers show
Series [V1] tests/vm2vm_virtio_pmd: fix script issues | expand

Commit Message

Chen, LingliX July 29, 2021, 10:11 a.m. UTC
1.Launch virtio-pmd on VM with_mergeable_path add
--rx-offloads=0x00002000, according to dpdk commit 4e8169eb0d2d(net/virtio: fix Rx scatter offload).
2.start_vms() use qemu_path instead mode and mergeable parameters.
3.fix script issues:influence between cases. 

Signed-off-by: Lingli Chen <linglix.chen@intel.com>
---
 tests/TestSuite_vm2vm_virtio_pmd.py | 97 ++++++++++++++---------------
 1 file changed, 48 insertions(+), 49 deletions(-)
diff mbox series

Patch

diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py b/tests/TestSuite_vm2vm_virtio_pmd.py
index 44f17a36..99a4602b 100644
--- a/tests/TestSuite_vm2vm_virtio_pmd.py
+++ b/tests/TestSuite_vm2vm_virtio_pmd.py
@@ -66,6 +66,7 @@  class TestVM2VMVirtioPMD(TestCase):
         self.pmd_vhost = PmdOutput(self.dut, self.vhost_user)
         self.cbdma_dev_infos = []
         self.vm_config = 'vhost_sample'
+        self.device_str = ' '
 
     def set_up(self):
         """
@@ -155,20 +156,20 @@  class TestVM2VMVirtioPMD(TestCase):
         w_pci_str = ' '.join(w_pci_list)
         if path_mode == "mergeable":
             command = self.app_testpmd_path + " -c 0x3 -n 4 " + \
-                        "--file-prefix=virtio -- -i --tx-offloads=0x00 " + \
-                        "--enable-hw-vlan-strip " + "--txq={0} --rxq={0} ".format(queues) if queues else ""
+                        "--file-prefix=virtio -- -i --tx-offloads=0x00 --rx-offloads=0x00002000 " + \
+                        "--enable-hw-vlan-strip " + ("--txq={0} --rxq={0} ".format(queues) if queues else "")
 
             command = command + "--txd=1024 --rxd=1024 %s"
             vm_client.send_expect(command % extern_param, "testpmd> ", 20)
         elif path_mode == "normal":
             command = self.app_testpmd_path + " -c 0x3 -n 4 " + \
                         "--file-prefix=virtio -- -i --tx-offloads=0x00 " + \
-                        "--enable-hw-vlan-strip " + "--txq={0} --rxq={0} ".format(queues) if queues else ""
+                        "--enable-hw-vlan-strip " + ("--txq={0} --rxq={0} ".format(queues) if queues else "")
             command = command + "--txd=1024 --rxd=1024 %s"
             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" + "--txq={0} --rxq={0} ".format(queues) if queues else ""
+                        "--file-prefix=virtio %s -- -i " + ("--txq={0} --rxq={0} ".format(queues) if queues else "")
             command = command + "--txd=1024 --rxd=1024 %s"
             vm_client.send_expect(command % (w_pci_str, extern_param), "testpmd> ", 20)
 
@@ -188,29 +189,16 @@  class TestVM2VMVirtioPMD(TestCase):
                     "--pdump  '%s,queue=*,rx-dev=%s,mbuf-size=8000'"
             self.pdump_session.send_expect(command_line % (self.dut.prefix_subfix, dump_port, self.dump_pcap), 'Port')
 
-    def start_vms(self, mode=0, mergeable=True, server_mode=False, opt_queue=None, vm_config=''):
+    def start_vms(self, qemu_path='', server_mode=False, opt_queue=None, vm_config='vhost_sample'):
         """
         start two VM, each VM has one virtio device
         """
         # for virtio 0.95, start vm with "disable-modern=true"
         # for virito 1.0, start vm with "disable-modern=false"
-        if mode == 0:
-            setting_args = "disable-modern=true"
-        elif mode == 1:
-            setting_args = "disable-modern=false"
-        elif mode == 2:
-            setting_args = "disable-modern=false,packed=on"
-        if mergeable is True:
-            setting_args += "," + "mrg_rxbuf=on"
-        else:
-            setting_args += "," + "mrg_rxbuf=off"
         vm_params = {}
-        if opt_queue > 1:
-            setting_args += ",csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on,guest_ufo=on,host_ufo=on"
+
+        if opt_queue is not None:
             vm_params['opt_queue'] = opt_queue
-            setting_args = setting_args + ",mq=on,vectors=40"
-        else:
-            setting_args += ",csum=on,gso=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on"
 
         for i in range(self.vm_num):
             vm_dut = None
@@ -222,7 +210,7 @@  class TestVM2VMVirtioPMD(TestCase):
             else:
                 vm_params['opt_path'] = self.base_dir + '/vhost-net%d' % i + ',server'
             vm_params['opt_mac'] = "52:54:00:00:00:0%d" % (i+1)
-            vm_params['opt_settings'] = setting_args
+            vm_params['opt_settings'] = qemu_path
             vm_info.set_vm_device(**vm_params)
             time.sleep(3)
             try:
@@ -304,62 +292,67 @@  class TestVM2VMVirtioPMD(TestCase):
 
     def test_vhost_vm2vm_virtio_pmd_with_normal_path(self):
         """
-        vhost-user + virtio-pmd with normal path
+        Test Case 2: vhost-user + virtio-pmd with normal path
         """
+        qemu_path = "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(mode=0, mergeable=False)
+        self.start_vms(qemu_path=qemu_path)
         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 0.95 normal path", path=path_mode)
 
     def test_vhost_vm2vm_virito_10_pmd_with_normal_path(self):
         """
-        vhost-user + virtio1.0-pmd with normal path
+        Test Case 4: vhost-user + virtio1.0-pmd with normal path
         """
         path_mode = "normal"
+        qemu_path = "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(mode=1, mergeable=False)
+        self.start_vms(qemu_path=qemu_path)
         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_vhost_vm2vm_virtio_pmd_with_vector_rx_path(self):
         """
-        vhost-user + virtio-pmd with vector_rx path
+        Test Case 1: vhost-user + virtio-pmd with vector_rx path
         """
         path_mode = "vector_rx"
+        qemu_path = "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(mode=0, mergeable=False)
+        self.start_vms(qemu_path=qemu_path)
         self.start_vm_testpmd(self.vm_dut[0], path_mode, virtio_net_pci = self.vm_dut[0].ports_info[0]['pci'])
         self.start_vm_testpmd(self.vm_dut[1], path_mode, virtio_net_pci = self.vm_dut[1].ports_info[0]['pci'])
         self.send_and_verify(mode="virtio 0.95 vector_rx", path=path_mode)
 
     def test_vhost_vm2vm_virtio_10_pmd_with_vector_rx_path(self):
         """
-        vhost-user + virtio1.0-pmd with vector_rx path
+        Test Case 3: vhost-user + virtio1.0-pmd with vector_rx path
         """
         path_mode = "vector_rx"
+        qemu_path = "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(mode=1, mergeable=False)
+        self.start_vms(qemu_path=qemu_path)
         self.start_vm_testpmd(self.vm_dut[0], path_mode, virtio_net_pci = self.vm_dut[0].ports_info[0]['pci'])
         self.start_vm_testpmd(self.vm_dut[1], path_mode, virtio_net_pci = self.vm_dut[1].ports_info[0]['pci'])
         self.send_and_verify(mode="virtio 1.0 vector_rx", path=path_mode)
 
     def test_vhost_vm2vm_virito_pmd_with_mergeable_path(self):
         """
-        vhost-user + virtio-pmd with mergeable path test with payload check
+        Test Case 5: vhost-user + virtio-pmd with mergeable path test with payload check
         """
         path_mode = "mergeable"
+        qemu_path = "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(mode=0, mergeable=True)
+        self.start_vms(qemu_path=qemu_path)
         # git the vm enough huge to run pdump
         self.vm_dut[0].set_huge_pages(2048)
         # start testpmd and pdump in VM0
@@ -377,14 +370,15 @@  class TestVM2VMVirtioPMD(TestCase):
 
     def test_vhost_vm2vm_virito_10_pmd_with_mergeable_path(self):
         """
-        vhost-user + virtio1.0-pmd with mergeable path test with payload check
+        Test Case 6: vhost-user + virtio1.0-pmd with mergeable path test with payload check
         """
         path_mode = "mergeable"
+        qemu_path = "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(mode=1, mergeable=True)
+        self.start_vms(qemu_path=qemu_path)
         # git the vm enough huge to run pdump
         self.vm_dut[0].set_huge_pages(2048)
         # start testpmd and pdump in VM0
@@ -402,26 +396,28 @@  class TestVM2VMVirtioPMD(TestCase):
 
     def test_vhost_vm2vm_virito_11_pmd_with_normal_path(self):
         """
-        vhost-user + virtio1.0-pmd with normal path
+        Test Case 8: vhost-user + virtio1.0-pmd with normal path
         """
         path_mode = "normal"
+        qemu_path = "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(mode=2, mergeable=False)
+        self.start_vms(qemu_path=qemu_path)
         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_vhost_vm2vm_virito_11_pmd_with_mergeable_path(self):
         """
-        vhost-user + virtio1.0-pmd with mergeable path test with payload check
+        Test Case 7: vhost-user + virtio1.0-pmd with mergeable path test with payload check
         """
         path_mode = "mergeable"
+        qemu_path = "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(mode=2, mergeable=True)
+        self.start_vms(qemu_path=qemu_path)
         # git the vm enough huge to run pdump
         self.vm_dut[0].set_huge_pages(2048)
         # start testpmd and pdump in VM0
@@ -437,7 +433,7 @@  class TestVM2VMVirtioPMD(TestCase):
          # check the packet in vm0
         self.check_packet_payload_valid(self.vm_dut[0])
 
-    def test_vhost_vm2vm_virtio_split_ring_with_mergeable_path_cbdma_enabled(self):
+    def test_vhost_vm2vm_virtio_split_ring_with_mergeable_path_cbdma_enable(self):
         """
         Test Case 9: VM2VM virtio-pmd split ring mergeable path 8 queues CBDMA enable with server mode stable test
         """
@@ -445,8 +441,9 @@  class TestVM2VMVirtioPMD(TestCase):
         self.get_core_list(self.nb_cores + 1)
         self.get_cbdma_ports_info_and_bind_to_dpdk(cbdma_num=16, queue_num=8, allow_diff_socket=True)
         self.logger.info("Launch vhost-testpmd with CBDMA and used 8 queue")
-        self.prepare_test_env(cbdma=True, no_pci=False, client_mode=True, enable_queues=8, nb_cores=4,
-                              server_mode=True, opt_queue=8, combined=True, rxq_txq=8)
+        qemu_path = "disable-modern=false,mrg_rxbuf=on,mq=on,vectors=40,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on,guest_ufo=on,host_ufo=on"
+        self.prepare_test_env(cbdma=True, no_pci=False, client_mode=True, enable_queues=8, nb_cores=4, qemu_path=qemu_path,
+                              server_mode=True, opt_queue=8, rxq_txq=8)
         self.logger.info("Launch testpmd in VM1")
         self.start_vm_testpmd(self.vm_dut[0], "mergeable", extern_param="--max-pkt-len=9600", queues="8")
         self.vm_dut[0].send_expect('set fwd mac', 'testpmd> ', 30)
@@ -469,7 +466,7 @@  class TestVM2VMVirtioPMD(TestCase):
             self.check_port_stats_result(self.vm_dut[0], queue_num=8)
             self.check_port_stats_result(self.vm_dut[1], queue_num=8)
 
-    def test_vhost_vm2vm_split_ring_with_mergeable_path_and_server_mode_cbdma_enabled(self):
+    def test_vhost_vm2vm_split_ring_with_mergeable_path_and_server_mode_cbdma_enable(self):
         """
         Test Case 10: VM2VM virtio-pmd split ring mergeable path dynamic queue size CBDMA enable with server mode test
         """
@@ -477,8 +474,9 @@  class TestVM2VMVirtioPMD(TestCase):
         self.get_core_list(self.nb_cores + 1)
         self.get_cbdma_ports_info_and_bind_to_dpdk(cbdma_num=16, queue_num=8, allow_diff_socket=True)
         self.logger.info("Launch vhost-testpmd with CBDMA and used 8 queue")
-        self.prepare_test_env(cbdma=True, no_pci=False, client_mode=True, enable_queues=8, nb_cores=4,
-                              server_mode=True, opt_queue=8, combined=True, rxq_txq=8)
+        qemu_path = "disable-modern=false,mrg_rxbuf=on,mq=on,vectors=40,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on,guest_ufo=on,host_ufo=on"
+        self.prepare_test_env(cbdma=True, no_pci=False, client_mode=True, enable_queues=8, nb_cores=4, qemu_path=qemu_path,
+                              server_mode=True, opt_queue=8, rxq_txq=8)
         self.logger.info("Launch testpmd in VM1")
         self.start_vm_testpmd(self.vm_dut[0], "mergeable", extern_param="--max-pkt-len=9600", queues="8")
         self.vm_dut[0].send_expect('set fwd mac', 'testpmd> ', 30)
@@ -500,15 +498,16 @@  class TestVM2VMVirtioPMD(TestCase):
         self.check_port_stats_result(self.vm_dut[0], queue_num=8)
         self.check_port_stats_result(self.vm_dut[1], queue_num=8)
 
-    def test_vhost_vm2vm_packed_ring_with_mergeable_path_and_8queues_cbdma_enabled(self):
+    def test_vhost_vm2vm_packed_ring_with_mergeable_path_and_8queues_cbdma_enable(self):
         """
         Test Case 11: VM2VM virtio-pmd packed ring mergeable path 8 queues CBDMA enable test
         """
         self.nb_cores = 4
         self.get_core_list(self.nb_cores + 1)
         self.get_cbdma_ports_info_and_bind_to_dpdk(cbdma_num=16, queue_num=8, allow_diff_socket=True)
-        self.prepare_test_env(cbdma=True, no_pci=False, client_mode=False, enable_queues=8, nb_cores=4,
-                              server_mode=False, opt_queue=8, combined=True, rxq_txq=8, mode=2)
+        qemu_path = "disable-modern=false,mrg_rxbuf=on,mq=on,vectors=40,csum=on,guest_csum=on,host_tso4=on,guest_tso4=on,guest_ecn=on,guest_ufo=on,host_ufo=on,packed=on"
+        self.prepare_test_env(cbdma=True, no_pci=False, client_mode=False, enable_queues=8, nb_cores=4, qemu_path=qemu_path,
+                              server_mode=False, opt_queue=8, rxq_txq=8)
         self.logger.info("Launch testpmd in VM1")
         self.start_vm_testpmd(self.vm_dut[0], "mergeable", extern_param="--max-pkt-len=9600", queues="8")
         self.logger.info("Launch testpmd in VM2 and send imix pkts")
@@ -616,14 +615,14 @@  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, cbdma=False, no_pci=True, client_mode=False, enable_queues=1, nb_cores=2,
-                         server_mode=False, opt_queue=None, combined=False, rxq_txq=None, iova_mode=False, vm_config='vhost_sample', mode=1):
+    def prepare_test_env(self, cbdma=False, no_pci=True, client_mode=False, enable_queues=1, nb_cores=2, qemu_path='',
+                         server_mode=False, opt_queue=None, rxq_txq=None, iova_mode=False, vm_config='vhost_sample'):
         """
         start vhost testpmd and qemu, and config the vm env
         """
         self.start_vhost_testpmd_cbdma(cbdma=cbdma, no_pci=no_pci, client_mode=client_mode, enable_queues=enable_queues,
                                  nb_cores=nb_cores, rxq_txq=rxq_txq, iova_mode=iova_mode)
-        self.start_vms(server_mode=server_mode, opt_queue=opt_queue, mode=mode, vm_config=vm_config)
+        self.start_vms(qemu_path=qemu_path, server_mode=server_mode, opt_queue=opt_queue, vm_config=vm_config)
 
     def start_vhost_testpmd_cbdma(self, cbdma=False, no_pci=True, client_mode=False, enable_queues=1, nb_cores=2, rxq_txq=None, iova_mode=False):
         """