From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 371945B3C for ; Wed, 9 Jan 2019 07:04:25 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2019 22:04:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,456,1539673200"; d="scan'208";a="115309202" Received: from yaolei5.sh.intel.com ([10.67.110.176]) by fmsmga008.fm.intel.com with ESMTP; 08 Jan 2019 22:04:23 -0800 From: Yinan To: dts@dpdk.org Cc: Wang Yinan Date: Tue, 8 Jan 2019 23:02:58 +0000 Message-Id: <20190108230258.14618-1-yinan.wang@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dts] [PATCH] tests/pvp_multi_paths_vhost_max_efficiency: add test scripts of PVP multi-paths for vhost max efficiency X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jan 2019 06:04:27 -0000 From: Wang Yinan test PVP Virtio 1.1 mergeable path with virtio-user test PVP Virtio 1.1 no-mergeable path with virtio-user test PVP In-order mergeable path with virtio-user test PVP In-order no-mergeable path with virtio-user test PVP Mergeable path with virtio-user test PVP Normal path with virtio-user test PVP Vector-RX path with virtio-user Signed-off-by: Wang Yinan --- ...te_pvp_multi_paths_vhost_max_efficiency.py | 530 ++++++++++++++++++ 1 file changed, 530 insertions(+) create mode 100644 tests/TestSuite_pvp_multi_paths_vhost_max_efficiency.py diff --git a/tests/TestSuite_pvp_multi_paths_vhost_max_efficiency.py b/tests/TestSuite_pvp_multi_paths_vhost_max_efficiency.py new file mode 100644 index 0000000..6fe4044 --- /dev/null +++ b/tests/TestSuite_pvp_multi_paths_vhost_max_efficiency.py @@ -0,0 +1,530 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 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. +Test PVP vhost performance using virtio_user on 7 tx/rx path. +""" + +import dts +import utils +import rst +from test_case import TestCase +from settings import HEADER_SIZE + + +class TestPVPVhostPerformance(TestCase): + + def set_up_all(self): + """ + Run at the start of each test suite. + """ + self.frame_sizes = [64, 128, 256, 512, 1024, 1518] + self.test_cycles = {'Mpps': {}, 'pct': {}} + self.core_config = "1S/4C/1T" + self.number_of_ports = 1 + self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + \ + HEADER_SIZE['udp'] + 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' + + 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_pvp_virtiouser_inorder_mergeable_mac(self): + """ + Benchmark performance for Vhost PVP In_order mergeable Path. + """ + for frame_size in self.frame_sizes: + self.dut.send_expect("rm -rf ./vhost.out", "#") + self.dut.send_expect("killall -s INT testpmd", "#") + self.dut.send_expect("rm -rf ./vhost-net", "#") + payload_size = frame_size - self.headers_size + command_line_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,client=0' " + \ + " -- -i --txd=1024 --rxd=1024" + command_line_client = command_line_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) + self.dut.send_expect("start", "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) + tgen_input = [] + for port in xrange(self.number_of_ports): + rx_port = self.tester.get_local_port( + self.dut_ports[port % self.number_of_ports]) + tx_port = self.tester.get_local_port( + self.dut_ports[(port) % self.number_of_ports]) + destination_mac = self.dut.get_mac_address( + self.dut_ports[(port) % self.number_of_ports]) + self.tester.scapy_append( + 'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % + (port, destination_mac, payload_size)) + tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port)) + self.tester.scapy_execute() + _, pps = self.tester.traffic_generator_throughput(tgen_input) + Mpps = pps / 1000000.0 + self.verify(Mpps > 0, "Mpps is 0") + throughput = Mpps * 100 / \ + float(self.wirespeed(self.nic, frame_size, self.number_of_ports)) + self.dut.send_expect("quit", "#", 60) + self.vhost_user.send_expect("quit", "#", 60) + self.dut.close_session(self.vhost_user) + self.test_cycles['Mpps'][frame_size] = Mpps + self.test_cycles['pct'][frame_size] = throughput + # Prepare the results for table + for frame_size in self.frame_sizes: + results_row = [frame_size] + results_row.append("Mergeable on") + results_row.append(self.test_cycles['Mpps'][frame_size]) + results_row.append(self.test_cycles['pct'][frame_size]) + self.result_table_add(results_row) + self.result_table_print() + + def test_perf_vhost_pvp_virtiouser_inorder_no_mergeable_mac(self): + """ + Benchmark performance for Vhost PVP In_order no_mergeable Path. + """ + for frame_size in self.frame_sizes: + self.dut.send_expect("rm -rf ./vhost.out", "#") + self.dut.send_expect("killall -s INT testpmd", "#") + self.dut.send_expect("rm -rf ./vhost-net", "#") + payload_size = frame_size - self.headers_size + command_line_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,client=0' " + \ + " -- -i --txd=1024 --rxd=1024" + command_line_client = command_line_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) + self.dut.send_expect("start", "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) + tgen_input = [] + for port in xrange(self.number_of_ports): + rx_port = self.tester.get_local_port( + self.dut_ports[port % self.number_of_ports]) + tx_port = self.tester.get_local_port( + self.dut_ports[(port) % self.number_of_ports]) + destination_mac = self.dut.get_mac_address( + self.dut_ports[(port) % self.number_of_ports]) + self.tester.scapy_append( + 'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % + (port, destination_mac, payload_size)) + tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port)) + self.tester.scapy_execute() + _, pps = self.tester.traffic_generator_throughput(tgen_input) + Mpps = pps / 1000000.0 + self.verify(Mpps > 0, "Mpps is 0") + throughput = Mpps * 100 / \ + float(self.wirespeed(self.nic, frame_size, self.number_of_ports)) + self.dut.send_expect("quit", "#", 60) + self.vhost_user.send_expect("quit", "#", 60) + self.dut.close_session(self.vhost_user) + self.test_cycles['Mpps'][frame_size] = Mpps + self.test_cycles['pct'][frame_size] = throughput + # Prepare the results for table + for frame_size in self.frame_sizes: + results_row = [frame_size] + results_row.append("Mergeable on") + results_row.append(self.test_cycles['Mpps'][frame_size]) + results_row.append(self.test_cycles['pct'][frame_size]) + self.result_table_add(results_row) + self.result_table_print() + + def test_perf_vhost_pvp_virtiouser_mergeable_mac(self): + """ + Benchmark performance for Vhost PVP Mergeable Path. + """ + + for frame_size in self.frame_sizes: + self.dut.send_expect("rm -rf ./vhost.out", "#") + self.dut.send_expect("killall -s INT testpmd", "#") + self.dut.send_expect("rm -rf ./vhost-net", "#") + payload_size = frame_size - self.headers_size + command_line_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,client=0' -- -i --txd=1024 --rxd=1024" + command_line_client = command_line_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) + self.dut.send_expect("start", "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 " + \ + "-- -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) + tgen_input = [] + for port in xrange(self.number_of_ports): + rx_port = self.tester.get_local_port( + self.dut_ports[port % self.number_of_ports]) + tx_port = self.tester.get_local_port( + self.dut_ports[(port) % self.number_of_ports]) + destination_mac = self.dut.get_mac_address( + self.dut_ports[(port) % self.number_of_ports]) + self.tester.scapy_append( + 'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % + (port, destination_mac, payload_size)) + tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port)) + self.tester.scapy_execute() + _, pps = self.tester.traffic_generator_throughput(tgen_input) + Mpps = pps / 1000000.0 + self.verify(Mpps > 0, "Mpps is 0") + throughput = Mpps * 100 / \ + float(self.wirespeed(self.nic, frame_size, self.number_of_ports)) + self.dut.send_expect("quit", "#", 60) + self.vhost_user.send_expect("quit", "#", 60) + self.dut.close_session(self.vhost_user) + self.test_cycles['Mpps'][frame_size] = Mpps + self.test_cycles['pct'][frame_size] = throughput + # Prepare the results for table + for frame_size in self.frame_sizes: + results_row = [frame_size] + results_row.append("Mergeable on") + results_row.append(self.test_cycles['Mpps'][frame_size]) + results_row.append(self.test_cycles['pct'][frame_size]) + self.result_table_add(results_row) + self.result_table_print() + + def test_perf_vhost_pvp_new_virtiouser_mergeable_mac(self): + """ + Benchmark performance for Vhost PVP virtio 1.1 Mergeable Path. + """ + + for frame_size in self.frame_sizes: + self.dut.send_expect("rm -rf ./vhost.out", "#") + self.dut.send_expect("killall -s INT testpmd", "#") + self.dut.send_expect("rm -rf ./vhost-net", "#") + payload_size = frame_size - self.headers_size + command_line_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,client=0' -- -i --txd=1024 --rxd=1024" + command_line_client = command_line_client % ( + self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem) + #self.dut.send_expect("cd /root/dpdk", "#", 120) + self.dut.send_expect(command_line_client, "testpmd> ", 120) + self.dut.send_expect("set fwd mac", "testpmd> ", 120) + self.dut.send_expect("start", "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("cd /root/dpdk", "#", 120) + 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) + tgen_input = [] + for port in xrange(self.number_of_ports): + rx_port = self.tester.get_local_port( + self.dut_ports[port % self.number_of_ports]) + tx_port = self.tester.get_local_port( + self.dut_ports[(port) % self.number_of_ports]) + destination_mac = self.dut.get_mac_address( + self.dut_ports[(port) % self.number_of_ports]) + self.tester.scapy_append( + 'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % + (port, destination_mac, payload_size)) + + tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port)) + + self.tester.scapy_execute() + _, pps = self.tester.traffic_generator_throughput(tgen_input) + Mpps = pps / 1000000.0 + self.verify(Mpps > 0, "Mpps is 0") + + throughput = Mpps * 100 / \ + float(self.wirespeed(self.nic, frame_size, self.number_of_ports)) + self.dut.send_expect("quit", "#", 60) + self.vhost_user.send_expect("quit", "#", 60) + self.dut.close_session(self.vhost_user) + self.test_cycles['Mpps'][frame_size] = Mpps + self.test_cycles['pct'][frame_size] = throughput + + # Prepare the results for table + for frame_size in self.frame_sizes: + results_row = [frame_size] + results_row.append("Mergeable on") + results_row.append(self.test_cycles['Mpps'][frame_size]) + results_row.append(self.test_cycles['pct'][frame_size]) + self.result_table_add(results_row) + self.result_table_print() + + + def test_perf_vhost_pvp_virtiouser_vector_rx_mac(self): + """ + Benchmark performance for Vhost PVP Vector Path + """ + for frame_size in self.frame_sizes: + self.dut.send_expect("rm -rf ./vhost.out", "#") + self.dut.send_expect("killall -s INT testpmd", "#") + self.dut.send_expect("rm -rf ./vhost-net", "#") + command_line_vhost = "./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,client=0' -- -i --txd=1024 --rxd=1024" + command_line_vhost = command_line_vhost % ( + self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem) + self.dut.send_expect(command_line_vhost, "testpmd> ", 120) + self.dut.send_expect("set fwd mac", "testpmd> ", 120) + self.dut.send_expect("start", "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) + payload_size = frame_size - self.headers_size + tgen_input = [] + for port in xrange(self.number_of_ports): + rx_port = self.tester.get_local_port( + self.dut_ports[port % self.number_of_ports]) + tx_port = self.tester.get_local_port( + self.dut_ports[(port) % self.number_of_ports]) + destination_mac = self.dut.get_mac_address( + self.dut_ports[(port) % self.number_of_ports]) + self.tester.scapy_append( + 'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % + (port, destination_mac, payload_size)) + tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port)) + self.tester.scapy_execute() + _, pps = self.tester.traffic_generator_throughput(tgen_input) + Mpps = pps / 1000000.0 + self.verify(Mpps > 0, "Mpps is 0") + throughput = Mpps * 100 / \ + float(self.wirespeed(self.nic, frame_size, self.number_of_ports)) + print "the linespeed of packet size %d is %d " % ( + frame_size, throughput) + self.dut.send_expect("quit", "#", 60) + self.vhost_user.send_expect("quit", "#", 60) + self.dut.close_session(self.vhost_user) + self.test_cycles['Mpps'][frame_size] = Mpps + self.test_cycles['pct'][frame_size] = throughput + # Prepare the results for table + for frame_size in self.frame_sizes: + results_row = [frame_size] + results_row.append("Vector RX") + results_row.append(self.test_cycles['Mpps'][frame_size]) + results_row.append(self.test_cycles['pct'][frame_size]) + self.result_table_add(results_row) + self.result_table_print() + + def test_perf_vhost_pvp_virtiouser_normal_mac(self): + """ + Benchmark performance for Vhost PVP Normal Path. + """ + + for frame_size in self.frame_sizes: + self.dut.send_expect("rm -rf ./vhost.out", "#") + self.dut.send_expect("killall -s INT testpmd", "#") + self.dut.send_expect("rm -rf ./vhost-net", "#") + command_line_vhost = "./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,client=0' -- -i --txd=1024 --rxd=1024" + command_line_vhost = command_line_vhost % ( + self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem) + self.dut.send_expect(command_line_vhost, "testpmd> ", 120) + self.dut.send_expect("set fwd mac", "testpmd> ", 120) + self.dut.send_expect("start", "testpmd> ", 120) + command_line_virtio = "./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_virtio = command_line_virtio % ( + 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_virtio, "testpmd> ", 120) + self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120) + self.vhost_user.send_expect("start", "testpmd> ", 120) + payload_size = frame_size - self.headers_size + tgen_input = [] + for port in xrange(self.number_of_ports): + rx_port = self.tester.get_local_port( + self.dut_ports[port % self.number_of_ports]) + tx_port = self.tester.get_local_port( + self.dut_ports[(port) % self.number_of_ports]) + destination_mac = self.dut.get_mac_address( + self.dut_ports[(port) % self.number_of_ports]) + self.tester.scapy_append( + 'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % + (port, destination_mac, payload_size)) + tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port)) + self.tester.scapy_execute() + _, pps = self.tester.traffic_generator_throughput(tgen_input) + Mpps = pps / 1000000.0 + self.verify(Mpps > 0, "Mpps is 0") + throughput = Mpps * 100 / \ + float(self.wirespeed(self.nic, frame_size, self.number_of_ports)) + self.dut.send_expect("quit", "#", 60) + self.vhost_user.send_expect("quit", "#", 60) + self.dut.close_session(self.vhost_user) + self.test_cycles['Mpps'][frame_size] = Mpps + self.test_cycles['pct'][frame_size] = throughput + # Prepare the results for table + for frame_size in self.frame_sizes: + results_row = [frame_size] + results_row.append("Normal") + results_row.append(self.test_cycles['Mpps'][frame_size]) + results_row.append(self.test_cycles['pct'][frame_size]) + self.result_table_add(results_row) + self.result_table_print() + + def test_perf_vhost_pvp_new_virtiouser_normal_mac(self): + """ + Benchmark performance for Vhost PVP virtio1.1 Normal Path. + """ + for frame_size in self.frame_sizes: + self.dut.send_expect("rm -rf ./vhost.out", "#") + self.dut.send_expect("killall -s INT testpmd", "#") + self.dut.send_expect("rm -rf ./vhost-net", "#") + command_line_vhost = "./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,client=0' -- -i --txd=1024 --rxd=1024" + command_line_vhost = command_line_vhost % ( + self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem) + self.dut.send_expect(command_line_vhost, "testpmd> ", 120) + self.dut.send_expect("set fwd mac", "testpmd> ", 120) + self.dut.send_expect("start", "testpmd> ", 120) + command_line_virtio = "./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,packed_vq=1,in_order=0,mrg_rxbuf=0 " + \ + "-- -i --tx-offloads=0x0 --enable-hw-vlan-strip --txd=1024 --rxd=1024" + command_line_virtio = command_line_virtio % ( + 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_virtio, "testpmd> ", 120) + self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120) + self.vhost_user.send_expect("start", "testpmd> ", 120) + payload_size = frame_size - self.headers_size + tgen_input = [] + for port in xrange(self.number_of_ports): + rx_port = self.tester.get_local_port( + self.dut_ports[port % self.number_of_ports]) + tx_port = self.tester.get_local_port( + self.dut_ports[(port) % self.number_of_ports]) + destination_mac = self.dut.get_mac_address( + self.dut_ports[(port) % self.number_of_ports]) + self.tester.scapy_append( + 'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % + (port, destination_mac, payload_size)) + tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port)) + self.tester.scapy_execute() + _, pps = self.tester.traffic_generator_throughput(tgen_input) + Mpps = pps / 1000000.0 + self.verify(Mpps > 0, "Mpps is 0") + throughput = Mpps * 100 / \ + float(self.wirespeed(self.nic, frame_size, self.number_of_ports)) + self.dut.send_expect("quit", "#", 60) + self.vhost_user.send_expect("quit", "#", 60) + self.dut.close_session(self.vhost_user) + self.test_cycles['Mpps'][frame_size] = Mpps + self.test_cycles['pct'][frame_size] = throughput + + # Prepare the results for table + for frame_size in self.frame_sizes: + results_row = [frame_size] + results_row.append("Normal") + results_row.append(self.test_cycles['Mpps'][frame_size]) + results_row.append(self.test_cycles['pct'][frame_size]) + self.result_table_add(results_row) + self.result_table_print() + + def tear_down(self): + """ + Run after each test case. + """ + pass + + def tear_down_all(self): + """ + Run after each test suite. + """ + 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