summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-01-16 07:56:57 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-01-16 07:56:57 +0000
commitcafcb9f24b422a4b3a0b19ba00c83fe2819dcbaa (patch)
tree4a5f946ef9da8d81f1d74d7bac90130ba2464f82
parent0b202e7c4f4d88ba32570d245a4d4f7371f5fa3a (diff)
parent3ea19952db315e88263437ed41b0c31bd3bdbdf4 (diff)
Merge "testpmd_pvp: Adds pkt_fwd to allow pvp topology testing"
-rw-r--r--conf/02_vswitch.conf1
-rw-r--r--core/pktfwd_controller.py17
-rw-r--r--docs/release/NEWS.rst1
-rwxr-xr-xdocs/userguide/testusage.rst54
-rw-r--r--tools/pkt_fwd/pkt_fwd.py6
-rw-r--r--tools/pkt_fwd/testpmd.py19
-rw-r--r--vnfs/qemu/qemu_dpdk_vhost_user.py9
7 files changed, 102 insertions, 5 deletions
diff --git a/conf/02_vswitch.conf b/conf/02_vswitch.conf
index 2b74dae9..2ca7591c 100644
--- a/conf/02_vswitch.conf
+++ b/conf/02_vswitch.conf
@@ -119,6 +119,7 @@ PATHS['vswitch']['OvsVanilla']['bin']['modules'] = ['openvswitch']
#
# parameters used for legacy DPDK configuration through '--dpdk' option of ovs-vswitchd
# e.g. ovs-vswitchd --dpdk --socket-mem 1024,0
+# This config line is also used for pkt_fwd option (TestPMD phy2phy and pvp tests)
VSWITCHD_DPDK_ARGS = ['-c', '0x4', '-n', '4', '--socket-mem 1024,0']
# options used for new type of OVS configuration via calls to ovs-vsctl
diff --git a/core/pktfwd_controller.py b/core/pktfwd_controller.py
index b1e37f2e..a0e14d19 100644
--- a/core/pktfwd_controller.py
+++ b/core/pktfwd_controller.py
@@ -32,7 +32,7 @@ class PktFwdController(object):
self._deployment = deployment
self._logger = logging.getLogger(__name__)
self._pktfwd_class = pktfwd_class
- self._pktfwd = pktfwd_class()
+ self._pktfwd = pktfwd_class(guest=True if deployment == "pvp" else False)
self._logger.debug('Creation using ' + str(self._pktfwd_class))
def setup(self):
@@ -46,6 +46,17 @@ class PktFwdController(object):
self._pktfwd.stop()
raise
+ def setup_for_guest(self):
+ """Sets up the packet forwarder for pvp.
+ """
+ self._logger.debug('Setup using ' + str(self._pktfwd_class))
+
+ try:
+ self._pktfwd.start_for_guest()
+ except:
+ self._pktfwd.stop()
+ raise
+
def stop(self):
"""Tears down the packet forwarder created in setup().
"""
@@ -55,10 +66,14 @@ class PktFwdController(object):
def __enter__(self):
if self._deployment.find("p2p") == 0:
self.setup()
+ elif self._deployment == "pvp":
+ self.setup_for_guest()
def __exit__(self, type_, value, traceback):
if self._deployment.find("p2p") == 0:
self.stop()
+ elif self._deployment == "pvp":
+ self.stop()
def get_pktfwd(self):
"""Get the controlled packet forwarder
diff --git a/docs/release/NEWS.rst b/docs/release/NEWS.rst
index e1a9fa3b..02e03f79 100644
--- a/docs/release/NEWS.rst
+++ b/docs/release/NEWS.rst
@@ -7,6 +7,7 @@ OPNFV D Release
* Remove support for vhost cuse
* Add Vanilla OVS Multi-queue with non testpmd options
* Add support for Multi-queue with OVS 2.5.0 or less
+* Add TestPMD as a switch option for pvp topology testing with vhostuser
OPNFV Colorado Release
======================
diff --git a/docs/userguide/testusage.rst b/docs/userguide/testusage.rst
index 46413f03..379618d2 100755
--- a/docs/userguide/testusage.rst
+++ b/docs/userguide/testusage.rst
@@ -613,7 +613,7 @@ or use ``--vswitch`` and ``--fwdapp`` CLI arguments:
.. code-block:: console
- $ ./vsperf --conf-file user_settings.py \
+ $ ./vsperf phy2phy_cont --conf-file user_settings.py \
--vswitch none \
--fwdapp TestPMD
@@ -647,7 +647,57 @@ Supported Packet Forwarding applications are:
.. code-block:: console
- $ ./vsperf --conf-file <path_to_settings_py>
+ $ ./vsperf phy2phy_tput --conf-file <path_to_settings_py>
+
+Executing Packet Forwarding tests with one guest
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+TestPMD with DPDK 16.11 or greater can be used to forward packets as a switch to a single guest using TestPMD vdev
+option. To set this configuration the following parameters should be used.
+
+ .. code-block:: python
+
+ VSWITCH = 'none'
+ PKTFWD = 'TestPMD'
+
+or use ``--vswitch`` and ``--fwdapp`` CLI arguments:
+
+ .. code-block:: console
+
+ $ ./vsperf pvp_tput --conf-file user_settings.py \
+ --vswitch none \
+ --fwdapp TestPMD
+
+Guest forwarding application only supports TestPMD in this configuration.
+
+ .. code-block:: python
+
+ GUEST_LOOPBACK = ['testpmd']
+
+For optimal performance one cpu per port +1 should be used for TestPMD. Also set additional params for packet forwarding
+application to use the correct number of nb-cores.
+
+ .. code-block:: python
+
+ VSWITCHD_DPDK_ARGS = ['-l', '46,44,42,40,38', '-n', '4', '--socket-mem 1024,0']
+ TESTPMD_ARGS = ['--nb-cores=4', '--txq=1', '--rxq=1']
+
+For guest TestPMD 3 VCpus should be assigned with the following TestPMD params.
+
+ .. code-block:: python
+
+ GUEST_TESTPMD_PARAMS = ['-l 0,1,2 -n 4 --socket-mem 1024 -- '
+ '--burst=64 -i --txqflags=0xf00 '
+ '--disable-hw-vlan --nb-cores=2 --txq=1 --rxq=1']
+
+Execution of TestPMD can be run with the following command line
+
+ .. code-block:: console
+
+ ./vsperf pvp_tput --vswitch=none --fwdapp=TestPMD --conf-file <path_to_settings_py>
+
+**NOTE:** To achieve the best 0% loss numbers with rfc2544 throughput testing, other tunings should be applied to host
+and guest such as tuned profiles and CPU tunings to prevent possible interrupts to worker threads.
VSPERF modes of operation
^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tools/pkt_fwd/pkt_fwd.py b/tools/pkt_fwd/pkt_fwd.py
index 2580ee1f..a080b5a2 100644
--- a/tools/pkt_fwd/pkt_fwd.py
+++ b/tools/pkt_fwd/pkt_fwd.py
@@ -44,6 +44,12 @@ class IPktFwd(object):
"""
raise NotImplementedError('Please call an implementation.')
+ def start_for_guest(self):
+ """Start the packet forward for guest config
+
+ :returns: None
+ """
+
def stop(self):
"""Stop the packet forwarder.
diff --git a/tools/pkt_fwd/testpmd.py b/tools/pkt_fwd/testpmd.py
index e1b987bc..30e80386 100644
--- a/tools/pkt_fwd/testpmd.py
+++ b/tools/pkt_fwd/testpmd.py
@@ -24,6 +24,8 @@ from tools.pkt_fwd.pkt_fwd import IPktFwd
_LOGGER = logging.getLogger(__name__)
_VSWITCHD_CONST_ARGS = ['--', '-i']
+_TESTPMD_PVP_CONST_ARGS = ['--vdev', 'net_vhost0,iface=/tmp/dpdkvhostuser0',
+ '--vdev', 'net_vhost1,iface=/tmp/dpdkvhostuser1',]
class TestPMD(IPktFwd):
"""TestPMD implementation (only phy2phy deployment is supported)
@@ -37,8 +39,10 @@ class TestPMD(IPktFwd):
_logger = logging.getLogger()
- def __init__(self):
+ def __init__(self, guest=False):
vswitchd_args = settings.getValue('VSWITCHD_DPDK_ARGS')
+ if guest:
+ vswitchd_args += _TESTPMD_PVP_CONST_ARGS
vswitchd_args += _VSWITCHD_CONST_ARGS
vswitchd_args += settings.getValue('TESTPMD_ARGS')
@@ -70,6 +74,19 @@ class TestPMD(IPktFwd):
self._testpmd.send('start', 1)
+ def start_for_guest(self):
+ """See IPktFwd for general description
+
+ Activates testpmd for guest config
+ """
+ self._logger.info("Starting TestPMD for one guest...")
+ dpdk.init()
+ self._testpmd.start()
+ self._logger.info("TestPMD...Started.")
+ self._testpmd.send('set portlist 0,2,1,3')
+
+ self._testpmd.send('start', 1)
+
def stop(self):
"""See IPktFwd for general description
diff --git a/vnfs/qemu/qemu_dpdk_vhost_user.py b/vnfs/qemu/qemu_dpdk_vhost_user.py
index 51c10242..f09ded13 100644
--- a/vnfs/qemu/qemu_dpdk_vhost_user.py
+++ b/vnfs/qemu/qemu_dpdk_vhost_user.py
@@ -56,9 +56,16 @@ class QemuDpdkVhostUser(IVnfQemu):
ifi = str(index)
net = 'net' + str(index + 1)
+ # In case of testpmd as switch, path to vhost netdev folder will be set
+ # to tmp location instead of default ovs_var_tmp folder.
+ if S.getValue('VSWITCH') == 'none':
+ vhost_folder = '/tmp/'
+ else:
+ vhost_folder = S.getValue('TOOLS')['ovs_var_tmp']
+
self._cmd += ['-chardev',
'socket,id=char' + ifi +
- ',path=' + S.getValue('TOOLS')['ovs_var_tmp'] +
+ ',path=' + vhost_folder +
'dpdkvhostuser' + ifi,
'-netdev',
'type=vhost-user,id=' + net +