test suite reviews and discussions
 help / color / mirror / Atom feed
From: Ling Wei <weix.ling@intel.com>
To: dts@dpdk.org
Cc: Ling Wei <weix.ling@intel.com>
Subject: [dts] [PATCH V3] tests/vm2vm_virtio_user:fix send packet count wrong issue sync with testplan and optimization script code
Date: Wed,  3 Mar 2021 13:30:14 +0800	[thread overview]
Message-ID: <20210303053014.220817-1-weix.ling@intel.com> (raw)

1.Fix test case 12 and 13 check packet count wrong issue sync with
  testplan.
2.Modify send_* patch function name for increase readability.
3.Add check step about execution drivername is igb_uio or not when 
  run CBDMA test case.

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

diff --git a/tests/TestSuite_vm2vm_virtio_user.py b/tests/TestSuite_vm2vm_virtio_user.py
index 815afbdd..7f63380d 100644
--- a/tests/TestSuite_vm2vm_virtio_user.py
+++ b/tests/TestSuite_vm2vm_virtio_user.py
@@ -160,12 +160,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 +196,10 @@ 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):
+        """
+        send 32 2k length packets from virtio_user0 testpmd
+        """
         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 +345,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 +505,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 +673,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 +688,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 +715,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 +730,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 +759,10 @@ 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):
+        """
+        send 251 8k length packets from virtio_user0 testpmd
+        """
         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 +772,10 @@ 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):
+        """
+        send 251 8k and 32 2k length packets from virtio_user0 testpmd
+        """
         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 +787,10 @@ 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):
+        """
+        send 27 8k and 256 2k length packets from virtio_user0 testpmd
+        """
         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')
@@ -785,9 +807,11 @@ class TestVM2VMVirtioUser(TestCase):
         """
         get all cbdma ports
         """
+        # check driver name in execution.cfg
+        self.verify(self.drivername == 'igb_uio',
+                    "CBDMA test case only use igb_uio driver, need config drivername=igb_uio in execution.cfg")
         str_info = 'Misc (rawdev) devices using kernel driver'
-        out = self.dut.send_expect('./usertools/dpdk-devbind.py --status-dev misc',
-                                   '# ', 30)
+        out = self.dut.send_expect('./usertools/dpdk-devbind.py --status-dev misc', '# ', 30)
         device_info = out.split('\n')
         for device in device_info:
             pci_info = re.search('\s*(0000:\d*:\d*.\d*)', device)
@@ -804,4 +828,4 @@ 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)
+        self.dut.send_expect('./usertools/dpdk-devbind.py --force --bind=%s %s' % (self.drivername, self.device_str), '# ', 60)
-- 
2.25.1


             reply	other threads:[~2021-03-03  5:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03  5:30 Ling Wei [this message]
2021-03-03  5:34 ` Ling, WeiX
2021-03-03  5:36 ` Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210303053014.220817-1-weix.ling@intel.com \
    --to=weix.ling@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).