From: michael.luo@intel.com
To: dts@dpdk.org
Subject: [dts] [PATCH] tests/vf_kernel: choose the VF passthrough method by the config
Date: Mon, 18 Mar 2019 09:18:01 +0800 [thread overview]
Message-ID: <1552871881-49534-1-git-send-email-michael.luo@intel.com> (raw)
From: Luo Gaoliang <michael.luo@intel.com>
Choosing the VF passthrough method to create VMs by the config instead of
hardcoding it as pci-assign.
Signed-off-by: Luo Gaoliang <michael.luo@intel.com>
---
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
next reply other threads:[~2019-03-18 1:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-18 1:18 michael.luo [this message]
2019-03-18 5:26 ` Xu, Qian Q
2019-03-24 18:34 ` Tu, Lijuan
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=1552871881-49534-1-git-send-email-michael.luo@intel.com \
--to=michael.luo@intel.com \
--cc=dts@dpdk.org \
/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).