test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V2] tests/vm2vm_virtio_user:fix send packet count wrong issue and optimization script code
@ 2021-03-02 10:17 Ling Wei
  2021-03-02 10:18 ` Ling, WeiX
  0 siblings, 1 reply; 2+ messages in thread
From: Ling Wei @ 2021-03-02 10:17 UTC (permalink / raw)
  To: dts; +Cc: Ling Wei

v1:
Fix send packet count wrong issue

v2:
1.Modify send packet function name for increase readability.
2.According to cbdma case need use igb_uio driver to test,
  use and check drivername in execution.cfg.

Signed-off-by: Ling Wei <weix.ling@intel.com>
---
 tests/TestSuite_vm2vm_virtio_user.py | 73 +++++++++++++++++-----------
 1 file changed, 44 insertions(+), 29 deletions(-)

diff --git a/tests/TestSuite_vm2vm_virtio_user.py b/tests/TestSuite_vm2vm_virtio_user.py
index 815afbdd..8e8fc8ab 100644
--- a/tests/TestSuite_vm2vm_virtio_user.py
+++ b/tests/TestSuite_vm2vm_virtio_user.py
@@ -44,6 +44,7 @@ import utils
 from test_case import TestCase
 from packet import Packet
 from pmd_output import PmdOutput
+from settings import load_global_setting, HOST_DRIVER_SETTING
 
 
 class TestVM2VMVirtioUser(TestCase):
@@ -160,12 +161,11 @@ class TestVM2VMVirtioUser(TestCase):
         self.virtio_user0_pmd.start_testpmd(cores=self.core_list_virtio0, param=params, eal_param=eal_params, \
                                            no_pci=True, ports=[],prefix=self.virtio_prefix_0, fixed_prefix=True)
 
-    def check_packet_payload_valid_with_cbdma(self, filename, small_pkts_num, large_8k_pkts_num, large_2k_pkts_num):
+    def check_packet_payload_valid_with_cbdma(self, filename, total_pkts_num, large_8k_pkts_num, large_2k_pkts_num):
         """
         check the payload is valid
         """
         # stop pdump
-        total_pkts_num = small_pkts_num
         actual_8k_pkt_num = 0
         actual_2k_pkt_num = 0
         time.sleep(20)
@@ -197,7 +197,7 @@ class TestVM2VMVirtioUser(TestCase):
         # the virtio0 will send 251 small pkts
         self.start_virtio_testpmd_with_vhost_net0_cbdma(path_mode, extern_param, ringsize)
 
-    def resend_32_large_pkt_from_virtio0(self):
+    def send_32_2k_pkts_from_virtio0(self):
         self.virtio_user0_pmd.execute_cmd('stop')
         self.virtio_user0_pmd.execute_cmd('set burst 32')
         self.virtio_user0_pmd.execute_cmd('set txpkts 2000')
@@ -343,13 +343,13 @@ class TestVM2VMVirtioUser(TestCase):
         # then resend 32 large pkts, all will received
         self.logger.info('check pcap file info about virtio')
         self.get_dump_file_of_virtio_user(path_mode, extern_params, ringsize)
-        self.resend_32_large_pkt_from_virtio0()
+        self.send_32_2k_pkts_from_virtio0()
         self.check_packet_payload_valid(self.dump_virtio_pcap, small_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
 
         # get dump pcap file of vhost
         self.logger.info('check pcap file info about vhost')
         self.get_dump_file_of_vhost_user(path_mode, extern_params, ringsize)
-        self.resend_32_large_pkt_from_virtio0()
+        self.send_32_2k_pkts_from_virtio0()
         self.check_packet_payload_valid(self.dump_vhost_pcap, small_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
 
         self.logger.info('diff the pcap file of vhost and virtio')
@@ -503,13 +503,13 @@ class TestVM2VMVirtioUser(TestCase):
         # then virtio send 32 large pkts, the virtio will all received
         self.logger.info('check pcap file info about virtio')
         self.get_dump_file_of_virtio_user(path_mode, extern_params, ringsize)
-        self.resend_32_large_pkt_from_virtio0()
+        self.send_32_2k_pkts_from_virtio0()
         self.check_packet_payload_valid(self.dump_virtio_pcap, small_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
 
         # get dump pcap file of vhost
         self.logger.info('check pcap file info about vhost')
         self.get_dump_file_of_vhost_user(path_mode, extern_params, ringsize)
-        self.resend_32_large_pkt_from_virtio0()
+        self.send_32_2k_pkts_from_virtio0()
         self.check_packet_payload_valid(self.dump_vhost_pcap, small_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
 
         self.logger.info('diff the pcap file of vhost and virtio')
@@ -671,9 +671,9 @@ class TestVM2VMVirtioUser(TestCase):
         self.cbdma_nic_dev_num = 4
         self.bind_nic_driver(self.dut_ports)
         self.get_cbdma_ports_info_and_bind_to_dpdk()
-        small_pkts_num = 512
         large_8k_pkts_num = 502
-        large_2k_pkts_num = 10
+        large_2k_pkts_num = 64
+        total_pkts_num = large_8k_pkts_num + large_2k_pkts_num
         self.queue_num=2
         self.nopci=False
         path_mode = 'server=1,packed_vq=0,mrg_rxbuf=1,in_order=1'
@@ -686,17 +686,22 @@ class TestVM2VMVirtioUser(TestCase):
                 f"--vdev 'eth_vhost1,iface=vhost-net1,queues=2,client=1,dmas=[txq0@{self.cbdma_dev_infos[2]};txq1@{self.cbdma_dev_infos[3]}],dmathr=512'"
 
         self.get_dump_file_of_virtio_user_cbdma(path_mode, extern_params, ringsize, vdevs, no_pci=False)
-        self.send_8k_pkt()
-        self.check_packet_payload_valid_with_cbdma(self.dump_virtio_pcap, small_pkts_num, large_8k_pkts_num,
-                                                   large_2k_pkts_num)
+        self.send_251_8k_and_32_2k_pkts()
+        # execute stop and port stop all to avoid testpmd tail_pkts issue.
+        self.vhost_user_pmd.execute_cmd('stop')
+        self.vhost_user_pmd.execute_cmd('port stop all')
+        self.check_packet_payload_valid_with_cbdma(self.dump_virtio_pcap, total_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
         # get dump pcap file of vhost
         self.logger.info('check pcap file info about vhost')
-        small_pkts_num = 512
         large_8k_pkts_num = 54
-        large_2k_pkts_num = 458
+        large_2k_pkts_num = 512
+        total_pkts_num = large_8k_pkts_num + large_2k_pkts_num
         self.get_dump_file_of_virtio_user_cbdma(path_mode, extern_params, ringsize, vdevs, no_pci=False)
-        self.send_multiple_pkt()
-        self.check_packet_payload_valid_with_cbdma(self.dump_virtio_pcap, small_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
+        self.send_27_8k_and_256_2k_pkts()
+        # execute stop and port stop all to avoid testpmd tail_pkts issue.
+        self.vhost_user_pmd.execute_cmd('stop')
+        self.vhost_user_pmd.execute_cmd('port stop all')
+        self.check_packet_payload_valid_with_cbdma(self.dump_virtio_pcap, total_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
 
         self.logger.info('diff the pcap file of vhost and virtio')
 
@@ -708,9 +713,9 @@ class TestVM2VMVirtioUser(TestCase):
         self.cbdma_nic_dev_num = 4
         self.bind_nic_driver(self.dut_ports)
         self.get_cbdma_ports_info_and_bind_to_dpdk()
-        small_pkts_num = 448
         large_8k_pkts_num = 54
-        large_2k_pkts_num = 394
+        large_2k_pkts_num = 448
+        total_pkts_num = large_8k_pkts_num + large_2k_pkts_num
         self.queue_num=2
         self.nopci=False
         path_mode = 'server=1,packed_vq=0,mrg_rxbuf=1,in_order=0'
@@ -723,20 +728,26 @@ class TestVM2VMVirtioUser(TestCase):
                 f"--vdev 'eth_vhost1,iface=vhost-net1,queues=2,client=1,dmas=[txq0@{self.cbdma_dev_infos[2]};txq1@{self.cbdma_dev_infos[3]}],dmathr=512'"
 
         self.get_dump_file_of_virtio_user_cbdma(path_mode, extern_params, ringsize, vdevs, no_pci=False)
-        self.send_multiple_pkt_with_8k54_2k394()
-        self.check_packet_payload_valid_with_cbdma(self.dump_virtio_pcap, small_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
+        self.send_27_8k_and_224_2k_pkts()
+        # execute stop and port stop all to avoid testpmd tail_pkts issue.
+        self.vhost_user_pmd.execute_cmd('stop')
+        self.vhost_user_pmd.execute_cmd('port stop all')
+        self.check_packet_payload_valid_with_cbdma(self.dump_virtio_pcap, total_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
         # get dump pcap file of vhost
         self.logger.info('check pcap file info about vhost')
-        small_pkts_num = 448
-        large_8k_pkts_num = 448
+        large_8k_pkts_num = 502
         large_2k_pkts_num = 0
+        total_pkts_num = large_8k_pkts_num + large_2k_pkts_num
         self.get_dump_file_of_virtio_user_cbdma(path_mode, extern_params, ringsize, vdevs, no_pci=False)
-        self.send_multiple_pkt_with_8k448()
-        self.check_packet_payload_valid_with_cbdma(self.dump_virtio_pcap, small_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
+        self.send_251_8k_pkts()
+        # execute stop and port stop all to avoid testpmd tail_pkts issue.
+        self.vhost_user_pmd.execute_cmd('stop')
+        self.vhost_user_pmd.execute_cmd('port stop all')
+        self.check_packet_payload_valid_with_cbdma(self.dump_virtio_pcap, total_pkts_num, large_8k_pkts_num, large_2k_pkts_num)
 
         self.logger.info('diff the pcap file of vhost and virtio')
 
-    def send_multiple_pkt_with_8k54_2k394(self):
+    def send_27_8k_and_224_2k_pkts(self):
         self.virtio_user0_pmd.execute_cmd('set burst 1')
         self.virtio_user0_pmd.execute_cmd('set txpkts 2000,2000,2000,2000')
         self.virtio_user0_pmd.execute_cmd('start tx_first 27')
@@ -746,7 +757,7 @@ class TestVM2VMVirtioUser(TestCase):
         self.virtio_user0_pmd.execute_cmd('start tx_first 7')
         self.vhost_user_pmd.execute_cmd('start')
 
-    def send_multiple_pkt_with_8k448(self):
+    def send_251_8k_pkts(self):
         self.virtio_user0_pmd.execute_cmd('set burst 1')
         self.virtio_user0_pmd.execute_cmd('set txpkts 2000,2000,2000,2000')
         self.virtio_user0_pmd.execute_cmd('start tx_first 27')
@@ -756,7 +767,7 @@ class TestVM2VMVirtioUser(TestCase):
         self.virtio_user0_pmd.execute_cmd('start tx_first 7')
         self.vhost_user_pmd.execute_cmd('start')
 
-    def send_8k_pkt(self):
+    def send_251_8k_and_32_2k_pkts(self):
         self.virtio_user0_pmd.execute_cmd('set burst 1')
         self.virtio_user0_pmd.execute_cmd('set txpkts 2000,2000,2000,2000')
         self.virtio_user0_pmd.execute_cmd('start tx_first 27')
@@ -768,7 +779,7 @@ class TestVM2VMVirtioUser(TestCase):
         self.virtio_user0_pmd.execute_cmd('start tx_first 1')
         self.vhost_user_pmd.execute_cmd('start')
 
-    def send_multiple_pkt(self):
+    def send_27_8k_and_256_2k_pkts(self):
         self.virtio_user0_pmd.execute_cmd('set burst 1')
         self.virtio_user0_pmd.execute_cmd('set txpkts 2000,2000,2000,2000')
         self.virtio_user0_pmd.execute_cmd('start tx_first 27')
@@ -804,4 +815,8 @@ class TestVM2VMVirtioUser(TestCase):
                     self.cbdma_dev_infos.append(pci_info.group(1))
         self.verify(len(self.cbdma_dev_infos) >= 8, 'There no enough cbdma device to run this suite')
         self.device_str = ' '.join(self.cbdma_dev_infos[0:self.cbdma_nic_dev_num])
-        self.dut.send_expect('./usertools/dpdk-devbind.py --force --bind=igb_uio %s' % self.device_str, '# ', 60)
+        # get driver name from execution.cfg
+        driver_name = load_global_setting(HOST_DRIVER_SETTING)
+        self.verify(driver_name == 'igb_uio', "CBDMA test case only use igb_uio driver, need config drivername=igb_uio in execution.cfg")
+        if driver_name == 'igb_uio':
+            self.dut.send_expect('./usertools/dpdk-devbind.py --force --bind=%s %s' % (driver_name, self.device_str), '# ', 60)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-02 10:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 10:17 [dts] [PATCH V2] tests/vm2vm_virtio_user:fix send packet count wrong issue and optimization script code Ling Wei
2021-03-02 10:18 ` Ling, WeiX

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ https://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git