From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DD897A0471 for ; Tue, 13 Aug 2019 09:07:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A451F1B94A; Tue, 13 Aug 2019 09:07:39 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id A2F77DE3 for ; Tue, 13 Aug 2019 09:07:37 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Aug 2019 00:07:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,380,1559545200"; d="scan'208";a="181104313" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.119.68]) by orsmga006.jf.intel.com with ESMTP; 13 Aug 2019 00:07:34 -0700 From: lihong To: dts@dpdk.org Cc: lihong Date: Tue, 13 Aug 2019 07:44:26 +0800 Message-Id: <1565653466-31770-1-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V1] tests/pvp_multi_paths: update code to support trex 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Signed-off-by: lihong --- tests/TestSuite_pvp_multi_paths_performance.py | 37 ++++++++++++++-------- ...vp_multi_paths_vhost_single_core_performance.py | 31 +++++++++++------- ...p_multi_paths_virtio_single_core_performance.py | 36 +++++++++++++-------- 3 files changed, 65 insertions(+), 39 deletions(-) diff --git a/tests/TestSuite_pvp_multi_paths_performance.py b/tests/TestSuite_pvp_multi_paths_performance.py index 071b2c6..b633b98 100644 --- a/tests/TestSuite_pvp_multi_paths_performance.py +++ b/tests/TestSuite_pvp_multi_paths_performance.py @@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2019 Intel Corporation. All rights reserved. +# Copyright(c) <2019> Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -36,7 +36,8 @@ Test PVP performance using virtio_user on 8 tx/rx path. import utils from test_case import TestCase -from settings import HEADER_SIZE +from packet import Packet, save_packets +from pktgen import PacketGeneratorHelper class TestPVPMultiPathPerformance(TestCase): @@ -48,8 +49,6 @@ class TestPVPMultiPathPerformance(TestCase): self.frame_sizes = [64, 128, 256, 512, 1024, 1518] 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.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing") self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) @@ -59,11 +58,18 @@ class TestPVPMultiPathPerformance(TestCase): self.core_list_host = self.core_list[2:4] 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': + if len(set([int(core['socket']) for core in self.dut.cores])) == 1: self.socket_mem = '1024' else: self.socket_mem = '1024,1024' + self.out_path = '/tmp' + out = self.tester.send_expect('ls -d %s' % self.out_path, '# ') + if 'No such file or directory' in out: + self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') + # create an instance to set stream field setting + self.pktgen_helper = PacketGeneratorHelper() + def set_up(self): """ Run before each test case. @@ -81,7 +87,6 @@ class TestPVPMultiPathPerformance(TestCase): """ Send packet with packet generator and verify """ - payload_size = frame_size - self.headers_size tgen_input = [] for port in xrange(self.number_of_ports): rx_port = self.tester.get_local_port( @@ -90,14 +95,17 @@ class TestPVPMultiPathPerformance(TestCase): 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)) + pkt = Packet(pkt_type='UDP', pkt_len=frame_size) + pkt.config_layer('ether', {'dst': '%s' % destination_mac}) + save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path, port)) + tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap" % (self.out_path, port))) - self.tester.scapy_execute() - _, pps = self.tester.traffic_generator_throughput(tgen_input) + self.tester.pktgen.clear_streams() + streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen) + # set traffic option + traffic_opt = {'delay': 5} + _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt) Mpps = pps / 1000000.0 self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size)) @@ -119,10 +127,11 @@ class TestPVPMultiPathPerformance(TestCase): self.dut.send_expect("killall -s INT testpmd", "#") self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") command_line_client = "./%s/app/testpmd -n %d -c %s --socket-mem " + \ - " %s --legacy-mem --file-prefix=vhost --vdev " + \ + " %s --legacy-mem -w %s --file-prefix=vhost --vdev " + \ "'net_vhost0,iface=vhost-net,queues=1,client=0' -- -i --nb-cores=1 --txd=1024 --rxd=1024" command_line_client = command_line_client % (self.target, - self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem) + self.dut.get_memory_channels(), self.core_mask_host, + self.socket_mem, self.dut.ports_info[self.dut_ports[0]]['pci']) self.vhost.send_expect(command_line_client, "testpmd> ", 120) self.vhost.send_expect("set fwd mac", "testpmd> ", 120) self.vhost.send_expect("start", "testpmd> ", 120) diff --git a/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py b/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py index 8d94491..fcaadf2 100644 --- a/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py +++ b/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py @@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2019 Intel Corporation. All rights reserved. +# Copyright(c) <2019> Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -36,7 +36,8 @@ Test PVP vhost single core performance using virtio_user on 8 tx/rx path. import utils from test_case import TestCase -from settings import HEADER_SIZE +from packet import Packet, save_packets +from pktgen import PacketGeneratorHelper class TestPVPMultiPathVhostPerformance(TestCase): @@ -48,8 +49,6 @@ class TestPVPMultiPathVhostPerformance(TestCase): self.frame_sizes = [64, 128, 256, 512, 1024, 1518] self.core_config = "1S/5C/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]) self.core_list = self.dut.get_core_list( @@ -58,11 +57,18 @@ class TestPVPMultiPathVhostPerformance(TestCase): self.core_list_host = self.core_list[3:5] 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': + if len(set([int(core['socket']) for core in self.dut.cores])) == 1: self.socket_mem = '1024' else: self.socket_mem = '1024,1024' + self.out_path = '/tmp' + out = self.tester.send_expect('ls -d %s' % self.out_path, '# ') + if 'No such file or directory' in out: + self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') + # create an instance to set stream field setting + self.pktgen_helper = PacketGeneratorHelper() + def set_up(self): """ Run before each test case. @@ -78,7 +84,6 @@ class TestPVPMultiPathVhostPerformance(TestCase): """ Send packet with packet generator and verify """ - payload_size = frame_size - self.headers_size tgen_input = [] for port in xrange(self.number_of_ports): rx_port = self.tester.get_local_port( @@ -87,14 +92,16 @@ class TestPVPMultiPathVhostPerformance(TestCase): 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)) + pkt = Packet(pkt_type='UDP', pkt_len=frame_size) + pkt.config_layer('ether', {'dst': '%s' % destination_mac}) + save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path, port)) + tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap" % (self.out_path, port))) - self.tester.scapy_execute() - _, pps = self.tester.traffic_generator_throughput(tgen_input) + self.tester.pktgen.clear_streams() + streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen) + traffic_opt = {'delay': 5} + _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt) Mpps = pps / 1000000.0 self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size)) diff --git a/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py b/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py index 32f5171..6cd3a6d 100644 --- a/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py +++ b/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py @@ -36,7 +36,8 @@ Test PVP virtio single core performance using virtio_user on 8 tx/rx path. import utils from test_case import TestCase -from settings import HEADER_SIZE +from packet import Packet, save_packets +from pktgen import PacketGeneratorHelper class TestPVPMultiPathVirtioPerformance(TestCase): @@ -48,8 +49,6 @@ class TestPVPMultiPathVirtioPerformance(TestCase): self.frame_sizes = [64, 128, 256, 512, 1024, 1518] self.core_config = "1S/5C/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.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing") self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) @@ -59,11 +58,18 @@ class TestPVPMultiPathVirtioPerformance(TestCase): self.core_list_host = self.core_list[2:5] 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': + if len(set([int(core['socket']) for core in self.dut.cores])) == 1: self.socket_mem = '1024' else: self.socket_mem = '1024,1024' + self.out_path = '/tmp' + out = self.tester.send_expect('ls -d %s' % self.out_path, '# ') + if 'No such file or directory' in out: + self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') + # create an instance to set stream field setting + self.pktgen_helper = PacketGeneratorHelper() + def set_up(self): """ Run before each test case. @@ -81,7 +87,6 @@ class TestPVPMultiPathVirtioPerformance(TestCase): """ Send packet with packet generator and verify """ - payload_size = frame_size - self.headers_size tgen_input = [] for port in xrange(self.number_of_ports): rx_port = self.tester.get_local_port( @@ -90,14 +95,18 @@ class TestPVPMultiPathVirtioPerformance(TestCase): 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)) + pkt = Packet(pkt_type='UDP', pkt_len=frame_size) + pkt.config_layer('ether', {'dst': '%s' % destination_mac}) + save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path, port)) + + tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap" % (self.out_path, port))) - self.tester.scapy_execute() - _, pps = self.tester.traffic_generator_throughput(tgen_input) + self.tester.pktgen.clear_streams() + streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen) + # set traffic option + traffic_opt = {'delay': 5} + _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt) Mpps = pps / 1000000.0 self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size)) @@ -119,10 +128,11 @@ class TestPVPMultiPathVirtioPerformance(TestCase): self.dut.send_expect("killall -s INT testpmd", "#") self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") command_line_client = "./%s/app/testpmd -n %d -c %s --socket-mem " + \ - " %s --legacy-mem --file-prefix=vhost --vdev " + \ + " %s --legacy-mem -w %s --file-prefix=vhost --vdev " + \ "'net_vhost0,iface=vhost-net,queues=1,client=0' -- -i --nb-cores=2 --txd=1024 --rxd=1024" command_line_client = command_line_client % (self.target, - self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem) + self.dut.get_memory_channels(), self.core_mask_host, + self.socket_mem, self.dut.ports_info[self.dut_ports[0]]['pci']) self.vhost.send_expect(command_line_client, "testpmd> ", 120) self.vhost.send_expect("set fwd io", "testpmd> ", 120) self.vhost.send_expect("start", "testpmd> ", 120) -- 2.7.4