summaryrefslogtreecommitdiffstats
path: root/vnfs/qemu
diff options
context:
space:
mode:
Diffstat (limited to 'vnfs/qemu')
-rw-r--r--vnfs/qemu/qemu.py2
-rw-r--r--vnfs/qemu/qemu_dpdk_vhost_user.py11
-rw-r--r--vnfs/qemu/qemu_pci_passthrough.py16
3 files changed, 17 insertions, 12 deletions
diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py
index c9569ae6..01c16a0f 100644
--- a/vnfs/qemu/qemu.py
+++ b/vnfs/qemu/qemu.py
@@ -85,7 +85,7 @@ class IVnfQemu(IVnf):
vnc = ':%d' % self._number
# don't use taskset to affinize main qemu process; It causes hangup
# of 2nd VM in case of DPDK. It also slows down VM responsivnes.
- self._cmd = ['sudo', '-E', S.getValue('QEMU_BIN'),
+ self._cmd = ['sudo', '-E', S.getValue('TOOLS')['qemu-system'],
'-m', S.getValue('GUEST_MEMORY')[self._number],
'-smp', str(S.getValue('GUEST_SMP')[self._number]),
'-cpu', 'host,migratable=off',
diff --git a/vnfs/qemu/qemu_dpdk_vhost_user.py b/vnfs/qemu/qemu_dpdk_vhost_user.py
index fc46aba1..51c10242 100644
--- a/vnfs/qemu/qemu_dpdk_vhost_user.py
+++ b/vnfs/qemu/qemu_dpdk_vhost_user.py
@@ -39,6 +39,12 @@ class QemuDpdkVhostUser(IVnfQemu):
else:
queue_str, mq_vector_str = '', ''
+ # Guest merge buffer setting
+ if S.getValue('GUEST_NIC_MERGE_BUFFERS_DISABLE')[self._number]:
+ merge_buff = 'mrg_rxbuf=off,'
+ else:
+ merge_buff = ''
+
# calculate index of first interface, i.e. check how many
# interfaces has been created for previous VMs, where 1st NIC
# of 1st VM has index 0
@@ -52,7 +58,7 @@ class QemuDpdkVhostUser(IVnfQemu):
self._cmd += ['-chardev',
'socket,id=char' + ifi +
- ',path=' + S.getValue('OVS_VAR_DIR') +
+ ',path=' + S.getValue('TOOLS')['ovs_var_tmp'] +
'dpdkvhostuser' + ifi,
'-netdev',
'type=vhost-user,id=' + net +
@@ -60,7 +66,8 @@ class QemuDpdkVhostUser(IVnfQemu):
'-device',
'virtio-net-pci,mac=' +
self._nics[nic]['mac'] +
- ',netdev=' + net + ',csum=off,gso=off,' +
+ ',netdev=' + net + ',csum=off,' + merge_buff +
+ 'gso=off,' +
'guest_tso4=off,guest_tso6=off,guest_ecn=off' +
mq_vector_str,
]
diff --git a/vnfs/qemu/qemu_pci_passthrough.py b/vnfs/qemu/qemu_pci_passthrough.py
index 951d6086..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,7 +37,7 @@ 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'):
@@ -47,7 +45,7 @@ class QemuPciPassthrough(IVnfQemu):
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: