jumbo_frame: Add jumbo frame support 71/32271/2
authorChristian Trautman <ctrautma@redhat.com>
Wed, 29 Mar 2017 17:28:38 +0000 (13:28 -0400)
committerChristian Trautman <ctrautma@redhat.com>
Thu, 30 Mar 2017 11:36:53 +0000 (07:36 -0400)
Add jumbo frame support for all packet forwarding applications
inside guest for pxp testing. Enable jumbo frame support for
OvsVanilla, OvsDpdkVhostUser, and Packet forwarding.

Add minor fix for missing method issue when running packet
forwarding tests. The get_version method was missing in
the packet_forwaring core module.

JIRA: VSPERF-501

Change-Id: Ia99975f47c64259ed2566bde3c85b2779c309e80
Signed-off-by: Christian Trautman <ctrautma@redhat.com>
conf/02_vswitch.conf
core/pktfwd_controller.py
docs/testing/user/userguide/testusage.rst
tools/pkt_fwd/testpmd.py
vnfs/qemu/qemu.py
vnfs/qemu/qemu_dpdk_vhost_user.py
vswitches/ovs_dpdk_vhost.py
vswitches/ovs_vanilla.py

index 2bac173..60ec7fb 100644 (file)
@@ -189,6 +189,9 @@ LOG_FILE_OVS = 'ovs.log'
 # default vswitch implementation
 VSWITCH = "OvsDpdkVhost"
 
+VSWITCH_JUMBO_FRAMES_ENABLED = False
+VSWITCH_JUMBO_FRAMES_SIZE = 9000
+
 #########################
 ## VPP
 #########################
index 785c6f8..b38aefa 100644 (file)
@@ -48,6 +48,11 @@ class PktFwdController(object):
             self._pktfwd.stop()
             raise
 
+    def get_vswitch(self):
+        """See IVswitchController for description
+        """
+        return self._pktfwd
+
     def setup_for_guest(self):
         """Sets up the packet forwarder for pvp.
         """
index c6037aa..0306891 100644 (file)
@@ -645,6 +645,65 @@ 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.
 
+Jumbo Frame Testing
+^^^^^^^^^^^^^^^^^^^
+
+VSPERF provides options to support jumbo frame testing with a jumbo frame supported
+NIC and traffic generator for the following vswitches:
+
+1.  OVSVanilla
+
+2.  OvsDpdkVhostUser
+
+3.  TestPMD loopback with or without a guest
+
+**NOTE:** There is currently no support for SR-IOV or VPP at this time with jumbo
+frames.
+
+All packet forwarding applications for pxp testing is supported.
+
+To enable jumbo frame testing simply enable the option in the conf files and set the
+maximum size that will be used.
+
+.. code-block:: python
+
+    VSWITCH_JUMBO_FRAMES_ENABLED = True
+    VSWITCH_JUMBO_FRAMES_SIZE = 9000
+
+To enable jumbo frame testing with OVSVanilla the NIC in test on the host must have
+its mtu size changed manually using ifconfig or applicable tools:
+
+.. code-block:: console
+
+    ifconfig eth1 mtu 9000 up
+
+**NOTE:** To make the setting consistent across reboots you should reference the OS
+documents as it differs from distribution to distribution.
+
+To start a test for jumbo frames modify the conf file packet sizes or pass the option
+through the VSPERF command line.
+
+.. code-block:: python
+
+    TEST_PARAMS = {'TRAFFICGEN_PKT_SIZES':(2000,9000)}
+
+.. code-block:: python
+
+    ./vsperf --test-params "TRAFFICGEN_PKT_SIZES=2000,9000"
+
+It is recommended to increase the memory size for OvsDpdkVhostUser testing from the default
+1024. Your size required may vary depending on the number of guests in your testing. 4096
+appears to work well for most typical testing scenarios.
+
+.. code-block:: python
+
+    DPDK_SOCKET_MEM = ['4096', '0']
+
+**NOTE:** For Jumbo frames to work with DpdkVhostUser, mergable buffers will be enabled by
+default. If testing with mergable buffers in QEMU is desired, disable Jumbo Frames and only
+test non jumbo frame sizes. Test Jumbo Frames sizes separately to avoid this collision.
+
+
 Executing Packet Forwarding tests
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
index 970259d..3b100c1 100644 (file)
@@ -54,6 +54,11 @@ class TestPMD(IPktFwd):
         vswitchd_args += _VSWITCHD_CONST_ARGS
         vswitchd_args += settings.getValue('TESTPMD_ARGS')
 
+        # need to give mbufs a larger size for jumbo frames based on the setting
+        if settings.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
+            vswitchd_args += ['--mbuf-size={}'.format(int(
+                settings.getValue('VSWITCH_JUMBO_FRAMES_SIZE')) + 500)]
+
         self._nports = len(settings.getValue('NICS'))
         self._fwdmode = settings.getValue('TESTPMD_FWD_MODE')
         self._csum_layer = settings.getValue('TESTPMD_CSUM_LAYER')
@@ -74,6 +79,12 @@ class TestPMD(IPktFwd):
 
         self._testpmd.send('set fwd {}'.format(self._fwdmode), 1)
 
+        if settings.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
+            self._testpmd.send('port stop all', 1)  # ports must be stopped to set mtu
+            self._testpmd.send('port config all max-pkt-len {}'.format(
+                settings.getValue('VSWITCH_JUMBO_FRAMES_SIZE')), 1)
+            self._testpmd.send('port start all', 1)
+
         for port in range(self._nports):
             self._testpmd.send('csum set {} {} {}'.format(
                 self._csum_layer, self._csum_calc, port), 1)
@@ -91,7 +102,18 @@ class TestPMD(IPktFwd):
         dpdk.init()
         self._testpmd.start()
         self._logger.info("TestPMD...Started.")
-        self._testpmd.send('set portlist 0,2,1,3')
+
+        if settings.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
+            self._testpmd.send('port stop all', 1)  # ports must be stopped to set mtu
+            self._testpmd.send('port config all max-pkt-len {}'.format(
+                settings.getValue('VSWITCH_JUMBO_FRAMES_SIZE')), 1)
+            # conflicting info if scatter needs to be enabled or not
+            self._testpmd.send('port config all scatter on', 1)
+            self._testpmd.send('port start all', 1)
+            self._testpmd.wait(timeout=60)  # port startup can take a few seconds
+
+        self._testpmd.send('set portlist 0,2,1,3', 1)
+        self._testpmd.send('set fwd {}'.format(self._fwdmode), 1)
 
         self._testpmd.send('start', 1)
 
@@ -108,3 +130,13 @@ class TestPMD(IPktFwd):
         except pexpect.EOF:
             pass
         dpdk.cleanup()
+
+    # Method could be a function
+    # pylint: disable=no-self-use
+    def get_version(self):
+        """
+        Get product version
+        :return: None
+        """
+        # No way to read TestPMD version
+        return []
index 997f93e..a9ce176 100644 (file)
@@ -387,6 +387,9 @@ class IVnfQemu(IVnf):
 
         # get testpmd settings from CLI
         testpmd_params = S.getValue('GUEST_TESTPMD_PARAMS')[self._number]
+        if S.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
+            testpmd_params += ' --max-pkt-len={}'.format(S.getValue(
+                'VSWITCH_JUMBO_FRAMES_SIZE'))
 
         self.execute_and_wait('./testpmd {}'.format(testpmd_params), 60, "Done")
         self.execute('set fwd ' + self._testpmd_fwd_mode, 1)
@@ -405,6 +408,9 @@ class IVnfQemu(IVnf):
         for nic in self._nics:
             self.execute('ip addr add ' +
                          nic['ip'] + ' dev ' + nic['device'])
+            if S.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
+                self.execute('ifconfig {} mtu {}'.format(
+                    nic['device'], S.getValue('VSWITCH_JUMBO_FRAMES_SIZE')))
             self.execute('ip link set dev ' + nic['device'] + ' up')
 
         # build and configure system for l2fwd
@@ -436,6 +442,9 @@ class IVnfQemu(IVnf):
         for nic in self._nics:
             self.execute('ip addr add ' +
                          nic['ip'] + ' dev ' + nic['device'])
+            if S.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
+                self.execute('ifconfig {} mtu {}'.format(
+                    nic['device'], S.getValue('VSWITCH_JUMBO_FRAMES_SIZE')))
             self.execute('ip link set dev ' + nic['device'] + ' up')
             self.execute('brctl addif br0 ' + nic['device'])
 
index f09ded1..3e9aecc 100644 (file)
@@ -41,7 +41,12 @@ class QemuDpdkVhostUser(IVnfQemu):
 
         # Guest merge buffer setting
         if S.getValue('GUEST_NIC_MERGE_BUFFERS_DISABLE')[self._number]:
-            merge_buff = 'mrg_rxbuf=off,'
+            if S.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
+                self._logger.warning(
+                    'Mergable buffers must be enabled for jumbo frames. Overriding.')
+                merge_buff = ''
+            else:
+                merge_buff = 'mrg_rxbuf=off,'
         else:
             merge_buff = ''
 
index 3387fda..13aef17 100644 (file)
@@ -128,6 +128,9 @@ class OvsDpdkVhost(IVSwitchOvs):
                 not S.getValue('OVS_OLD_STYLE_MQ'):
             params += ['options:n_rxq={}'.format(
                 S.getValue('VSWITCH_DPDK_MULTI_QUEUES'))]
+        if S.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
+            params += ['mtu_request={}'.format(
+                S.getValue('VSWITCH_JUMBO_FRAMES_SIZE'))]
         of_port = bridge.add_port(port_name, params)
         return (port_name, of_port)
 
@@ -142,6 +145,9 @@ class OvsDpdkVhost(IVSwitchOvs):
         vhost_count = self._get_port_count('type=dpdkvhostuser')
         port_name = 'dpdkvhostuser' + str(vhost_count)
         params = ['--', 'set', 'Interface', port_name, 'type=dpdkvhostuser']
+        if S.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
+            params += ['mtu_request={}'.format(
+                S.getValue('VSWITCH_JUMBO_FRAMES_SIZE'))]
         of_port = bridge.add_port(port_name, params)
 
         return (port_name, of_port)
index 75870ab..cfde3b4 100644 (file)
@@ -116,6 +116,10 @@ class OvsVanilla(IVSwitchOvs):
             tap_cmd_list += ['multi_queue']
         tasks.run_task(tap_cmd_list, self._logger,
                        'Creating tap device...', False)
+        if settings.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'):
+            tasks.run_task(['ifconfig', tap_name, 'mtu',
+                            str(settings.getValue('VSWITCH_JUMBO_FRAMES_SIZE'))],
+                           self._logger, 'Setting mtu size', False)
 
         tasks.run_task(['sudo', 'ip', 'addr', 'flush', 'dev', tap_name],
                        self._logger, 'Remove IP', False)