From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 4CDF3A00E6 for ; Mon, 18 Mar 2019 02:21:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0825C2B86; Mon, 18 Mar 2019 02:21:29 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 67301239 for ; Mon, 18 Mar 2019 02:21:27 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Mar 2019 18:21:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,491,1544515200"; d="scan'208";a="152568720" Received: from nfvihost.sh.intel.com ([10.239.182.89]) by fmsmga002.fm.intel.com with ESMTP; 17 Mar 2019 18:21:25 -0700 From: michael.luo@intel.com To: dts@dpdk.org Date: Mon, 18 Mar 2019 09:18:01 +0800 Message-Id: <1552871881-49534-1-git-send-email-michael.luo@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH] tests/vf_kernel: choose the VF passthrough method by the config 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" From: Luo Gaoliang Choosing the VF passthrough method to create VMs by the config instead of hardcoding it as pci-assign. Signed-off-by: Luo Gaoliang --- tests/TestSuite_vf_kernel.py | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/tests/TestSuite_vf_kernel.py b/tests/TestSuite_vf_kernel.py index cb3dd51..f80c9e9 100644 --- a/tests/TestSuite_vf_kernel.py +++ b/tests/TestSuite_vf_kernel.py @@ -51,6 +51,8 @@ from utils import GREEN, RED class TestVfKernel(TestCase): + supported_vf_driver = ['pci-stub', 'vfio-pci'] + def set_up_all(self): """ Run at the start of each test suite. @@ -69,6 +71,16 @@ class TestVfKernel(TestCase): self.intf = self.dut.ports_info[self.dut_ports[0]]['intf'] self.pci = self.dut.ports_info[self.dut_ports[0]]['pci'].split(':') + 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' + self.dut.send_expect('modprobe vfio-pci', '#') + self.src_logo = '12:34:56:78:90:10' self.setup_vm_env() @@ -103,12 +115,16 @@ class TestVfKernel(TestCase): self.sriov_vfs_port = self.dut.ports_info[ self.used_dut_port]['vfs_port'] for port in self.sriov_vfs_port: - port.bind_driver('pci-stub') + port.bind_driver(self.vf_driver) time.sleep(1) self.dut_testpmd = PmdOutput(self.dut) + eal_param = '' + for sriov_vf in self.sriov_vfs_port: + eal_param += " -b %s" % sriov_vf.pci self.dut_testpmd.start_testpmd( - "Default", "--rxq=4 --txq=4 --port-topology=chained") + "Default", "--rxq=4 --txq=4 --port-topology=chained", + eal_param=eal_param) # dpdk-2208 # since there is no forward engine on DPDK PF to forward or drop packet in packet pool, # so finally the pool will be full, then no more packet will be @@ -122,10 +138,10 @@ class TestVfKernel(TestCase): vf0_prop_4 = {'opt_host': self.sriov_vfs_port[3].pci} self.vm0 = QEMUKvm(self.dut, 'vm0', 'vf_kernel') - self.vm0.set_vm_device(driver='pci-assign', **vf0_prop_1) - self.vm0.set_vm_device(driver='pci-assign', **vf0_prop_2) - self.vm0.set_vm_device(driver='pci-assign', **vf0_prop_3) - self.vm0.set_vm_device(driver='pci-assign', **vf0_prop_4) + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop_1) + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop_2) + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop_3) + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop_4) try: self.vm0_dut = self.vm0.start() if self.vm0_dut is None: @@ -140,8 +156,8 @@ class TestVfKernel(TestCase): vf1_prop_5 = {'opt_host': self.sriov_vfs_port[4].pci} vf1_prop_6 = {'opt_host': self.sriov_vfs_port[5].pci} self.vm1 = QEMUKvm(self.dut, 'vm1', 'vf_kernel') - self.vm1.set_vm_device(driver='pci-assign', **vf1_prop_5) - self.vm1.set_vm_device(driver='pci-assign', **vf1_prop_6) + self.vm1.set_vm_device(driver=self.vf_assign_method, **vf1_prop_5) + self.vm1.set_vm_device(driver=self.vf_assign_method, **vf1_prop_6) try: self.vm1_dut = self.vm1.start() @@ -740,8 +756,8 @@ class TestVfKernel(TestCase): vf1_prop_5 = {'opt_host': self.sriov_vfs_port[4].pci} vf1_prop_6 = {'opt_host': self.sriov_vfs_port[5].pci} self.vm1 = QEMUKvm(self.dut, 'vm1', 'vf_kernel') - self.vm1.set_vm_device(driver='pci-assign', **vf1_prop_5) - self.vm1.set_vm_device(driver='pci-assign', **vf1_prop_6) + self.vm1.set_vm_device(driver=self.vf_assign_method, **vf1_prop_5) + self.vm1.set_vm_device(driver=self.vf_assign_method, **vf1_prop_6) try: self.vm1_dut = self.vm1.start() -- 2.7.4