testpmd_pvp: Adds pkt_fwd to allow pvp topology testing 91/26891/4
authorChristian Trautman <ctrautma@redhat.com>
Wed, 11 Jan 2017 20:00:52 +0000 (15:00 -0500)
committerChristian Trautman <ctrautma@redhat.com>
Fri, 13 Jan 2017 22:57:37 +0000 (17:57 -0500)
Requires DPDK 16.11 or greater to support vdev flags.

Initial support for TestPMD to support guests.

Allows vsperf to execute TestPMD as a switch for pvp
test scenarios.

Can be increased in functionality later to support
multiple guest configs.

JIRA: VSPERF-406

Change-Id: I67a5a355c990ca6cfcbb5845a2beaf1c1f21f5f0
Signed-off-by: Christian Trautman <ctrautma@redhat.com>
conf/02_vswitch.conf
core/pktfwd_controller.py
docs/release/NEWS.rst
docs/userguide/testusage.rst
tools/pkt_fwd/pkt_fwd.py
tools/pkt_fwd/testpmd.py
vnfs/qemu/qemu_dpdk_vhost_user.py

index 2b74dae..2ca7591 100644 (file)
@@ -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
index b1e37f2..a0e14d1 100644 (file)
@@ -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
index e1a9fa3..02e03f7 100644 (file)
@@ -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
 ======================
index 46413f0..379618d 100755 (executable)
@@ -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
 ^^^^^^^^^^^^^^^^^^^^^^^^^
index 2580ee1..a080b5a 100644 (file)
@@ -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.
 
index e1b987b..30e8038 100644 (file)
@@ -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
 
index 51c1024..f09ded1 100644 (file)
@@ -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 +