summaryrefslogtreecommitdiffstats
path: root/vnfs/qemu/qemu_dpdk.py
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2015-09-25 18:00:17 +0100
committerMaryam Tahhan <maryam.tahhan@intel.com>2015-10-07 14:53:13 +0000
commit89e23da8e473387b2e6cb37a2b882d2d3c68655c (patch)
tree41bd86bc1447bf9bcbfa33cd95f175c258ede9d7 /vnfs/qemu/qemu_dpdk.py
parent1550b638fca662c5e68556702ff0316c3fc9562c (diff)
Enable PVVP deployment for DPDK Vhost User and Vhost Cuse
Generic PVVP deployment support has been added. Two new testcase scenarios for throughput and back2back tests with PVVP deployment were added. Original implementation of PVP has been refactored Following files were affected: modified: conf/01_testcases.conf modified: conf/02_vswitch.conf modified: conf/04_vnf.conf modified: core/__init__.py modified: core/component_factory.py modified: core/loader/loader_servant.py modified: core/vnf_controller.py deleted: core/vnf_controller_p2p.py deleted: core/vnf_controller_pvp.py modified: core/vswitch_controller_p2p.py modified: core/vswitch_controller_pvp.py new file: core/vswitch_controller_pvvp.py modified: docs/to-be-reorganized/NEWS.rst modified: docs/to-be-reorganized/quickstart.rst modified: src/dpdk/dpdk.py modified: src/ovs/ofctl.py modified: testcases/testcase.py modified: tools/tasks.py new file: vnfs/qemu/qemu.py new file: vnfs/qemu/qemu_dpdk.py modified: vnfs/qemu/qemu_dpdk_vhost_cuse.py modified: vnfs/qemu/qemu_dpdk_vhost_user.py modified: vnfs/vnf/vnf.py modified: vswitches/ovs_dpdk_vhost.py Change-Id: Ib6869a29337a184cb58c57fd96bba1183aba00ab JIRA: VSPERF-68, VSPERF-69 Signed-off-by: Martin Klozik (martinx.klozik@intel.com) Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com> Reviewed-by: Brian Castelli <brian.castelli@spirent.com>
Diffstat (limited to 'vnfs/qemu/qemu_dpdk.py')
-rw-r--r--vnfs/qemu/qemu_dpdk.py115
1 files changed, 115 insertions, 0 deletions
diff --git a/vnfs/qemu/qemu_dpdk.py b/vnfs/qemu/qemu_dpdk.py
new file mode 100644
index 00000000..0b8f90a0
--- /dev/null
+++ b/vnfs/qemu/qemu_dpdk.py
@@ -0,0 +1,115 @@
+# Copyright 2015 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Automation of QEMU hypervisor for launching vhost-cuse enabled guests.
+"""
+
+from vnfs.qemu.qemu import IVnfQemu
+from conf import settings as S
+
+class IVnfQemuDpdk(IVnfQemu):
+ """
+ An abstract class for controling an instance of QEMU with DPDK vHost support
+ """
+
+ def __init__(self):
+ """
+ :param timeout: Time to wait for login prompt. If set to
+ 0 do not wait.
+ :param number: Number of QEMU instance, used when multiple QEMU
+ instances are started at once.
+ :param args: Arguments to pass to QEMU.
+
+ :returns: None
+ """
+ super(IVnfQemuDpdk, self).__init__()
+ self._cmd += []
+
+ def _modify_dpdk_makefile(self):
+ """
+ Modifies DPDK makefile in Guest before compilation
+ """
+ pass
+
+ def _config_guest_loopback(self):
+ """
+ Configure VM to run testpmd
+
+ Configure performs the following:
+ * Mount hugepages
+ * mount shared directory for copying DPDK
+ * Disable firewall
+ * Compile DPDK
+ * DPDK NIC bind
+ * Run testpmd
+ """
+
+ # Guest images _should_ have 1024 hugepages by default,
+ # but just in case:'''
+ self.execute_and_wait('sysctl vm.nr_hugepages=1024')
+
+ # Mount hugepages
+ self.execute_and_wait('mkdir -p /dev/hugepages')
+ self.execute_and_wait(
+ 'mount -t hugetlbfs hugetlbfs /dev/hugepages')
+
+ # mount shared directory
+ self.execute_and_wait('umount ' + S.getValue('OVS_DPDK_SHARE'))
+ self.execute_and_wait('rm -rf ' + S.getValue('GUEST_OVS_DPDK_DIR'))
+ self.execute_and_wait('mkdir -p ' + S.getValue('OVS_DPDK_SHARE'))
+ self.execute_and_wait('mount -o iocharset=utf8 /dev/sdb1 ' +
+ S.getValue('OVS_DPDK_SHARE'))
+ self.execute_and_wait('mkdir -p ' + S.getValue('GUEST_OVS_DPDK_DIR'))
+ self.execute_and_wait('cp -a ' + S.getValue('OVS_DPDK_SHARE') + '/* ' +
+ S.getValue('GUEST_OVS_DPDK_DIR'))
+ # Get VM info
+ self.execute_and_wait('cat /etc/default/grub')
+
+ # Disable services (F16)
+ self.execute_and_wait('systemctl status iptables.service')
+ self.execute_and_wait('systemctl stop iptables.service')
+
+ # build and configure system for dpdk
+ self.execute_and_wait('cd ' + S.getValue('GUEST_OVS_DPDK_DIR') +
+ '/DPDK')
+ self.execute_and_wait('export CC=gcc')
+ self.execute_and_wait('export RTE_SDK=' +
+ S.getValue('GUEST_OVS_DPDK_DIR') + '/DPDK')
+ self.execute_and_wait('export RTE_TARGET=%s' % S.getValue('RTE_TARGET'))
+
+ # modify makefile if needed
+ self._modify_dpdk_makefile()
+
+ 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_nic_bind.py --status')
+ self.execute_and_wait(
+ './tools/dpdk_nic_bind.py -b igb_uio' ' ' +
+ S.getValue('GUEST_NET1_PCI_ADDRESS')[self._number] + ' ' +
+ S.getValue('GUEST_NET2_PCI_ADDRESS')[self._number])
+
+ # build and run 'test-pmd'
+ self.execute_and_wait('cd ' + S.getValue('GUEST_OVS_DPDK_DIR') +
+ '/DPDK/app/test-pmd')
+ self.execute_and_wait('make clean')
+ self.execute_and_wait('make')
+ self.execute_and_wait('./testpmd -c 0x3 -n 4 --socket-mem 512 --'
+ ' --burst=64 -i --txqflags=0xf00 ' +
+ '--disable-hw-vlan', 60, "Done")
+ self.execute('set fwd mac_retry', 1)
+ self.execute_and_wait('start', 20,
+ 'TX RS bit threshold=0 - TXQ flags=0xf00')