[dts] [PATCH V1] add vfio-pci assign method to vf_packet_rxtx test suite

Yuwei Zhang yuwei1.zhang at intel.com
Thu Sep 21 16:50:36 CEST 2017


Signed-off-by: Yuwei Zhang <yuwei1.zhang at intel.com>
---
 conf/vf_packet_rxtx.cfg           |  5 +++++
 tests/TestSuite_vf_packet_rxtx.py | 21 +++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/conf/vf_packet_rxtx.cfg b/conf/vf_packet_rxtx.cfg
index 20db90c..6eb9c40 100644
--- a/conf/vf_packet_rxtx.cfg
+++ b/conf/vf_packet_rxtx.cfg
@@ -122,3 +122,8 @@ vnc =
     displayNum=2;
 daemon =
     enable=yes;
+
+# suite conf
+# vf_assign_method only support vfio-pci and pci-assign method for now
+[suite]
+vf_assign_method=
\ No newline at end of file
diff --git a/tests/TestSuite_vf_packet_rxtx.py b/tests/TestSuite_vf_packet_rxtx.py
index 50451f6..d88506d 100644
--- a/tests/TestSuite_vf_packet_rxtx.py
+++ b/tests/TestSuite_vf_packet_rxtx.py
@@ -19,6 +19,19 @@ class TestVfPacketRxtx(TestCase):
         self.vm0 = None
         self.vm1 = None
 
+        suite_conf = SuiteConf('vf_packet_rxtx')
+        self.vf_assign_method = suite_conf.load_case_config()['vf_assign_method']
+        if self.vf_assign_method.strip() == '':
+            self.vf_assign_method = 'pci-assign'
+        self.verify(self.vf_assign_method in ['pci-assign', 'vfio-pci'],
+                    "not supported vf assign method")
+        if self.vf_assign_method == 'vfio-pci':
+            self.dut.send_expect('modprobe vfio', '#')
+            self.dut.send_expect('modprobe vfio-pci', '#')
+            self.vf_driver = 'vfio-pci'
+        else:
+            self.vf_driver = 'pci-stub'
+
     def set_up(self):
 
         self.setup_2pf_2vf_1vm_env_flag = 0
@@ -37,10 +50,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 +72,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!")
-- 
2.14.1.windows.1



More information about the dts mailing list