From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id DED34FFA for ; Thu, 28 Sep 2017 04:54:10 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP; 27 Sep 2017 19:54:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,448,1500966000"; d="scan'208";a="133052387" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga004.jf.intel.com with ESMTP; 27 Sep 2017 19:54:07 -0700 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 27 Sep 2017 19:54:06 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 27 Sep 2017 19:54:06 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Thu, 28 Sep 2017 10:54:04 +0800 From: "Liu, Yong" To: "Zhang, Yuwei1" , "dts@dpdk.org" CC: "Zhang, Yuwei1" Thread-Topic: [dts] [PATCH V1] add vfio-pci driver cases to vf_packet_rxtx test suite Thread-Index: AQHTNtuciS2bVRaXVUyXCRuwLSLGBKLJm1YA Date: Thu, 28 Sep 2017 02:54:03 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62EE3B21@SHSMSX103.ccr.corp.intel.com> References: <20170926152401.20824-1-yuwei1.zhang@intel.com> In-Reply-To: <20170926152401.20824-1-yuwei1.zhang@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1] add vfio-pci driver cases to vf_packet_rxtx test suite X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2017 02:54:11 -0000 Yuwei,=20 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 > Subject: [dts] [PATCH V1] add vfio-pci driver cases to vf_packet_rxtx tes= t > suite >=20 > Signed-off-by: Yuwei Zhang > --- > 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 >=20 > 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=3Dpci-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 =3D "%s/crbs.cfg" % CONFIG_ROOT_PATH > VIRTCONF =3D "%s/virt_global.cfg" % CONFIG_ROOT_PATH > IXIACONF =3D "%s/ixia.cfg" % CONFIG_ROOT_PATH > SUITECONF_SAMPLE =3D "%s/suite_sample.cfg" % CONFIG_ROOT_PATH > +GLOBAL_SUITE_CONF =3D "%s/global_suite_conf.cfg" % CONFIG_ROOT_PATH >=20 >=20 > class UserConf(): > @@ -87,6 +88,33 @@ class UserConf(): > paramDict[key] =3D value > return paramDict >=20 > +class GlobalSuiteConf(UserConf): > + > + def __init__(self): > + try: > + self.global_suite_conf =3D UserConf(GLOBAL_SUITE_CONF) > + except ConfigParseException: > + self.global_suite_conf =3D None > + > + def load_config(self, section_name, param_name): > + if self.global_suite_conf is None: > + return self.global_suite_cfg > + > + try: > + section_conf =3D > 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 =3D dict(section_conf) > + if param_name in conf.keys(): > + return conf[param_name] > + else: > + return None > + >=20 > class SuiteConf(UserConf): > def __init__(self, suite_name=3D""): > 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 >=20 > VM_CORES_MASK =3D 'all' >=20 > @@ -18,6 +19,18 @@ class TestVfPacketRxtx(TestCase): > self.verify(len(self.dut_ports) > 1, "Insufficient ports") > self.vm0 =3D None > self.vm1 =3D None > + supported_vf_driver =3D ['vfio-pci', 'pci-stub'] > + > + global_suite_conf =3D GlobalSuiteConf() > + self.vf_driver =3D global_suite_conf.load_config('vf', 'driver') Do not need to load global configuration in each suite, you can combine thi= s action into SuiteConf class. > + if self.vf_driver =3D=3D None: > + self.vf_driver =3D 'pci-stub' > + self.verify(self.vf_driver in supported_vf_driver, 'Unsupported > VF Driver!') > + if self.vf_driver =3D=3D 'vfio-pci': > + self.vf_assign_method =3D 'vfio-pci' > + self.dut.send_expect('modprobe vfio-pci', '#') > + else: > + self.vf_assign_method =3D 'pci-assign' >=20 > def set_up(self): >=20 > @@ -37,10 +50,10 @@ class TestVfPacketRxtx(TestCase): > try: >=20 > for port in self.sriov_vfs_port_0: > - port.bind_driver('pci-stub') > + port.bind_driver(self.vf_driver) >=20 > for port in self.sriov_vfs_port_1: > - port.bind_driver('pci-stub') > + port.bind_driver(self.vf_driver) >=20 > time.sleep(1) > vf0_prop =3D {'opt_host': self.sriov_vfs_port_0[0].pci} > @@ -59,8 +72,8 @@ class TestVfPacketRxtx(TestCase): >=20 > # set up VM0 ENV > self.vm0 =3D QEMUKvm(self.dut, 'vm0', 'vf_packet_rxtx') > - self.vm0.set_vm_device(driver=3D'pci-assign', **vf0_prop) > - self.vm0.set_vm_device(driver=3D'pci-assign', **vf1_prop) > + self.vm0.set_vm_device(driver=3Dself.vf_assign_method, > **vf0_prop) > + self.vm0.set_vm_device(driver=3Dself.vf_assign_method, > **vf1_prop) > self.vm_dut_0 =3D self.vm0.start() > if self.vm_dut_0 is None: > raise Exception("Set up VM0 ENV failed!") > @@ -144,6 +157,7 @@ class TestVfPacketRxtx(TestCase): >=20 > self.packet_rx_tx(driver=3D'') >=20 > + """ > ######2. test case for dpdk pf and dpdk vf 2pf_2vf_1vm scenario packet r= x > tx. > def test_dpdk_2pf_2vf_1vm(self): >=20 > @@ -159,7 +173,7 @@ class TestVfPacketRxtx(TestCase): >=20 > for port in self.sriov_vfs_port: > print port.pci > - port.bind_driver('pci-stub') > + port.bind_driver(self.vf_driver) >=20 > time.sleep(1) > vf0_prop =3D {'opt_host': self.sriov_vfs_port[0].pci} > @@ -181,14 +195,14 @@ class TestVfPacketRxtx(TestCase): >=20 > # set up VM0 ENV > self.vm0 =3D QEMUKvm(self.dut, 'vm0', 'vf_packet_rxtx') > - self.vm0.set_vm_device(driver=3D'pci-assign', **vf0_prop) > - self.vm0.set_vm_device(driver=3D'pci-assign', **vf1_prop) > + self.vm0.set_vm_device(driver=3Dself.vf_assign_method, > **vf0_prop) > + self.vm0.set_vm_device(driver=3Dself.vf_assign_method, > **vf1_prop) > self.vm_dut_0 =3D self.vm0.start() > if self.vm_dut_0 is None: > raise Exception("Set up VM0 ENV failed!") > # set up VM1 ENV > self.vm1 =3D QEMUKvm(self.dut, 'vm1', 'vf_packet_rxtx') > - self.vm1.set_vm_device(driver=3D'pci-assign', **vf2_prop) > + self.vm1.set_vm_device(driver=3Dself.vf_assign_method, > **vf2_prop) > self.vm_dut_1 =3D 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 =3D=3D 0, "vm0_VF0 tx-errors") >=20 > self.verify(vf0_rx_cnt =3D=3D vf1_tx_cnt, "vm0_VF0 failed to for= ward > packets to vm0_VF1 when reset vm1_VF0 frequently") > + """ >=20 > def tear_down(self): >=20 > -- > 2.14.1.windows.1