test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yuwei Zhang <yuwei1.zhang@intel.com>
To: dts@dpdk.org
Cc: Yuwei Zhang <yuwei1.zhang@intel.com>
Subject: [dts] [PATCH v2] add vfio-pci driver cases to vf_packet_rxtx test suite
Date: Mon,  9 Oct 2017 11:13:46 +0800	[thread overview]
Message-ID: <20171009031346.12908-1-yuwei1.zhang@intel.com> (raw)

add some cases that use vfio-pci assign method to pass-through VFs to vm in vf_packet_rxtx test suite.

Signed-off-by: Yuwei Zhang <yuwei1.zhang@intel.com>
---
 tests/TestSuite_vf_packet_rxtx.py | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/tests/TestSuite_vf_packet_rxtx.py b/tests/TestSuite_vf_packet_rxtx.py
index 50451f6..56d618c 100644
--- a/tests/TestSuite_vf_packet_rxtx.py
+++ b/tests/TestSuite_vf_packet_rxtx.py
@@ -12,6 +12,8 @@ VM_CORES_MASK = 'all'
 
 class TestVfPacketRxtx(TestCase):
 
+    supported_vf_driver = ['pci-stub', 'vfio-pci']
+
     def set_up_all(self):
 
         self.dut_ports = self.dut.get_ports(self.nic)
@@ -19,6 +21,18 @@ class TestVfPacketRxtx(TestCase):
         self.vm0 = None
         self.vm1 = None
 
+        # set vf assign method and vf driver
+        self.vf_driver = self.get_suite_cfg()['vf_driver']
+        if self.vf_driver is None:
+            self.vf_driver = 'pci-stub'
+        self.verify(self.vf_driver in self.supported_vf_driver, "Unspported vf driver")
+        if self.vf_driver == 'pci-stub':
+            self.vf_assign_method = 'pci-assign'
+        else:
+            self.vf_assign_method = 'vfio-pci'
+
+
+
     def set_up(self):
 
         self.setup_2pf_2vf_1vm_env_flag = 0
@@ -37,10 +51,10 @@ class TestVfPacketRxtx(TestCase):
         try:
 
             for port in self.sriov_vfs_port_0:
-                port.bind_driver('pci-stub')
+                port.bind_driver(self.vf_driver)
 
             for port in self.sriov_vfs_port_1:
-                port.bind_driver('pci-stub')
+                port.bind_driver(self.vf_driver)
 
             time.sleep(1)
             vf0_prop = {'opt_host': self.sriov_vfs_port_0[0].pci}
@@ -59,8 +73,8 @@ class TestVfPacketRxtx(TestCase):
 
             # set up VM0 ENV
             self.vm0 = QEMUKvm(self.dut, 'vm0', 'vf_packet_rxtx')
-            self.vm0.set_vm_device(driver='pci-assign', **vf0_prop)
-            self.vm0.set_vm_device(driver='pci-assign', **vf1_prop)
+            self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop)
+            self.vm0.set_vm_device(driver=self.vf_assign_method, **vf1_prop)
             self.vm_dut_0 = self.vm0.start()
             if self.vm_dut_0 is None:
                 raise Exception("Set up VM0 ENV failed!")
@@ -159,7 +173,7 @@ class TestVfPacketRxtx(TestCase):
 
             for port in self.sriov_vfs_port:
                 print port.pci
-                port.bind_driver('pci-stub')
+                port.bind_driver(self.vf_driver)
 
             time.sleep(1)
             vf0_prop = {'opt_host': self.sriov_vfs_port[0].pci}
@@ -181,14 +195,14 @@ class TestVfPacketRxtx(TestCase):
 
             # set up VM0 ENV
             self.vm0 = QEMUKvm(self.dut, 'vm0', 'vf_packet_rxtx')
-            self.vm0.set_vm_device(driver='pci-assign', **vf0_prop)
-            self.vm0.set_vm_device(driver='pci-assign', **vf1_prop)
+            self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop)
+            self.vm0.set_vm_device(driver=self.vf_assign_method, **vf1_prop)
             self.vm_dut_0 = self.vm0.start()
             if self.vm_dut_0 is None:
                 raise Exception("Set up VM0 ENV failed!")
             # set up VM1 ENV
             self.vm1 = QEMUKvm(self.dut, 'vm1', 'vf_packet_rxtx')
-            self.vm1.set_vm_device(driver='pci-assign', **vf2_prop)
+            self.vm1.set_vm_device(driver=self.vf_assign_method, **vf2_prop)
             self.vm_dut_1 = self.vm1.start()
             if self.vm_dut_1 is None:
                 raise Exception("Set up VM1 ENV failed!")
-- 
2.14.1.windows.1

             reply	other threads:[~2017-10-09  3:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09  3:13 Yuwei Zhang [this message]
2017-10-09 12:09 ` Liu, Yong

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=20171009031346.12908-1-yuwei1.zhang@intel.com \
    --to=yuwei1.zhang@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).