test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] tests/TestSuite_vhost_virtio_user_interrupt: add 2 cbdma scripts
@ 2020-09-22  7:18 JiangYuX
  2020-09-22  7:21 ` Jiang, YuX
  0 siblings, 1 reply; 3+ messages in thread
From: JiangYuX @ 2020-09-22  7:18 UTC (permalink / raw)
  To: dts; +Cc: JiangYu

From: JiangYu <yux.jiang@intel.com>

Add 2 cbdma scripts

Signed-off-by: JiangYu <yux.jiang@intel.com>
---
 tests/TestSuite_vhost_virtio_user_interrupt.py | 102 +++++++++++++++++++++++--
 1 file changed, 95 insertions(+), 7 deletions(-)

diff --git a/tests/TestSuite_vhost_virtio_user_interrupt.py b/tests/TestSuite_vhost_virtio_user_interrupt.py
index 118fb8e..104998f 100644
--- a/tests/TestSuite_vhost_virtio_user_interrupt.py
+++ b/tests/TestSuite_vhost_virtio_user_interrupt.py
@@ -58,19 +58,25 @@ class TestVirtioUserInterrupt(TestCase):
         self.core_mask_l3fwd = utils.create_mask(self.core_list_l3fwd)
         self.core_mask_virtio = self.core_mask_l3fwd
         self.pci_info = self.dut.ports_info[0]['pci']
+        self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
+        self.cbdma_dev_infos = []
+        self.dmas_info = None
+        self.device_str = None
 
         self.prepare_l3fwd_power()
         self.tx_port = self.tester.get_local_port(self.dut_ports[0])
         self.tx_interface = self.tester.get_interface(self.tx_port)
         self.app_l3fwd_power_path = self.dut.apps_name['l3fwd-power']
         self.app_testpmd_path = self.dut.apps_name['test-pmd']
+        self.testpmd_name = self.app_testpmd_path.split("/")[-1]
+        self.l3fwdpower_name = self.app_l3fwd_power_path.split("/")[-1]
 
     def set_up(self):
         """
         run before each test case.
         """
-        self.dut.send_expect("killall -s INT testpmd", "#")
-        self.dut.send_expect("killall l3fwd-power", "#")
+        self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "#")
+        self.dut.send_expect("killall %s" % self.l3fwdpower_name, "#")
         self.dut.send_expect("rm -rf vhost-net*", "#")
 
         self.l3fwd = self.dut.new_session(suite="l3fwd")
@@ -114,7 +120,7 @@ class TestVirtioUserInterrupt(TestCase):
         else:
             self.logger.info("Launch l3fwd-power sample finished")
 
-    def start_vhost_testpmd(self, pci=""):
+    def start_vhost_testpmd(self, pci="", dmas=None):
         """
         start testpmd on vhost side
         """
@@ -122,9 +128,18 @@ class TestVirtioUserInterrupt(TestCase):
         vdev = ["net_vhost0,iface=vhost-net,queues=1,client=0"]
         para = " -- -i --rxq=1 --txq=1"
         if len(pci) == 0:
-            eal_params = self.dut.create_eal_parameters(cores=self.core_list_vhost, ports=[self.pci_info], vdevs=vdev)
+            if dmas:
+                vdev = ["net_vhost0,iface=vhost-net,queues=1,dmas=[%s]" % dmas]
+                eal_params = self.dut.create_eal_parameters(cores=self.core_list_vhost, vdevs=vdev)
+            else:
+                eal_params = self.dut.create_eal_parameters(cores=self.core_list_vhost, ports=[self.pci_info], vdevs=vdev)
         else:
-            eal_params = self.dut.create_eal_parameters(cores=self.core_list_vhost, prefix='vhost', no_pci=True, vdevs=vdev)
+            if dmas:
+                vdev = ["net_vhost0,iface=vhost-net,queues=1,client=0,dmas=[%s]" % dmas]
+                para = " -- -i"
+                eal_params = self.dut.create_eal_parameters(cores=self.core_list_vhost, ports=pci, prefix='vhost', vdevs=vdev)
+            else:
+                eal_params = self.dut.create_eal_parameters(cores=self.core_list_vhost, prefix='vhost', no_pci=True, vdevs=vdev)
         cmd_vhost_user = testcmd + eal_params + para
 
         self.vhost.send_expect(cmd_vhost_user, "testpmd>", 30)
@@ -163,6 +178,45 @@ class TestVirtioUserInterrupt(TestCase):
         else:
             self.logger.error("Wrong link status not right, status is %s" % result)
 
+    def get_cbdma_ports_info_and_bind_to_dpdk(self, cbdma_num):
+        """
+        get all cbdma ports
+        """
+        str_info = 'Misc (rawdev) devices using kernel driver'
+        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)
+            if pci_info is not None:
+                dev_info = pci_info.group(1)
+                # the numa id of ioat dev, only add the device which
+                # on same socket with nic dev
+                bus = int(dev_info[5:7], base=16)
+                if bus >= 128:
+                    cur_socket = 1
+                else:
+                    cur_socket = 0
+                if self.ports_socket == cur_socket:
+                    self.cbdma_dev_infos.append(pci_info.group(1))
+        self.verify(len(self.cbdma_dev_infos) >= cbdma_num, 'There no enough cbdma device to run this suite')
+        self.used_cbdma = self.cbdma_dev_infos[0:cbdma_num]
+        dmas_info = ''
+        for dmas in self.used_cbdma:
+            number = self.used_cbdma.index(dmas)
+            dmas = 'txq{}@{};'.format(number, dmas)
+            dmas_info += dmas
+        self.dmas_info = dmas_info[:-1]
+        self.device_str = ' '.join(self.used_cbdma)
+        self.dut.setup_modules(self.target, "igb_uio", "None")
+        self.dut.send_expect('./usertools/dpdk-devbind.py --force --bind=%s %s %s' %
+                             ("igb_uio", self.device_str, self.pci_info), '# ', 60)
+
+    def bind_cbdma_device_to_kernel(self):
+        if self.device_str is not None:
+            self.dut.send_expect('modprobe ioatdma', '# ')
+            self.dut.send_expect('./usertools/dpdk-devbind.py -u %s' % self.device_str, '# ', 30)
+            self.dut.send_expect('./usertools/dpdk-devbind.py --force --bind=ioatdma  %s' % self.device_str, '# ', 60)
+
     def test_split_ring_virtio_user_interrupt_with_vhost_net_as_backed(self):
         """
         Check the virtio-user interrupt can work when use vhost-net as backend
@@ -255,12 +309,46 @@ class TestVirtioUserInterrupt(TestCase):
         self.vhost.send_expect("quit", "#", 20)
         self.check_virtio_side_link_status("down")
 
+    def test_lsc_event_between_vhost_user_and_virtio_user_with_split_ring_and_cbdma_enabled(self):
+        """
+        Test Case7: LSC event between vhost-user and virtio-user with split ring and cbdma enabled
+        """
+        self.get_cbdma_ports_info_and_bind_to_dpdk(1)
+        self.start_vhost_testpmd(pci=self.used_cbdma, dmas=self.dmas_info)
+        self.start_virtio_user()
+        self.check_virtio_side_link_status("up")
+
+        self.vhost.send_expect("quit", "#", 20)
+        self.check_virtio_side_link_status("down")
+        self.dut.send_expect("killall %s" % self.l3fwdpower_name, "#")
+        self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "#")
+        self.close_all_session()
+
+    def test_split_ring_virtio_user_interrupt_test_with_vhost_user_as_backend_and_cbdma_enabled(self):
+        """
+        Test Case8: Split ring virtio-user interrupt test with vhost-user as backend and cbdma enabled
+        """
+        self.get_cbdma_ports_info_and_bind_to_dpdk(1)
+        self.start_vhost_testpmd(pci="", dmas=self.dmas_info)
+        self.launch_l3fwd(path="./vhost-net")
+        # double check the status of interrupt core
+        for i in range(2):
+            self.tester.scapy_append('pk=[Ether(dst="52:54:00:00:00:01")/IP()/("X"*64)]')
+            self.tester.scapy_append('sendp(pk, iface="%s", count=100)' % self.tx_interface)
+            self.tester.scapy_execute()
+            time.sleep(3)
+            self.check_interrupt_log(status="waked up")
+        self.dut.send_expect("killall %s" % self.l3fwdpower_name, "#")
+        self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "#")
+        self.close_all_session()
+
     def tear_down(self):
         """
         run after each test case.
         """
-        self.dut.send_expect("killall l3fwd-power", "#")
-        self.dut.send_expect("killall -s INT testpmd", "#")
+        self.dut.send_expect("killall %s" % self.l3fwdpower_name, "#")
+        self.dut.send_expect("killall -s INT %s" % self.testpmd_name, "#")
+        self.bind_cbdma_device_to_kernel()
         self.close_all_session()
 
     def tear_down_all(self):
-- 
2.7.4


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

* Re: [dts] [PATCH V1] tests/TestSuite_vhost_virtio_user_interrupt: add 2 cbdma scripts
  2020-09-22  7:18 [dts] [PATCH V1] tests/TestSuite_vhost_virtio_user_interrupt: add 2 cbdma scripts JiangYuX
@ 2020-09-22  7:21 ` Jiang, YuX
  2020-10-16  7:27   ` Wang, Yinan
  0 siblings, 1 reply; 3+ messages in thread
From: Jiang, YuX @ 2020-09-22  7:21 UTC (permalink / raw)
  To: dts; +Cc: Jiang, YuX

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

Tested-by: Jiang, YuX <yux.jiang@intel.com>

    Best Regards
    Jiang yu


> -----Original Message-----
> From: Jiang, YuX
> Sent: Tuesday, September 22, 2020 3:18 PM
> To: dts@dpdk.org
> Cc: Jiang, YuX <yux.jiang@intel.com>
> Subject: [dts] [PATCH V1] tests/TestSuite_vhost_virtio_user_interrupt: add 2
> cbdma scripts

[-- Attachment #2: TestVirtioUserInterrupt.log --]
[-- Type: application/octet-stream, Size: 34390 bytes --]

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

* Re: [dts] [PATCH V1] tests/TestSuite_vhost_virtio_user_interrupt: add 2 cbdma scripts
  2020-09-22  7:21 ` Jiang, YuX
@ 2020-10-16  7:27   ` Wang, Yinan
  0 siblings, 0 replies; 3+ messages in thread
From: Wang, Yinan @ 2020-10-16  7:27 UTC (permalink / raw)
  To: Jiang, YuX, dts; +Cc: Jiang, YuX

Acked-by: Wang, Yinan <yinan.wang@intel.com>

> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Jiang, YuX
> Sent: 2020?9?22? 15:22
> To: dts@dpdk.org
> Cc: Jiang, YuX <yux.jiang@intel.com>
> Subject: Re: [dts] [PATCH V1] tests/TestSuite_vhost_virtio_user_interrupt: add 2
> cbdma scripts
> 
> Tested-by: Jiang, YuX <yux.jiang@intel.com>


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

end of thread, other threads:[~2020-10-16  7:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22  7:18 [dts] [PATCH V1] tests/TestSuite_vhost_virtio_user_interrupt: add 2 cbdma scripts JiangYuX
2020-09-22  7:21 ` Jiang, YuX
2020-10-16  7:27   ` Wang, Yinan

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).