X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=vnfs%2Fqemu%2Fqemu_pci_passthrough.py;h=f32f33d3845d754606791559eea8eeec513ea468;hb=7bae8ffe122b7d62eae03a2393182342f1f8fe85;hp=14810f0afcd072e22282c233d286d052d2463a50;hpb=7ad56eff11393807085775f075fcc93640c26ce2;p=vswitchperf.git diff --git a/vnfs/qemu/qemu_pci_passthrough.py b/vnfs/qemu/qemu_pci_passthrough.py index 14810f0a..f32f33d3 100644 --- a/vnfs/qemu/qemu_pci_passthrough.py +++ b/vnfs/qemu/qemu_pci_passthrough.py @@ -19,7 +19,6 @@ import logging import subprocess import os -import glob from conf import settings as S from vnfs.qemu.qemu import IVnfQemu @@ -27,7 +26,6 @@ from tools import tasks from tools.module_manager import ModuleManager _MODULE_MANAGER = ModuleManager() -_RTE_PCI_TOOL = glob.glob(os.path.join(S.getValue('RTE_SDK'), 'tools', 'dpdk*bind.py'))[0] class QemuPciPassthrough(IVnfQemu): """ @@ -39,15 +37,15 @@ class QemuPciPassthrough(IVnfQemu): """ super(QemuPciPassthrough, self).__init__() self._logger = logging.getLogger(__name__) - self._nics = S.getValue('NICS') + self._host_nics = S.getValue('NICS') # in case of SRIOV and PCI passthrough we must ensure, that MAC addresses are swapped if S.getValue('SRIOV_ENABLED') and not self._testpmd_fwd_mode.startswith('mac'): self._logger.info("SRIOV detected, forwarding mode of testpmd was changed from '%s' to '%s'", - self._testpmd_fwd_mode, 'mac_retry') - self._testpmd_fwd_mode = 'mac_retry' + self._testpmd_fwd_mode, 'mac') + self._testpmd_fwd_mode = 'mac' - for nic in self._nics: + for nic in self._host_nics: self._cmd += ['-device', 'vfio-pci,host=' + nic['pci']] def start(self): @@ -59,12 +57,12 @@ class QemuPciPassthrough(IVnfQemu): # bind every interface to vfio-pci driver try: - nics_list = list(tmp_nic['pci'] for tmp_nic in self._nics) - tasks.run_task(['sudo', _RTE_PCI_TOOL, '--bind=vfio-pci'] + nics_list, + nics_list = list(tmp_nic['pci'] for tmp_nic in self._host_nics) + tasks.run_task(['sudo', S.getValue('TOOLS')['bind-tool'], '--bind=vfio-pci'] + nics_list, self._logger, 'Binding NICs %s...' % nics_list, True) except subprocess.CalledProcessError: - self._logger.error('Unable to bind NICs %s', self._nics) + self._logger.error('Unable to bind NICs %s', self._host_nics) super(QemuPciPassthrough, self).start() @@ -75,10 +73,10 @@ class QemuPciPassthrough(IVnfQemu): super(QemuPciPassthrough, self).stop() # bind original driver to every interface - for nic in self._nics: + for nic in self._host_nics: if nic['driver']: try: - tasks.run_task(['sudo', _RTE_PCI_TOOL, '--bind=' + nic['driver'], nic['pci']], + tasks.run_task(['sudo', S.getValue('TOOLS')['bind-tool'], '--bind=' + nic['driver'], nic['pci']], self._logger, 'Binding NIC %s...' % nic['pci'], True) except subprocess.CalledProcessError: