From: "Liu, Yong" <yong.liu@intel.com>
To: "Zhang, Yuwei1" <yuwei1.zhang@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "Zhang, Yuwei1" <yuwei1.zhang@intel.com>
Subject: Re: [dts] [PATCH V1] add vfio-pci driver cases to vf_packet_rxtx test suite
Date: Thu, 28 Sep 2017 02:54:03 +0000 [thread overview]
Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62EE3B21@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20170926152401.20824-1-yuwei1.zhang@intel.com>
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
next prev parent reply other threads:[~2017-09-28 2:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-26 15:24 Yuwei Zhang
2017-09-28 2:54 ` Liu, Yong [this message]
2017-10-06 1:16 [dts] [PATCH v1] " Yuwei Zhang
2017-10-09 11:45 ` 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=86228AFD5BCD8E4EBFD2B90117B5E81E62EE3B21@SHSMSX103.ccr.corp.intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
--cc=yuwei1.zhang@intel.com \
/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).