From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 4EB3A49CF for ; Thu, 31 May 2018 11:44:58 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4FD571596; Thu, 31 May 2018 02:44:57 -0700 (PDT) Received: from phil-VirtualBox.shanghai.arm.com (unknown [10.169.109.152]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A24143F24A; Thu, 31 May 2018 02:44:56 -0700 (PDT) From: Phil Yang To: dts@dpdk.org Cc: nd@arm.com Date: Thu, 31 May 2018 17:44:23 +0800 Message-Id: <1527759863-14690-1-git-send-email-phil.yang@arm.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH] tests/vf_daemon: support configured pass-through method 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, 31 May 2018 09:44:58 -0000 Load VF pass-through method from global configuration, the default method will be pci-stub pass-through. Change-Id: Idefadec9093b812154e0e92bb728bb78bd14e7a0 --- tests/TestSuite_vf_daemon.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/TestSuite_vf_daemon.py b/tests/TestSuite_vf_daemon.py index 56fc4be..6b7bdeb 100644 --- a/tests/TestSuite_vf_daemon.py +++ b/tests/TestSuite_vf_daemon.py @@ -18,6 +18,8 @@ MAX_VLAN = 4095 class Testvf_daemon(TestCase): + supported_vf_driver = ['pci-stub', 'vfio-pci'] + def set_up_all(self): self.dut_ports = self.dut.get_ports(self.nic) @@ -26,6 +28,17 @@ class Testvf_daemon(TestCase): self.vm1 = None self.env_done = False + # 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' + self.dut.send_expect('modprobe vfio', '#') + self.dut.send_expect('modprobe vfio-pci', '#') def set_up(self): self.setup_vm_env() @@ -78,12 +91,14 @@ class Testvf_daemon(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 = '-b %(vf0)s -b %(vf1)s' % {'vf0': self.sriov_vfs_port[0].pci, + 'vf1': self.sriov_vfs_port[1].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) self.dut_testpmd.execute_cmd("start") time.sleep(5) @@ -91,7 +106,7 @@ class Testvf_daemon(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 +120,7 @@ class Testvf_daemon(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.7.4