From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1AAB6A00E6 for ; Thu, 11 Jul 2019 08:32:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CCD7D322C; Thu, 11 Jul 2019 08:32:41 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id E671C31FC for ; Thu, 11 Jul 2019 08:32:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2019 23:32:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,476,1557212400"; d="scan'208";a="193301624" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.240.176.135]) by fmsmga002.fm.intel.com with ESMTP; 10 Jul 2019 23:32:38 -0700 From: "zhang,yan" To: dts@dpdk.org Cc: "zhang,yan" Date: Thu, 11 Jul 2019 14:37:18 +0800 Message-Id: <1562827038-50166-1-git-send-email-yanx.a.zhang@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dts] [PATCH V1] tests/TestSuite_vf_daemon:Improve the way drivers bind 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" Improved the original single binding driver. Signed-off-by: zhang,yan --- tests/TestSuite_vf_daemon.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/TestSuite_vf_daemon.py b/tests/TestSuite_vf_daemon.py index cc55f65..fcbf5b8 100644 --- a/tests/TestSuite_vf_daemon.py +++ b/tests/TestSuite_vf_daemon.py @@ -17,6 +17,7 @@ MAX_VLAN = 4095 class TestVfDaemon(TestCase): + supported_vf_driver = ['pci-stub', 'vfio-pci'] def set_up_all(self): @@ -26,6 +27,15 @@ class TestVfDaemon(TestCase): self.vm1 = None self.env_done = False + 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', '#') def set_up(self): self.setup_vm_env() @@ -61,7 +71,7 @@ class TestVfDaemon(TestCase): netdev.bind_driver(driver=driver) - def setup_vm_env(self, driver='igb_uio'): + def setup_vm_env(self, driver='default'): """ Create testing environment with 2VFs generated from 1PF """ @@ -78,12 +88,14 @@ class TestVfDaemon(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) + eal_param = '-b %(vf0)s -b %(vf1)s' % {'vf0': self.sriov_vfs_port[0].pci, + 'vf1': self.sriov_vfs_port[1].pci} self.dut_testpmd = PmdOutput(self.dut) 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) self.dut_testpmd.execute_cmd("start") time.sleep(5) @@ -91,7 +103,7 @@ class TestVfDaemon(TestCase): # set up VM0 ENV self.vm0 = QEMUKvm(self.dut, 'vm0', 'vf_daemon') - self.vm0.set_vm_device(driver='pci-assign', **vf0_prop) + self.vm0.set_vm_device(driver=self.vf_assign_method, **vf0_prop) try: self.vm0_dut = self.vm0.start() if self.vm0_dut is None: @@ -105,7 +117,7 @@ class TestVfDaemon(TestCase): vf1_prop = {'opt_host': self.sriov_vfs_port[1].pci} self.vm1 = QEMUKvm(self.dut, 'vm1', 'vf_daemon') - self.vm1.set_vm_device(driver='pci-assign', **vf1_prop) + self.vm1.set_vm_device(driver=self.vf_assign_method, **vf1_prop) try: self.vm1_dut = self.vm1.start() if self.vm1_dut is None: -- 2.17.2