* [dts] [PATCH] tests/loopback_multi_paths_port_restart_performance: add test scripts of multi_paths and port_restart with loopback
@ 2019-01-09 19:29 Yinan
0 siblings, 0 replies; only message in thread
From: Yinan @ 2019-01-09 19:29 UTC (permalink / raw)
To: dts; +Cc: Wang Yinan
From: Wang Yinan <yinan.wang@intel.com>
test Loopback Virtio 1.1 mergeable path with port restart
test Loopback Virtio 1.1 no-mergeable path with port restart
test Loopback In-order mergeable path with port restart
test Loopback In-order no-mergeable path with port restart
test Loopback Mergeable path with port restart
test Loopback Normal path with port start
test Loopback Vector-RX path with port start
Signed-off-by: Wang Yinan <yinan.wang@intel.com>
---
...ck_multi_paths_port_restart_performance.py | 691 ++++++++++++++++++
1 file changed, 691 insertions(+)
create mode 100644 tests/TestSuite_loopback_multi_paths_port_restart_performance.py
diff --git a/tests/TestSuite_loopback_multi_paths_port_restart_performance.py b/tests/TestSuite_loopback_multi_paths_port_restart_performance.py
new file mode 100644
index 0000000..0a7bdc8
--- /dev/null
+++ b/tests/TestSuite_loopback_multi_paths_port_restart_performance.py
@@ -0,0 +1,691 @@
+#
+# BSD LICENSE
+#
+# Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+"""
+DPDK Test suite.
+Benchmark Vhost loopback performance for 7 RX/TX PATHs.
+Includes Mergeable, Normal, Vector_RX,Inorder_mergeable,
+Inorder_no_mergeable, VIRTIO1.1_mergeable, VIRTIO1.1_normal Path.
+"""
+import os
+import string
+import utils
+import time
+import re
+from test_case import TestCase
+
+class TestVhostLoopback(TestCase):
+
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ """
+ # Loopback test case preparation
+ self.frame_sizes = [64, 128, 256, 512, 1024, 1518]
+ self.header_row = ["FrameSize(B)", "Mode", "Throughput(Mpps)", "Virtio Version","Cycle"]
+ self.test_cycles = {'Mpps': {}, 'pct': {}}
+ self.core_config = "1S/4C/1T"
+ self.number_of_ports = 1
+ self.dut_ports = self.dut.get_ports()
+ self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
+ ports = []
+ for port in xrange(self.number_of_ports):
+ ports.append(self.dut_ports[port])
+ self.core_list = self.dut.get_core_list(
+ self.core_config, socket=self.ports_socket)
+ self.core_list_user = self.core_list[0:2]
+ self.core_list_host = self.core_list[2:4]
+ self.port_mask = utils.create_mask(ports)
+ self.core_mask_user = utils.create_mask(self.core_list_user)
+ self.core_mask_host = utils.create_mask(self.core_list_host)
+ if self.dut.cores[len(self.dut.cores) - 1]['socket'] == '0':
+ self.socket_mem = '1024'
+ else:
+ self.socket_mem = '1024,1024'
+ # Don't use any NIC in this test case
+ port_list = self.dut.get_ports()
+ for i in port_list:
+ port = self.dut.ports_info[i]['port']
+ port.bind_driver()
+
+ def set_up(self):
+ """
+ Run before each test case.
+ """
+ # Clean the execution ENV
+ self.dut.send_expect("rm -rf ./vhost.out", "#")
+ self.dut.send_expect("killall -s INT testpmd", "#")
+ self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
+ # Prepare the result table
+ self.table_header = ['Frame']
+ self.table_header.append("Mode")
+ self.table_header.append("Mpps")
+ self.table_header.append("% linerate")
+ self.result_table_create(self.table_header)
+ pass
+
+ def test_perf_vhost_virtiouser_inorder_mergeable_loopback(self):
+ """
+ Benchmark performance for frame_sizes and restart port.
+ """
+ for frame_size in self.frame_sizes:
+ self.result_table_create(self.header_row)
+ # Clean the execution ENV
+ self.dut.send_expect("rm -rf ./vhost.out", "#")
+ self.dut.send_expect("killall -s INT testpmd", "#")
+ self.dut.send_expect("rm -rf ./vhost-net", "#")
+ # Modify TX packet size of the testpmd, then re-compile the DPDK
+ self.dut.send_expect("rm -rf vhost-net*", "#", 30)
+ self.change_testpmd_size = "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN .*$/#define TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
+ self.dut.send_expect(self.change_testpmd_size, "#", 30)
+ self.dut.build_install_dpdk(self.dut.target)
+ # Get the updated TX packet size of the testpmd
+ self.out = self.dut.send_expect("cat app/test-pmd/testpmd.h |grep TXONLY_DEF_PACKET_LEN", "# ")
+ try:
+ search_result = re.search("#define TXONLY_DEF_PACKET_LEN\s*(\d*)", self.out)
+ self.packet_length = search_result.group(1)
+ except:
+ self.logger.error("Failed to capture default testpmd txonly packet length")
+ command_client = "./x86_64-native-linuxapp-gcc/app/testpmd " + \
+ " -n %d -c %s --socket-mem %s " + \
+ " --legacy-mem --file-prefix=vhost " + \
+ " --vdev 'net_vhost0,iface=vhost-net,queues=1' " + \
+ " -- -i --nb-cores=1 --txd=1024 --rxd=1024"
+ command_line_client = command_client % (
+ self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+ self.dut.send_expect(command_line_client, "testpmd> ", 120)
+ self.dut.send_expect("set fwd mac", "testpmd> ", 120)
+ command_line_user = "./x86_64-native-linuxapp-gcc/app/testpmd -n %d -c %s --socket-mem %s " + \
+ "--legacy-mem --no-pci --file-prefix=virtio " + \
+ "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,in_order=1 " + \
+ " -- -i --tx-offloads=0x0 --enable-hw-vlan-strip --txd=1024 --rxd=1024"
+ command_line_user = command_line_user % (
+ self.dut.get_memory_channels(), self.core_mask_user, self.socket_mem)
+ self.vhost_user = self.dut.new_session(suite="user")
+ self.vhost_user.send_expect(command_line_user, "testpmd> ", 120)
+ self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ self.dut.send_expect("set txpkts %s" % frame_size, "testpmd>", 60)
+ self.dut.send_expect("start tx_first 32", "testpmd>", 60)
+ results = 0.0
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ # Get throughput 10 times and calculate the average throughput
+ for i in range(10):
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ #self.test_cycles['Mpps'][frame_size] = Mpps
+ results_row = [frame_size]
+ results_row.append("In_order mergeable PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 0.95")
+ results_row.append("Before Restart")
+ self.result_table_add(results_row)
+ self.vhost_user.send_expect("stop", "testpmd> ", 120)
+ self.vhost_user.send_expect("clear port stats all", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ for i in range(10):
+ out = self.dut.send_expect(
+ "show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ results_row = [frame_size]
+ results_row.append("In_order mergeable PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 0.95")
+ results_row.append("After Restart")
+ self.result_table_add(results_row)
+ self.result_table_print()
+ self.dut.send_expect("quit", "#", 60)
+ self.vhost_user.send_expect("quit", "#", 60)
+
+ def test_perf_vhost_virtiouser_inorder_no_mergeable_loopback(self):
+ """
+ Benchmark performance for frame_sizes and restart port.
+ """
+ for frame_size in self.frame_sizes:
+ self.result_table_create(self.header_row)
+ # Clean the execution ENV
+ self.dut.send_expect("rm -rf ./vhost.out", "#")
+ self.dut.send_expect("killall -s INT testpmd", "#")
+ self.dut.send_expect("rm -rf ./vhost-net", "#")
+ # Modify TX packet size of the testpmd, then re-compile the DPDK
+ self.dut.send_expect("rm -rf vhost-net*", "#", 30)
+ self.change_testpmd_size = "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN .*$/#define TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
+ self.dut.send_expect(self.change_testpmd_size, "#", 30)
+ self.dut.build_install_dpdk(self.dut.target)
+ # Get the updated TX packet size of the testpmd
+ self.out = self.dut.send_expect("cat app/test-pmd/testpmd.h |grep TXONLY_DEF_PACKET_LEN", "# ")
+ try:
+ search_result = re.search("#define TXONLY_DEF_PACKET_LEN\s*(\d*)", self.out)
+ self.packet_length = search_result.group(1)
+ except:
+ self.logger.error("Failed to capture default testpmd txonly packet length")
+ command_client = "./x86_64-native-linuxapp-gcc/app/testpmd " + \
+ " -n %d -c %s --socket-mem %s " + \
+ " --legacy-mem --file-prefix=vhost " + \
+ " --vdev 'net_vhost0,iface=vhost-net,queues=1' " + \
+ " -- -i --nb-cores=1 --txd=1024 --rxd=1024"
+ command_line_client = command_client % (
+ self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+ self.dut.send_expect(command_line_client, "testpmd> ", 120)
+ self.dut.send_expect("set fwd mac", "testpmd> ", 120)
+ command_line_user = "./x86_64-native-linuxapp-gcc/app/testpmd -n %d -c %s --socket-mem %s " + \
+ "--legacy-mem --no-pci --file-prefix=virtio " + \
+ "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,in_order=1,mrg_rxbuf=0 " + \
+ " -- -i --tx-offloads=0x0 --enable-hw-vlan-strip --txd=1024 --rxd=1024"
+ command_line_user = command_line_user % (
+ self.dut.get_memory_channels(), self.core_mask_user, self.socket_mem)
+ self.vhost_user = self.dut.new_session(suite="user")
+ self.vhost_user.send_expect(command_line_user, "testpmd> ", 120)
+ self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ self.dut.send_expect("set txpkts %s" % frame_size, "testpmd>", 60)
+ self.dut.send_expect("start tx_first 32", "testpmd>", 60)
+ results = 0.0
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ # Get throughput 10 times and calculate the average throughput
+ for i in range(10):
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ #self.test_cycles['Mpps'][frame_size] = Mpps
+ results_row = [frame_size]
+ results_row.append("In_order no mergeable PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 0.95")
+ results_row.append("Before Restart")
+ self.result_table_add(results_row)
+ self.vhost_user.send_expect("stop", "testpmd> ", 120)
+ self.vhost_user.send_expect("clear port stats all", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ for i in range(10):
+ out = self.dut.send_expect(
+ "show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ results_row = [frame_size]
+ results_row.append("In_order no mergeable PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 0.95")
+ results_row.append("After Restart")
+ self.result_table_add(results_row)
+ self.result_table_print()
+ self.dut.send_expect("quit", "#", 60)
+ self.vhost_user.send_expect("quit", "#", 60)
+
+ def test_perf_vhost_new_virtiouser_mergeable_loopback(self):
+ """
+ Benchmark performance for frame_sizes and restart port.
+ """
+ for frame_size in self.frame_sizes:
+ self.result_table_create(self.header_row)
+ # Clean the execution ENV
+ self.dut.send_expect("rm -rf ./vhost.out", "#")
+ self.dut.send_expect("killall -s INT testpmd", "#")
+ self.dut.send_expect("rm -rf ./vhost-net", "#")
+ # Modify TX packet size of the testpmd, then re-compile the DPDK
+ self.dut.send_expect("rm -rf vhost-net*", "#", 30)
+ self.change_testpmd_size = "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN .*$/#define TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
+ self.dut.send_expect(self.change_testpmd_size, "#", 30)
+ self.dut.build_install_dpdk(self.dut.target)
+ # Get the updated TX packet size of the testpmd
+ self.out = self.dut.send_expect("cat app/test-pmd/testpmd.h |grep TXONLY_DEF_PACKET_LEN", "# ")
+ try:
+ search_result = re.search("#define TXONLY_DEF_PACKET_LEN\s*(\d*)", self.out)
+ self.packet_length = search_result.group(1)
+ except:
+ self.logger.error("Failed to capture default testpmd txonly packet length")
+ command_client = "./x86_64-native-linuxapp-gcc/app/testpmd " + \
+ " -n %d -c %s --socket-mem %s " + \
+ " --legacy-mem --file-prefix=vhost " + \
+ " --vdev 'net_vhost0,iface=vhost-net,queues=1' " + \
+ " -- -i --nb-cores=1 --txd=1024 --rxd=1024"
+ command_line_client = command_client % (
+ self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+ self.dut.send_expect(command_line_client, "testpmd> ", 120)
+ self.dut.send_expect("set fwd mac", "testpmd> ", 120)
+ command_line_user = "./x86_64-native-linuxapp-gcc/app/testpmd -n %d -c %s --socket-mem %s " + \
+ "--legacy-mem --no-pci --file-prefix=virtio " + \
+ "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,in_order=0,packed_vq=1,mrg_rxbuf=1 " + \
+ " -- -i --tx-offloads=0x0 --enable-hw-vlan-strip --txd=1024 --rxd=1024"
+ command_line_user = command_line_user % (
+ self.dut.get_memory_channels(), self.core_mask_user, self.socket_mem)
+ self.vhost_user = self.dut.new_session(suite="user")
+ self.vhost_user.send_expect(command_line_user, "testpmd> ", 120)
+ self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ self.dut.send_expect("set txpkts %s" % frame_size, "testpmd>", 60)
+ self.dut.send_expect("start tx_first 32", "testpmd>", 60)
+ results = 0.0
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ # Get throughput 10 times and calculate the average throughput
+ for i in range(10):
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ # self.test_cycles['Mpps'][frame_size] = Mpps
+ results_row = [frame_size]
+ results_row.append("Virtio1.1 mergeable PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 1.1")
+ results_row.append("Before Restart")
+ self.result_table_add(results_row)
+ self.vhost_user.send_expect("stop", "testpmd> ", 120)
+ self.vhost_user.send_expect("clear port stats all", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ for i in range(10):
+ out = self.dut.send_expect(
+ "show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ results_row = [frame_size]
+ results_row.append("Virtio1.1 mergeable PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 1.1")
+ results_row.append("After Restart")
+ self.result_table_add(results_row)
+ self.result_table_print()
+ self.dut.send_expect("quit", "#", 60)
+ self.vhost_user.send_expect("quit", "#", 60)
+
+ def test_perf_vhost_new_virtiouser_normal_loopback(self):
+ """
+ Benchmark performance for frame_sizes.
+ """
+ for frame_size in self.frame_sizes:
+ self.result_table_create(self.header_row)
+ # Clean the execution ENV
+ self.dut.send_expect("rm -rf ./vhost.out", "#")
+ self.dut.send_expect("killall -s INT testpmd", "#")
+ self.dut.send_expect("rm -rf ./vhost-net", "#")
+ # Modify TX packet size of the testpmd, then re-compile the DPDK
+ self.dut.send_expect("rm -rf vhost-net*", "#", 30)
+ self.change_testpmd_size = "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN .*$/#define TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
+ self.dut.send_expect(self.change_testpmd_size, "#", 30)
+ self.dut.build_install_dpdk(self.dut.target)
+ # Get the updated TX packet size of the testpmd
+ self.out = self.dut.send_expect("cat app/test-pmd/testpmd.h |grep TXONLY_DEF_PACKET_LEN", "# ")
+ try:
+ search_result = re.search("#define TXONLY_DEF_PACKET_LEN\s*(\d*)", self.out)
+ self.packet_length = search_result.group(1)
+ except:
+ self.logger.error("Failed to capture default testpmd txonly packet length")
+ command_client = "./x86_64-native-linuxapp-gcc/app/testpmd " + \
+ " -n %d -c %s --socket-mem %s " + \
+ " --legacy-mem --file-prefix=vhost " + \
+ " --vdev 'net_vhost0,iface=vhost-net,queues=1' " + \
+ " -- -i --nb-cores=1 --txd=1024 --rxd=1024"
+ command_line_client = command_client % (
+ self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+ self.dut.send_expect(command_line_client, "testpmd> ", 120)
+ self.dut.send_expect("set fwd mac", "testpmd> ", 120)
+ command_line_user = "./x86_64-native-linuxapp-gcc/app/testpmd -n %d -c %s --socket-mem %s " + \
+ "--legacy-mem --no-pci --file-prefix=virtio " + \
+ "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,in_order=0,packed_vq=1,mrg_rxbuf=0 " + \
+ " -- -i --tx-offloads=0x0 --enable-hw-vlan-strip --txd=1024 --rxd=1024"
+ command_line_user = command_line_user % (
+ self.dut.get_memory_channels(), self.core_mask_user, self.socket_mem)
+ self.vhost_user = self.dut.new_session(suite="user")
+ self.vhost_user.send_expect(command_line_user, "testpmd> ", 120)
+ self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ self.dut.send_expect("set txpkts %s" % frame_size, "testpmd>", 60)
+ self.dut.send_expect("start tx_first 32", "testpmd>", 60)
+ results = 0.0
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ # Get throughput 10 times and calculate the average throughput
+ for i in range(10):
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ # self.test_cycles['Mpps'][frame_size] = Mpps
+ results_row = [frame_size]
+ results_row.append("Virtio1.1 normal PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 1.1")
+ results_row.append("Before Restart")
+ self.result_table_add(results_row)
+ self.vhost_user.send_expect("stop", "testpmd> ", 120)
+ self.vhost_user.send_expect("clear port stats all", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ for i in range(10):
+ out = self.dut.send_expect(
+ "show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ results_row = [frame_size]
+ results_row.append("Virtio1.1 normal PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 1.1")
+ results_row.append("After Restart")
+ self.result_table_add(results_row)
+ self.result_table_print()
+ self.dut.send_expect("quit", "#", 60)
+ self.vhost_user.send_expect("quit", "#", 60)
+
+ def test_perf_vhost_virtiouser_mergeable_loopback(self):
+ """
+ Benchmark performance for frame_sizes and restart port.
+ """
+ for frame_size in self.frame_sizes:
+ self.result_table_create(self.header_row)
+ # Clean the execution ENV
+ self.dut.send_expect("rm -rf ./vhost.out", "#")
+ self.dut.send_expect("killall -s INT testpmd", "#")
+ self.dut.send_expect("rm -rf ./vhost-net", "#")
+ # Modify TX packet size of the testpmd, then re-compile the DPDK
+ self.dut.send_expect("rm -rf vhost-net*", "#", 30)
+ self.change_testpmd_size = "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN .*$/#define TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
+ self.dut.send_expect(self.change_testpmd_size, "#", 30)
+ self.dut.build_install_dpdk(self.dut.target)
+ # Get the updated TX packet size of the testpmd
+ self.out = self.dut.send_expect("cat app/test-pmd/testpmd.h |grep TXONLY_DEF_PACKET_LEN", "# ")
+ try:
+ search_result = re.search("#define TXONLY_DEF_PACKET_LEN\s*(\d*)", self.out)
+ self.packet_length = search_result.group(1)
+ except:
+ self.logger.error("Failed to capture default testpmd txonly packet length")
+ command_client = "./x86_64-native-linuxapp-gcc/app/testpmd " + \
+ " -n %d -c %s --socket-mem %s " + \
+ " --legacy-mem --file-prefix=vhost " + \
+ " --vdev 'net_vhost0,iface=vhost-net,queues=1' " + \
+ " -- -i --nb-cores=1 --txd=1024 --rxd=1024"
+ command_line_client = command_client % (
+ self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+ self.dut.send_expect(command_line_client, "testpmd> ", 120)
+ self.dut.send_expect("set fwd mac", "testpmd> ", 120)
+ command_line_user = "./x86_64-native-linuxapp-gcc/app/testpmd -n %d -c %s --socket-mem %s " + \
+ "--legacy-mem --no-pci --file-prefix=virtio " + \
+ "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,in_order=0,mrg_rxbuf=1 " + \
+ " -- -i --tx-offloads=0x0 --enable-hw-vlan-strip --txd=1024 --rxd=1024"
+ command_line_user = command_line_user % (
+ self.dut.get_memory_channels(), self.core_mask_user, self.socket_mem)
+ self.vhost_user = self.dut.new_session(suite="user")
+ self.vhost_user.send_expect(command_line_user, "testpmd> ", 120)
+ self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ self.dut.send_expect("set txpkts %s" % frame_size, "testpmd>", 60)
+ self.dut.send_expect("start tx_first 32", "testpmd>", 60)
+ results = 0.0
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ # Get throughput 10 times and calculate the average throughput
+ for i in range(10):
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ # self.test_cycles['Mpps'][frame_size] = Mpps
+ results_row = [frame_size]
+ results_row.append("Mergeable PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 0.95")
+ results_row.append("Before Restart")
+ self.result_table_add(results_row)
+ self.vhost_user.send_expect("stop", "testpmd> ", 120)
+ self.vhost_user.send_expect("clear port stats all", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ for i in range(10):
+ out = self.dut.send_expect(
+ "show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ results_row = [frame_size]
+ results_row.append("Mergeable PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 0.95")
+ results_row.append("After Restart")
+ self.result_table_add(results_row)
+ self.result_table_print()
+ self.dut.send_expect("quit", "#", 60)
+ self.vhost_user.send_expect("quit", "#", 60)
+
+ def test_perf_vhost_virtiouser_normal_loopback(self):
+ """
+ Benchmark performance for frame_sizes and restart port.
+ """
+ for frame_size in self.frame_sizes:
+ self.result_table_create(self.header_row)
+ # Clean the execution ENV
+ self.dut.send_expect("rm -rf ./vhost.out", "#")
+ self.dut.send_expect("killall -s INT testpmd", "#")
+ self.dut.send_expect("rm -rf ./vhost-net", "#")
+ # Modify TX packet size of the testpmd, then re-compile the DPDK
+ self.dut.send_expect("rm -rf vhost-net*", "#", 30)
+ self.change_testpmd_size = "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN .*$/#define TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
+ self.dut.send_expect(self.change_testpmd_size, "#", 30)
+ self.dut.build_install_dpdk(self.dut.target)
+ # Get the updated TX packet size of the testpmd
+ self.out = self.dut.send_expect("cat app/test-pmd/testpmd.h |grep TXONLY_DEF_PACKET_LEN", "# ")
+ try:
+ search_result = re.search("#define TXONLY_DEF_PACKET_LEN\s*(\d*)", self.out)
+ self.packet_length = search_result.group(1)
+ except:
+ self.logger.error("Failed to capture default testpmd txonly packet length")
+ command_client = "./x86_64-native-linuxapp-gcc/app/testpmd " + \
+ " -n %d -c %s --socket-mem %s " + \
+ " --legacy-mem --file-prefix=vhost " + \
+ " --vdev 'net_vhost0,iface=vhost-net,queues=1' " + \
+ " -- -i --nb-cores=1 --txd=1024 --rxd=1024"
+ command_line_client = command_client % (
+ self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+ self.dut.send_expect(command_line_client, "testpmd> ", 120)
+ self.dut.send_expect("set fwd mac", "testpmd> ", 120)
+ command_line_user = "./x86_64-native-linuxapp-gcc/app/testpmd -n %d -c %s --socket-mem %s " + \
+ "--legacy-mem --no-pci --file-prefix=virtio " + \
+ "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,in_order=0,mrg_rxbuf=0 " + \
+ " -- -i --tx-offloads=0x0 --enable-hw-vlan-strip --txd=1024 --rxd=1024"
+ command_line_user = command_line_user % (
+ self.dut.get_memory_channels(), self.core_mask_user, self.socket_mem)
+ self.vhost_user = self.dut.new_session(suite="user")
+ self.vhost_user.send_expect(command_line_user, "testpmd> ", 120)
+ self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ self.dut.send_expect("set txpkts %s" % frame_size, "testpmd>", 60)
+ self.dut.send_expect("start tx_first 32", "testpmd>", 60)
+ results = 0.0
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ # Get throughput 10 times and calculate the average throughput
+ for i in range(10):
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ # self.test_cycles['Mpps'][frame_size] = Mpps
+ results_row = [frame_size]
+ results_row.append("Normal PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 0.95")
+ results_row.append("Before Restart")
+ self.result_table_add(results_row)
+ self.vhost_user.send_expect("stop", "testpmd> ", 120)
+ self.vhost_user.send_expect("clear port stats all", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ for i in range(10):
+ out = self.dut.send_expect(
+ "show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ results_row = [frame_size]
+ results_row.append("Normal PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 0.95")
+ results_row.append("After Restart")
+ self.result_table_add(results_row)
+ self.result_table_print()
+ self.dut.send_expect("quit", "#", 60)
+ self.vhost_user.send_expect("quit", "#", 60)
+
+ def test_perf_vhost_virtiouser_vector_rx_loopback(self):
+ """
+ Benchmark performance for frame_sizes and restart port.
+ """
+ for frame_size in self.frame_sizes:
+ self.result_table_create(self.header_row)
+ # Clean the execution ENV
+ self.dut.send_expect("rm -rf ./vhost.out", "#")
+ self.dut.send_expect("killall -s INT testpmd", "#")
+ self.dut.send_expect("rm -rf ./vhost-net", "#")
+ # Modify TX packet size of the testpmd, then re-compile the DPDK
+ self.dut.send_expect("rm -rf vhost-net*", "#", 30)
+ self.change_testpmd_size = "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN .*$/#define TXONLY_DEF_PACKET_LEN %d/' ./app/test-pmd/testpmd.h" % frame_size
+ self.dut.send_expect(self.change_testpmd_size, "#", 30)
+ self.dut.build_install_dpdk(self.dut.target)
+ # Get the updated TX packet size of the testpmd
+ self.out = self.dut.send_expect("cat app/test-pmd/testpmd.h |grep TXONLY_DEF_PACKET_LEN", "# ")
+ try:
+ search_result = re.search("#define TXONLY_DEF_PACKET_LEN\s*(\d*)", self.out)
+ self.packet_length = search_result.group(1)
+ except:
+ self.logger.error("Failed to capture default testpmd txonly packet length")
+ command_client = "./x86_64-native-linuxapp-gcc/app/testpmd " + \
+ " -n %d -c %s --socket-mem %s " + \
+ " --legacy-mem --file-prefix=vhost " + \
+ " --vdev 'net_vhost0,iface=vhost-net,queues=1' " + \
+ " -- -i --nb-cores=1 --txd=1024 --rxd=1024"
+ command_line_client = command_client % (
+ self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+ self.dut.send_expect(command_line_client, "testpmd> ", 120)
+ self.dut.send_expect("set fwd mac", "testpmd> ", 120)
+ command_line_user = "./x86_64-native-linuxapp-gcc/app/testpmd -n %d -c %s --socket-mem %s " + \
+ "--legacy-mem --no-pci --file-prefix=virtio " + \
+ "--vdev=net_virtio_user0,mac=00:01:02:03:04:05,path=./vhost-net,in_order=0,mrg_rxbuf=0 " + \
+ " -- -i --tx-offloads=0x0 --txd=1024 --rxd=1024"
+ command_line_user = command_line_user % (
+ self.dut.get_memory_channels(), self.core_mask_user, self.socket_mem)
+ self.vhost_user = self.dut.new_session(suite="user")
+ self.vhost_user.send_expect(command_line_user, "testpmd> ", 120)
+ self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ self.dut.send_expect("set txpkts %s" % frame_size, "testpmd>", 60)
+ self.dut.send_expect("start tx_first 32", "testpmd>", 60)
+ results = 0.0
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ # Get throughput 10 times and calculate the average throughput
+ for i in range(10):
+ out = self.dut.send_expect("show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ # self.test_cycles['Mpps'][frame_size] = Mpps
+ results_row = [frame_size]
+ results_row.append("Vector_RX PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 0.95")
+ results_row.append("Before Restart")
+ self.result_table_add(results_row)
+ self.vhost_user.send_expect("stop", "testpmd> ", 120)
+ self.vhost_user.send_expect("clear port stats all", "testpmd> ", 120)
+ self.vhost_user.send_expect("start", "testpmd> ", 120)
+ for i in range(10):
+ out = self.dut.send_expect(
+ "show port stats all", "testpmd>", 60)
+ time.sleep(5)
+ lines = re.search("Rx-pps:\s*(\d*)", out)
+ result = lines.group(1)
+ results += float(result)
+ Mpps = results / (1000000 * 10)
+ results_row = [frame_size]
+ results_row.append("Vector_RX PATH")
+ results_row.append(Mpps)
+ results_row.append("Virtio 0.95")
+ results_row.append("After Restart")
+ self.result_table_add(results_row)
+ self.result_table_print()
+ self.dut.send_expect("quit", "#", 60)
+ self.vhost_user.send_expect("quit", "#", 60)
+
+ def tear_down(self):
+ """
+ Run after each test case.
+ """
+ # Set the tx packet size of testpmd to default size
+ self.dut.send_expect(
+ "sed -i -e 's/#define TXONLY_DEF_PACKET_LEN.*$/#define TXONLY_DEF_PACKET_LEN %s/' ./app/test-pmd/testpmd.h" % self.packet_length,
+ "#", 30)
+ # Recompile the dpdk because we change the source code during the test
+ self.dut.build_install_dpdk(self.dut.target)
+ time.sleep(2)
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ """
+ # Re-bind the port to config driver
+ port_list = self.dut.get_ports()
+ for i in port_list:
+ port = self.dut.ports_info[i]['port']
+ port.bind_driver(self.drivername)
--
2.17.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-01-10 2:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 19:29 [dts] [PATCH] tests/loopback_multi_paths_port_restart_performance: add test scripts of multi_paths and port_restart with loopback Yinan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).