From da5b1633255f904f7d4f4c38c52df2f7f8e74092 Mon Sep 17 00:00:00 2001 From: Antonio Fischetti Date: Thu, 11 Aug 2016 12:59:46 +0100 Subject: CLI: add Multiqueue params. This patch implements the following new CLI parameters that can be used in the --test-params list. 1. guest_nic_queues, which overrides all GUEST_NIC_QUEUES values 2. guest_testpmd_txq, which overrides all GUEST_TESTPMD_TXQ 3. guest_testpmd_rxq, which overrides all GUEST_TESTPMD_RXQ 4. guest_testpmd_nb_cores, which overrides all GUEST_TESTPMD_NB_CORES values 5. guest_testpmd_cpu_mask, which overrides all GUEST_TESTPMD_CPU_MASK values 6. vswitch_dpdk_multi_queues, which overrides VSWITCH_DPDK_MULTI_QUEUES 7. guest_smp, which overrides all GUEST_SMP values 8. guest_core_binding, which overrides all GUEST_CORE_BINDING values When they are present in the CLI the corresponding settings from the configuration files will be overridden. As an example a usage can be: ./vsperf --test-params "guest_nic_queues=2;guest_testpmd_txq=1;\ guest_testpmd_rxq=1;guest_testpmd_nb_cores=1"... v2: rebase + rework to add other CLI params as suggested and update doc. v3: changes in 'testusage.rst' doc. JIRA: VSPERF-371 Change-Id: I140d6e068c1653d21aaa0df27532a48c4a12c151 Signed-off-by: Antonio Fischetti Reviewed-by: Maryam Tahhan Reviewed-by: Martin Klozik --- docs/userguide/testusage.rst | 12 ++++++++++++ vnfs/qemu/qemu.py | 39 ++++++++++++++++++++++++++++++++++++--- vnfs/qemu/qemu_dpdk_vhost_user.py | 5 +++++ vswitches/ovs_dpdk_vhost.py | 6 ++++++ 4 files changed, 59 insertions(+), 3 deletions(-) diff --git a/docs/userguide/testusage.rst b/docs/userguide/testusage.rst index 3c5cc4d4..9648569f 100755 --- a/docs/userguide/testusage.rst +++ b/docs/userguide/testusage.rst @@ -518,6 +518,18 @@ environment. on the same numa as the NIC in use if possible/applicable. Testpmd should be assigned at least (nb_cores +1) total cores with the cpu mask. +The following CLI parameters override the corresponding configuration settings: + 1. guest_nic_queues, which overrides all GUEST_NIC_QUEUES values + 2. guest_testpmd_txq, which overrides all GUEST_TESTPMD_TXQ + 3. guest_testpmd_rxq, which overrides all GUEST_TESTPMD_RXQ + 4. guest_testpmd_nb_cores, which overrides all GUEST_TESTPMD_NB_CORES + values + 5. guest_testpmd_cpu_mask, which overrides all GUEST_TESTPMD_CPU_MASK + values + 6. vswitch_dpdk_multi_queues, which overrides VSWITCH_DPDK_MULTI_QUEUES + 7. guest_smp, which overrides all GUEST_SMP values + 8. guest_core_binding, which overrides all GUEST_CORE_BINDING values + Executing Packet Forwarding tests ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py index 01c16a0f..e654ac7e 100644 --- a/vnfs/qemu/qemu.py +++ b/vnfs/qemu/qemu.py @@ -81,6 +81,11 @@ class IVnfQemu(IVnf): self._testpmd_fwd_mode, 'io') self._testpmd_fwd_mode = 'io' + guest_smp = int(get_test_param('guest_smp', 0)) + if guest_smp: + override_list = [guest_smp] * (self._number + 1) + S.setValue('GUEST_SMP', override_list) + name = 'Client%d' % self._number vnc = ':%d' % self._number # don't use taskset to affinize main qemu process; It causes hangup @@ -230,14 +235,18 @@ class IVnfQemu(IVnf): stdin=proc.stdout) proc.wait() + guest_core_binding = int(get_test_param('guest_core_binding', 0)) for cpu in range(0, int(S.getValue('GUEST_SMP')[self._number])): match = None for line in output.decode(cur_locale).split('\n'): match = re.search(thread_id % cpu, line) if match: - self._affinitize_pid( - S.getValue('GUEST_CORE_BINDING')[self._number][cpu], - match.group(1)) + if guest_core_binding: + self._affinitize_pid(guest_core_binding, match.group(1)) + else: + self._affinitize_pid( + S.getValue('GUEST_CORE_BINDING')[self._number][cpu], + match.group(1)) break if not match: @@ -389,6 +398,30 @@ class IVnfQemu(IVnf): '/DPDK/app/test-pmd') self.execute_and_wait('make clean') self.execute_and_wait('make') + + # get multi-queue settings from CLI + guest_testpmd_txq = int(get_test_param('guest_testpmd_txq', 0)) + if guest_testpmd_txq: + override_list = [guest_testpmd_txq] * (self._number + 1) + S.setValue('GUEST_TESTPMD_TXQ', override_list) + + guest_testpmd_rxq = int(get_test_param('guest_testpmd_rxq', 0)) + if guest_testpmd_rxq: + override_list = [guest_testpmd_rxq] * (self._number + 1) + S.setValue('GUEST_TESTPMD_RXQ', override_list) + + guest_testpmd_nb_cores = \ + int(get_test_param('guest_testpmd_nb_cores', 0)) + if guest_testpmd_nb_cores: + override_list = [guest_testpmd_nb_cores] * (self._number + 1) + S.setValue('GUEST_TESTPMD_NB_CORES', override_list) + + guest_testpmd_cpu_mask = \ + int(get_test_param('guest_testpmd_cpu_mask', 0)) + if guest_testpmd_cpu_mask: + override_list = [guest_testpmd_cpu_mask] * (self._number + 1) + S.setValue('GUEST_TESTPMD_CPU_MASK', override_list) + if int(S.getValue('GUEST_NIC_QUEUES')[self._number]): self.execute_and_wait( './testpmd {} -n4 --socket-mem 512 --'.format( diff --git a/vnfs/qemu/qemu_dpdk_vhost_user.py b/vnfs/qemu/qemu_dpdk_vhost_user.py index 51c10242..a25c61ef 100644 --- a/vnfs/qemu/qemu_dpdk_vhost_user.py +++ b/vnfs/qemu/qemu_dpdk_vhost_user.py @@ -18,6 +18,7 @@ import logging from conf import settings as S +from conf import get_test_param from vnfs.qemu.qemu import IVnfQemu class QemuDpdkVhostUser(IVnfQemu): @@ -32,6 +33,10 @@ class QemuDpdkVhostUser(IVnfQemu): self._logger = logging.getLogger(__name__) # multi-queue values + guest_nic_queues = int(get_test_param('guest_nic_queues', 0)) + if guest_nic_queues: + override_list = [guest_nic_queues] * (self._number + 1) + S.setValue('GUEST_NIC_QUEUES', override_list) if int(S.getValue('GUEST_NIC_QUEUES')[self._number]): queue_str = ',queues={}'.format(S.getValue('GUEST_NIC_QUEUES')[self._number]) mq_vector_str = ',mq=on,vectors={}'.format( diff --git a/vswitches/ovs_dpdk_vhost.py b/vswitches/ovs_dpdk_vhost.py index 327a697d..5beb0051 100644 --- a/vswitches/ovs_dpdk_vhost.py +++ b/vswitches/ovs_dpdk_vhost.py @@ -22,6 +22,7 @@ import os from src.ovs import OFBridge from src.dpdk import dpdk from conf import settings +from conf import get_test_param from vswitches.ovs import IVSwitchOvs class OvsDpdkVhost(IVSwitchOvs): @@ -69,6 +70,11 @@ class OvsDpdkVhost(IVSwitchOvs): dpdk.init() super(OvsDpdkVhost, self).start() # old style OVS <= 2.5.0 multi-queue enable + vswitch_dpdk_multi_queues = \ + int(get_test_param('vswitch_dpdk_multi_queues', 0)) + if vswitch_dpdk_multi_queues: + settings.setValue('VSWITCH_DPDK_MULTI_QUEUES', \ + vswitch_dpdk_multi_queues) if settings.getValue('OVS_OLD_STYLE_MQ') and \ int(settings.getValue('VSWITCH_DPDK_MULTI_QUEUES')): tmp_br = OFBridge(timeout=-1) -- cgit 1.2.3-korg