diff options
author | Christian Trautman <ctrautma@redhat.com> | 2017-03-29 13:28:38 -0400 |
---|---|---|
committer | Christian Trautman <ctrautma@redhat.com> | 2017-03-30 07:36:53 -0400 |
commit | c071fadc49859b4cb6bd0c37a85746287612c42b (patch) | |
tree | d4d377ef8173366c400b6e7fa4a61ade779343f9 | |
parent | 881bf91ed8014ba48c55d3a8fc5b4980913f9b95 (diff) |
jumbo_frame: Add jumbo frame support
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>
-rw-r--r-- | conf/02_vswitch.conf | 3 | ||||
-rw-r--r-- | core/pktfwd_controller.py | 5 | ||||
-rw-r--r-- | docs/testing/user/userguide/testusage.rst | 59 | ||||
-rw-r--r-- | tools/pkt_fwd/testpmd.py | 34 | ||||
-rw-r--r-- | vnfs/qemu/qemu.py | 9 | ||||
-rw-r--r-- | vnfs/qemu/qemu_dpdk_vhost_user.py | 7 | ||||
-rw-r--r-- | vswitches/ovs_dpdk_vhost.py | 6 | ||||
-rw-r--r-- | vswitches/ovs_vanilla.py | 4 |
8 files changed, 125 insertions, 2 deletions
diff --git a/conf/02_vswitch.conf b/conf/02_vswitch.conf index 2bac1732..60ec7fb9 100644 --- a/conf/02_vswitch.conf +++ b/conf/02_vswitch.conf @@ -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 ######################### diff --git a/core/pktfwd_controller.py b/core/pktfwd_controller.py index 785c6f89..b38aefa5 100644 --- a/core/pktfwd_controller.py +++ b/core/pktfwd_controller.py @@ -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. """ diff --git a/docs/testing/user/userguide/testusage.rst b/docs/testing/user/userguide/testusage.rst index c6037aaf..03068911 100644 --- a/docs/testing/user/userguide/testusage.rst +++ b/docs/testing/user/userguide/testusage.rst @@ -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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tools/pkt_fwd/testpmd.py b/tools/pkt_fwd/testpmd.py index 970259dc..3b100c14 100644 --- a/tools/pkt_fwd/testpmd.py +++ b/tools/pkt_fwd/testpmd.py @@ -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 [] diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py index 997f93e0..a9ce176a 100644 --- a/vnfs/qemu/qemu.py +++ b/vnfs/qemu/qemu.py @@ -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']) diff --git a/vnfs/qemu/qemu_dpdk_vhost_user.py b/vnfs/qemu/qemu_dpdk_vhost_user.py index f09ded13..3e9aecc8 100644 --- a/vnfs/qemu/qemu_dpdk_vhost_user.py +++ b/vnfs/qemu/qemu_dpdk_vhost_user.py @@ -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 = '' diff --git a/vswitches/ovs_dpdk_vhost.py b/vswitches/ovs_dpdk_vhost.py index 3387fda7..13aef173 100644 --- a/vswitches/ovs_dpdk_vhost.py +++ b/vswitches/ovs_dpdk_vhost.py @@ -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) diff --git a/vswitches/ovs_vanilla.py b/vswitches/ovs_vanilla.py index 75870ab7..cfde3b45 100644 --- a/vswitches/ovs_vanilla.py +++ b/vswitches/ovs_vanilla.py @@ -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) |