summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/04_vnf.conf9
-rwxr-xr-xdocs/userguide/testusage.rst32
-rw-r--r--vnfs/qemu/qemu.py46
3 files changed, 79 insertions, 8 deletions
diff --git a/conf/04_vnf.conf b/conf/04_vnf.conf
index e996ecce..d3b4be4d 100644
--- a/conf/04_vnf.conf
+++ b/conf/04_vnf.conf
@@ -101,6 +101,15 @@ GUEST_SHARED_DRIVE_TYPE = ['scsi']
# For 2 VNFs you may use ['testpmd', 'l2fwd']
GUEST_LOOPBACK = ['testpmd']
+# guest driver binding option; support options are:
+# 'igb_uio_from_src' - build igb_uio driver from downloaded source files
+# 'uio_pci_generic' - use uio_pci_generic driver
+# 'vfio_no_iommu' - use unsafe vfio driver without iommu (requires
+# image with supported kernel 4.5 or greater and
+# dpdk 16.04 or greater. VSPerf vloop image does not
+# support this mode.
+GUEST_DPDK_BIND_DRIVER = ['igb_uio_from_src']
+
# username for guest image
GUEST_USERNAME = ['root']
diff --git a/docs/userguide/testusage.rst b/docs/userguide/testusage.rst
index 9ee87788..97c74721 100755
--- a/docs/userguide/testusage.rst
+++ b/docs/userguide/testusage.rst
@@ -438,6 +438,38 @@ multiple VM NIC pairs.
**NOTE:** In case of linux_bridge, all guest NICs are connected to the same
bridge inside the guest.
+Selection of dpdk binding driver for tests with VMs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+To select dpdk binding driver, which will specify which driver the vm NICs will
+use for dpdk bind, the following configuration parameter should be configured:
+
+.. code-block:: console
+
+ GUEST_DPDK_BIND_DRIVER = ['igb_uio_from_src']
+
+The supported dpdk guest bind drivers are:
+
+.. code-block:: console
+
+ 'uio_pci_generic' - Use uio_pci_generic driver
+ 'igb_uio_from_src' - Build and use the igb_uio driver from the dpdk src
+ files
+ 'vfio_no_iommu' - Use vfio with no iommu option. This requires custom
+ guest images that support this option. The default
+ vloop image does not support this driver.
+
+Note: uio_pci_generic does not support sr-iov testcases with guests attached.
+This is because uio_pci_generic only supports legacy interrupts. In case
+uio_pci_generic is selected with the vnf as QemuPciPassthrough it will be
+modified to use igb_uio_from_src instead.
+
+Note: vfio_no_iommu requires kernels equal to or greater than 4.5 and dpdk
+16.04 or greater. Using this option will also taint the kernel.
+
+Please refer to the dpdk documents at http://dpdk.org/doc/guides for more
+information on these drivers.
+
Multi-Queue Configuration
^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py
index 67dbfab4..87126da8 100644
--- a/vnfs/qemu/qemu.py
+++ b/vnfs/qemu/qemu.py
@@ -351,7 +351,6 @@ class IVnfQemu(IVnf):
self.execute_and_wait("{} -t {} -F".format(iptables, table))
self.execute_and_wait("{} -t {} -X".format(iptables, table))
-
def _configure_testpmd(self):
"""
Configure VM to perform L2 forwarding between NICs by DPDK's testpmd
@@ -383,16 +382,11 @@ class IVnfQemu(IVnf):
for nic in self._nics:
self.execute_and_wait('ifdown ' + nic['device'])
- # build and insert igb_uio and rebind interfaces to it
- self.execute_and_wait('make RTE_OUTPUT=$RTE_SDK/$RTE_TARGET -C '
- '$RTE_SDK/lib/librte_eal/linuxapp/igb_uio')
- self.execute_and_wait('modprobe uio')
- self.execute_and_wait('insmod %s/kmod/igb_uio.ko' %
- S.getValue('RTE_TARGET'))
self.execute_and_wait('./tools/dpdk*bind.py --status')
pci_list = ' '.join([nic['pci'] for nic in self._nics])
self.execute_and_wait('./tools/dpdk*bind.py -u ' + pci_list)
- self.execute_and_wait('./tools/dpdk*bind.py -b igb_uio ' + pci_list)
+ self._bind_dpdk_driver(S.getValue(
+ 'GUEST_DPDK_BIND_DRIVER')[self._number], pci_list)
self.execute_and_wait('./tools/dpdk*bind.py --status')
# build and run 'test-pmd'
@@ -486,6 +480,42 @@ class IVnfQemu(IVnf):
for nic in self._nics:
self.execute('sysctl -w net.ipv4.conf.' + nic['device'] + '.rp_filter=0')
+ def _bind_dpdk_driver(self, driver, pci_slots):
+ """
+ Bind the virtual nics to the driver specific in the conf file
+ :return: None
+ """
+ if driver == 'uio_pci_generic':
+ if S.getValue('VNF') == 'QemuPciPassthrough':
+ # unsupported config, bind to igb_uio instead and exit the
+ # outer function after completion.
+ self._logger.error('SR-IOV does not support uio_pci_generic. '
+ 'Igb_uio will be used instead.')
+ self._bind_dpdk_driver('igb_uio_from_src', pci_slots)
+ return
+ self.execute_and_wait('modprobe uio_pci_generic')
+ self.execute_and_wait('./tools/dpdk*bind.py -b uio_pci_generic '+
+ pci_slots)
+ elif driver == 'vfio_no_iommu':
+ self.execute_and_wait('modprobe -r vfio')
+ self.execute_and_wait('modprobe -r vfio_iommu_type1')
+ self.execute_and_wait('modprobe vfio enable_unsafe_noiommu_mode=Y')
+ self.execute_and_wait('modprobe vfio-pci')
+ self.execute_and_wait('./tools/dpdk*bind.py -b vfio-pci ' +
+ pci_slots)
+ elif driver == 'igb_uio_from_src':
+ # build and insert igb_uio and rebind interfaces to it
+ self.execute_and_wait('make RTE_OUTPUT=$RTE_SDK/$RTE_TARGET -C '
+ '$RTE_SDK/lib/librte_eal/linuxapp/igb_uio')
+ self.execute_and_wait('modprobe uio')
+ self.execute_and_wait('insmod %s/kmod/igb_uio.ko' %
+ S.getValue('RTE_TARGET'))
+ self.execute_and_wait('./tools/dpdk*bind.py -b igb_uio ' + pci_slots)
+ else:
+ self._logger.error(
+ 'Unknown driver for binding specified, defaulting to igb_uio')
+ self._bind_dpdk_driver('igb_uio_from_src', pci_slots)
+
def _set_multi_queue_nic(self):
"""
Enable multi-queue in guest kernel with ethool.