test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] add vfio-pci driver cases to vf_packet_rxtx test suite
@ 2017-09-26 15:24 Yuwei Zhang
  2017-09-28  2:54 ` Liu, Yong
  0 siblings, 1 reply; 4+ messages in thread
From: Yuwei Zhang @ 2017-09-26 15:24 UTC (permalink / raw)
  To: dts; +Cc: Yuwei Zhang

Signed-off-by: Yuwei Zhang <yuwei1.zhang@intel.com>
---
 conf/global_suite_conf.cfg        |  3 +++
 framework/config.py               | 28 ++++++++++++++++++++++++++++
 tests/TestSuite_vf_packet_rxtx.py | 31 +++++++++++++++++++++++--------
 3 files changed, 54 insertions(+), 8 deletions(-)
 create mode 100644 conf/global_suite_conf.cfg

diff --git a/conf/global_suite_conf.cfg b/conf/global_suite_conf.cfg
new file mode 100644
index 0000000..2d15c03
--- /dev/null
+++ b/conf/global_suite_conf.cfg
@@ -0,0 +1,3 @@
+# global suite configuration
+[vf]
+driver=pci-stub
\ No newline at end of file
diff --git a/framework/config.py b/framework/config.py
index 9e514a7..411c653 100644
--- a/framework/config.py
+++ b/framework/config.py
@@ -45,6 +45,7 @@ CRBCONF = "%s/crbs.cfg" % CONFIG_ROOT_PATH
 VIRTCONF = "%s/virt_global.cfg" % CONFIG_ROOT_PATH
 IXIACONF = "%s/ixia.cfg" % CONFIG_ROOT_PATH
 SUITECONF_SAMPLE = "%s/suite_sample.cfg" % CONFIG_ROOT_PATH
+GLOBAL_SUITE_CONF = "%s/global_suite_conf.cfg" % CONFIG_ROOT_PATH
 
 
 class UserConf():
@@ -87,6 +88,33 @@ class UserConf():
             paramDict[key] = value
         return paramDict
 
+class GlobalSuiteConf(UserConf):
+
+    def __init__(self):
+        try:
+            self.global_suite_conf = UserConf(GLOBAL_SUITE_CONF)
+        except ConfigParseException:
+            self.global_suite_conf = None
+
+    def load_config(self, section_name, param_name):
+        if self.global_suite_conf is None:
+            return self.global_suite_cfg
+
+        try:
+            section_conf = self.global_suite_conf.load_section(section_name)
+        except:
+            print "FAILED FIND SECTION[%s] CONFIG!!!" % section_name
+            return section_conf 
+        
+        if section_conf is None:
+            return section_conf
+        
+        conf = dict(section_conf)
+        if param_name in conf.keys():
+            return conf[param_name]
+        else:
+            return None
+
 
 class SuiteConf(UserConf):
     def __init__(self, suite_name=""):
diff --git a/tests/TestSuite_vf_packet_rxtx.py b/tests/TestSuite_vf_packet_rxtx.py
index 50451f6..5ff1a2b 100644
--- a/tests/TestSuite_vf_packet_rxtx.py
+++ b/tests/TestSuite_vf_packet_rxtx.py
@@ -6,6 +6,7 @@ import time
 from qemu_kvm import QEMUKvm
 from test_case import TestCase
 from pmd_output import PmdOutput
+from config import GlobalSuiteConf
 
 VM_CORES_MASK = 'all'
 
@@ -18,6 +19,18 @@ class TestVfPacketRxtx(TestCase):
         self.verify(len(self.dut_ports) > 1, "Insufficient ports")
         self.vm0 = None
         self.vm1 = None
+        supported_vf_driver = ['vfio-pci', 'pci-stub']
+
+        global_suite_conf = GlobalSuiteConf()
+        self.vf_driver = global_suite_conf.load_config('vf', 'driver')
+        if self.vf_driver == None:
+            self.vf_driver = 'pci-stub'
+        self.verify(self.vf_driver in supported_vf_driver, 'Unsupported VF Driver!')
+        if self.vf_driver == 'vfio-pci':
+            self.vf_assign_method = 'vfio-pci'
+            self.dut.send_expect('modprobe vfio-pci', '#')
+        else:
+            self.vf_assign_method = 'pci-assign'
 
     def set_up(self):
 
@@ -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!")
@@ -144,6 +157,7 @@ class TestVfPacketRxtx(TestCase):
 
         self.packet_rx_tx(driver='')
 
+    """
 ######2. test case for dpdk pf and dpdk vf 2pf_2vf_1vm scenario packet rx tx.
     def test_dpdk_2pf_2vf_1vm(self):
 
@@ -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!")
@@ -291,6 +305,7 @@ class TestVfPacketRxtx(TestCase):
         self.verify(vf1_tx_err == 0, "vm0_VF0 tx-errors")
 
         self.verify(vf0_rx_cnt == vf1_tx_cnt, "vm0_VF0 failed to forward packets to vm0_VF1 when reset vm1_VF0 frequently")
+    """
 
     def tear_down(self):
 
-- 
2.14.1.windows.1

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

* Re: [dts] [PATCH V1] add vfio-pci driver cases to vf_packet_rxtx test suite
  2017-09-26 15:24 [dts] [PATCH V1] add vfio-pci driver cases to vf_packet_rxtx test suite Yuwei Zhang
@ 2017-09-28  2:54 ` Liu, Yong
  0 siblings, 0 replies; 4+ messages in thread
From: Liu, Yong @ 2017-09-28  2:54 UTC (permalink / raw)
  To: Zhang, Yuwei1, dts; +Cc: Zhang, Yuwei1

Yuwei, 
One comment below.

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yuwei Zhang
> Sent: Tuesday, September 26, 2017 11:24 PM
> To: dts@dpdk.org
> Cc: Zhang, Yuwei1 <yuwei1.zhang@intel.com>
> Subject: [dts] [PATCH V1] add vfio-pci driver cases to vf_packet_rxtx test
> suite
> 
> Signed-off-by: Yuwei Zhang <yuwei1.zhang@intel.com>
> ---
>  conf/global_suite_conf.cfg        |  3 +++
>  framework/config.py               | 28 ++++++++++++++++++++++++++++
>  tests/TestSuite_vf_packet_rxtx.py | 31 +++++++++++++++++++++++--------
>  3 files changed, 54 insertions(+), 8 deletions(-)
>  create mode 100644 conf/global_suite_conf.cfg
> 
> diff --git a/conf/global_suite_conf.cfg b/conf/global_suite_conf.cfg
> new file mode 100644
> index 0000000..2d15c03
> --- /dev/null
> +++ b/conf/global_suite_conf.cfg
> @@ -0,0 +1,3 @@
> +# global suite configuration
> +[vf]
> +driver=pci-stub
> \ No newline at end of file
> diff --git a/framework/config.py b/framework/config.py
> index 9e514a7..411c653 100644
> --- a/framework/config.py
> +++ b/framework/config.py
> @@ -45,6 +45,7 @@ CRBCONF = "%s/crbs.cfg" % CONFIG_ROOT_PATH
>  VIRTCONF = "%s/virt_global.cfg" % CONFIG_ROOT_PATH
>  IXIACONF = "%s/ixia.cfg" % CONFIG_ROOT_PATH
>  SUITECONF_SAMPLE = "%s/suite_sample.cfg" % CONFIG_ROOT_PATH
> +GLOBAL_SUITE_CONF = "%s/global_suite_conf.cfg" % CONFIG_ROOT_PATH
> 
> 
>  class UserConf():
> @@ -87,6 +88,33 @@ class UserConf():
>              paramDict[key] = value
>          return paramDict
> 
> +class GlobalSuiteConf(UserConf):
> +
> +    def __init__(self):
> +        try:
> +            self.global_suite_conf = UserConf(GLOBAL_SUITE_CONF)
> +        except ConfigParseException:
> +            self.global_suite_conf = None
> +
> +    def load_config(self, section_name, param_name):
> +        if self.global_suite_conf is None:
> +            return self.global_suite_cfg
> +
> +        try:
> +            section_conf =
> self.global_suite_conf.load_section(section_name)
> +        except:
> +            print "FAILED FIND SECTION[%s] CONFIG!!!" % section_name
> +            return section_conf
> +
> +        if section_conf is None:
> +            return section_conf
> +
> +        conf = dict(section_conf)
> +        if param_name in conf.keys():
> +            return conf[param_name]
> +        else:
> +            return None
> +
> 
>  class SuiteConf(UserConf):
>      def __init__(self, suite_name=""):
> diff --git a/tests/TestSuite_vf_packet_rxtx.py
> b/tests/TestSuite_vf_packet_rxtx.py
> index 50451f6..5ff1a2b 100644
> --- a/tests/TestSuite_vf_packet_rxtx.py
> +++ b/tests/TestSuite_vf_packet_rxtx.py
> @@ -6,6 +6,7 @@ import time
>  from qemu_kvm import QEMUKvm
>  from test_case import TestCase
>  from pmd_output import PmdOutput
> +from config import GlobalSuiteConf
> 
>  VM_CORES_MASK = 'all'
> 
> @@ -18,6 +19,18 @@ class TestVfPacketRxtx(TestCase):
>          self.verify(len(self.dut_ports) > 1, "Insufficient ports")
>          self.vm0 = None
>          self.vm1 = None
> +        supported_vf_driver = ['vfio-pci', 'pci-stub']
> +
> +        global_suite_conf = GlobalSuiteConf()
> +        self.vf_driver = global_suite_conf.load_config('vf', 'driver')

Do not need to load global configuration in each suite, you can combine this action into SuiteConf class.

> +        if self.vf_driver == None:
> +            self.vf_driver = 'pci-stub'
> +        self.verify(self.vf_driver in supported_vf_driver, 'Unsupported
> VF Driver!')
> +        if self.vf_driver == 'vfio-pci':
> +            self.vf_assign_method = 'vfio-pci'
> +            self.dut.send_expect('modprobe vfio-pci', '#')
> +        else:
> +            self.vf_assign_method = 'pci-assign'
> 
>      def set_up(self):
> 
> @@ -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!")
> @@ -144,6 +157,7 @@ class TestVfPacketRxtx(TestCase):
> 
>          self.packet_rx_tx(driver='')
> 
> +    """
>  ######2. test case for dpdk pf and dpdk vf 2pf_2vf_1vm scenario packet rx
> tx.
>      def test_dpdk_2pf_2vf_1vm(self):
> 
> @@ -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!")
> @@ -291,6 +305,7 @@ class TestVfPacketRxtx(TestCase):
>          self.verify(vf1_tx_err == 0, "vm0_VF0 tx-errors")
> 
>          self.verify(vf0_rx_cnt == vf1_tx_cnt, "vm0_VF0 failed to forward
> packets to vm0_VF1 when reset vm1_VF0 frequently")
> +    """
> 
>      def tear_down(self):
> 
> --
> 2.14.1.windows.1

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

* Re: [dts] [PATCH v1] add vfio-pci driver cases to vf_packet_rxtx test suite
  2017-10-06  1:16 [dts] [PATCH v1] " Yuwei Zhang
@ 2017-10-09 11:45 ` Liu, Yong
  0 siblings, 0 replies; 4+ messages in thread
From: Liu, Yong @ 2017-10-09 11:45 UTC (permalink / raw)
  To: Yuwei Zhang, dts

Yuwei, please add more information in the commit log.

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

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

* [dts] [PATCH v1] add vfio-pci driver cases to vf_packet_rxtx test suite
@ 2017-10-06  1:16 Yuwei Zhang
  2017-10-09 11:45 ` Liu, Yong
  0 siblings, 1 reply; 4+ messages in thread
From: Yuwei Zhang @ 2017-10-06  1:16 UTC (permalink / raw)
  To: dts; +Cc: Yuwei Zhang

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

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

end of thread, other threads:[~2017-10-09  3:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-26 15:24 [dts] [PATCH V1] add vfio-pci driver cases to vf_packet_rxtx test suite Yuwei Zhang
2017-09-28  2:54 ` Liu, Yong
2017-10-06  1:16 [dts] [PATCH v1] " Yuwei Zhang
2017-10-09 11:45 ` Liu, Yong

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