dpdk: Support dpdk vhost-user client mode 05/37905/1
authorMartin Klozik <martinx.klozik@intel.com>
Thu, 20 Jul 2017 14:49:16 +0000 (15:49 +0100)
committerMartin Klozik <martinx.klozik@intel.com>
Fri, 21 Jul 2017 07:32:30 +0000 (08:32 +0100)
Support of vhost-user client mode has been added for both
OVS and VPP. VSPERF configures vhost-user server mode
in vswitches by default for backward compatibility.
Support of vhost-user server mode is deprecated
in OVS and it can be removed in future releases. Once it will
happen, we have to change vsperf default behavior to
usage of vhost-user client ports at vswitch side.

This patch also fixes processing of boolean configuration
parameters passed via --test-params option. In the past
it was not possible to set boolean value to False through
--test-params option.

JIRA: VSPERF-517

Change-Id: I65e341f820edd6c720043a4acc74c5140b05db18
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com>
Reviewed-by: Trevor Cooper <trevor.cooper@intel.com>
conf/02_vswitch.conf
conf/__init__.py
docs/testing/user/userguide/testusage.rst
vnfs/qemu/qemu_dpdk_vhost_user.py
vswitches/ovs_dpdk_vhost.py
vswitches/vpp_dpdk_vhost.py

index 6a6027a..c50a5dd 100644 (file)
@@ -153,6 +153,13 @@ VSWITCHD_DPDK_CONFIG = {
 # Note: VSPERF will automatically detect, which type of DPDK configuration should
 # be used.
 
+# Defines if VSWITCH should be a server for sockets of DPDK vhost-user
+# interfaces (True) or not (False). Support of vhost user server mode
+# in Open vSwitch is deprecated and will be removed in future releases.
+# Note: Qemu 2.7 and newer is required to support settings
+# VSWITCH_VHOSTUSER_SERVER_MODE = False
+VSWITCH_VHOSTUSER_SERVER_MODE = True
+
 # To enable multi queue with dpdk modify the below param to the number of
 # queues for dpdk. 0 = disabled
 VSWITCH_DPDK_MULTI_QUEUES = 0
index e24111d..e714a7b 100644 (file)
@@ -93,7 +93,7 @@ class Settings(object):
                 master_value = getattr(self, attr)
                 # Check if parameter value was modified by CLI option
                 cli_value = get_test_param(attr, None)
-                if cli_value:
+                if cli_value is not None:
                     # TRAFFIC dictionary is not overridden by CLI option
                     # but only updated by specified values
                     if attr == 'TRAFFIC':
index b6939e5..4d3528d 100644 (file)
@@ -296,7 +296,7 @@ Executing tests with VMs
 
 To run tests using vhost-user as guest access method:
 
-1. Set VHOST_METHOD and VNF of your settings file to:
+1. Set VSWITCH and VNF of your settings file to:
 
    .. code-block:: python
 
@@ -317,6 +317,10 @@ To run tests using vhost-user as guest access method:
 
        $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf
 
+**NOTE:** By default vSwitch is acting as a server for dpdk vhost-user sockets.
+In case, that QEMU should be a server for vhost-user sockets, then parameter
+``VSWITCH_VHOSTUSER_SERVER_MODE`` should be set to ``False``.
+
 Executing tests with VMs using Vanilla OVS
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
index 3e9aecc..9314783 100644 (file)
@@ -68,10 +68,11 @@ class QemuDpdkVhostUser(IVnfQemu):
             else:
                 vhost_folder = S.getValue('TOOLS')['ovs_var_tmp']
 
+            nic_mode = '' if S.getValue('VSWITCH_VHOSTUSER_SERVER_MODE') else ',server'
             self._cmd += ['-chardev',
                           'socket,id=char' + ifi +
                           ',path=' + vhost_folder +
-                          'dpdkvhostuser' + ifi,
+                          'dpdkvhostuser' + ifi + nic_mode,
                           '-netdev',
                           'type=vhost-user,id=' + net +
                           ',chardev=char' + ifi + ',vhostforce' + queue_str,
index 13aef17..3b20be3 100644 (file)
@@ -142,9 +142,18 @@ class OvsDpdkVhost(IVSwitchOvs):
         from 0
         """
         bridge = self._bridges[switch_name]
-        vhost_count = self._get_port_count('type=dpdkvhostuser')
+
+        if S.getValue('VSWITCH_VHOSTUSER_SERVER_MODE'):
+            nic_type = 'dpdkvhostuser'
+        else:
+            nic_type = 'dpdkvhostuserclient'
+
+        vhost_count = self._get_port_count('type={}'.format(nic_type))
         port_name = 'dpdkvhostuser' + str(vhost_count)
-        params = ['--', 'set', 'Interface', port_name, 'type=dpdkvhostuser']
+        params = ['--', 'set', 'Interface', port_name, 'type={}'.format(nic_type)]
+        if not S.getValue('VSWITCH_VHOSTUSER_SERVER_MODE'):
+            params += ['--', 'set', 'Interface', port_name, 'options:vhost-server-path='
+                       '{}{}'.format(S.getValue('TOOLS')['ovs_var_tmp'], port_name)]
         if S.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
             params += ['mtu_request={}'.format(
                 S.getValue('VSWITCH_JUMBO_FRAMES_SIZE'))]
index 42f1cdf..317f379 100644 (file)
@@ -225,7 +225,11 @@ class VppDpdkVhost(IVSwitch, tasks.Process):
         """See IVswitch for general description
         """
         socket_name = S.getValue('TOOLS')['ovs_var_tmp'] + 'dpdkvhostuser' + str(len(self._virt_ports))
-        output = self.run_vppctl(['create', 'vhost-user', 'socket', socket_name, 'server'] +
+        if S.getValue('VSWITCH_VHOSTUSER_SERVER_MODE'):
+            mode = ['server']
+        else:
+            mode = []
+        output = self.run_vppctl(['create', 'vhost-user', 'socket', socket_name] + mode +
                                  S.getValue('VSWITCH_VPP_VHOSTUSER_ARGS'))
         if output[0].find('returned') >= 0:
             raise RuntimeError('VPP VhostUser interface cannot be created.')