From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 41530A00E6 for ; Mon, 15 Apr 2019 20:24:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 141BC1B3EC; Mon, 15 Apr 2019 20:24:27 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id B98981B3DA for ; Mon, 15 Apr 2019 20:24:24 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2019 11:24:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,354,1549958400"; d="scan'208";a="131606716" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga007.jf.intel.com with ESMTP; 15 Apr 2019 11:24:23 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 15 Apr 2019 11:24:22 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 15 Apr 2019 11:24:22 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.164]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.93]) with mapi id 14.03.0415.000; Tue, 16 Apr 2019 02:24:20 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] Add testsuite of pvp qemu multi path port restart Thread-Index: AQHU6odNDoyUU8rq30uARIIFTPQj3qY9m8gQ Date: Mon, 15 Apr 2019 18:24:20 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA61A90@SHSMSX101.ccr.corp.intel.com> References: <1554315583-21107-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1554315583-21107-1-git-send-email-lihongx.ma@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTA3NjNkMDEtMWIwNi00NTg5LWJjNjEtNjZiNGM0NmI0ZWJiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibVhPNldOK1krSFQ1Q2pESTNDbG9sdnhnOHlcL3FEak93NjJ2WFgwTVVRWGRCTm81TWxYMzl5M3BwelVhVVJpdmoifQ== x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1] Add testsuite of pvp qemu multi path port restart 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" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong > Sent: Wednesday, April 3, 2019 11:20 AM > To: dts@dpdk.org > Cc: Ma, LihongX > Subject: [dts] [PATCH V1] Add testsuite of pvp qemu multi path port resta= rt >=20 > Signed-off-by: lihong > --- > .../TestSuite_pvp_qemu_multi_paths_port_restart.py | 326 > +++++++++++++++++++++ > 1 file changed, 326 insertions(+) > create mode 100644 > tests/TestSuite_pvp_qemu_multi_paths_port_restart.py >=20 > diff --git a/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py > b/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py > new file mode 100644 > index 0000000..38380ed > --- /dev/null > +++ b/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py > @@ -0,0 +1,326 @@ > +# > +# BSD LICENSE > +# > +# Copyright(c) 2010-2019 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 pvp qemu test with 3 RX/TX PATHs, includes Mergeable, Normal, > +Vector_RX. > +Cover virtio 1.0 and virtio 0.95.Also cover port restart test with each > +path """ > +import utils > +import time > +import re > +from settings import HEADER_SIZE > +from virt_common import VM > +from test_case import TestCase > + > + > +class TestPVPQemuMultiPathPortRestart(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.frame_sizes =3D [64, 128, 256, 512, 1024, 1280, 1518] > + self.core_config =3D "1S/3C/1T" > + self.dut_ports =3D self.dut.get_ports() > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > + # get core mask > + self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) > + self.core_list =3D self.dut.get_core_list( > + self.core_config, socket=3Dself.ports_socket) > + self.core_mask =3D utils.create_mask(self.core_list) > + self.dst_mac =3D self.dut.get_mac_address(self.dut_ports[0]) > + self.vm_dut =3D None > + self.virtio1_mac =3D "52:54:00:00:00:01" > + > + 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 =3D ["FrameSize(B)", "Mode", > + "Throughput(Mpps)", "% linerate", "Cycle"] > + self.result_table_create(self.table_header) > + > + self.vhost =3D self.dut.new_session(suite=3D"vhost-user") > + > + def start_vhost_testpmd(self): > + """ > + start testpmd on vhost > + """ > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + command_client =3D self.dut.target + "/app/testpmd " + \ > + " -n %d -c %s --socket-mem 1024,1024 " + \ > + " --legacy-mem --file-prefix=3Dvhost " + \ > + " --vdev 'net_vhost0,iface=3Dvhost-net,queues= =3D1' " + \ > + " -- -i --nb-cores=3D1 --txd=3D1024 --rxd=3D102= 4" > + command_line_client =3D command_client % ( > + self.dut.get_memory_channels(), self.core_mask) > + 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) > + > + def start_vm_testpmd(self, path): > + """ > + start testpmd in vm depend on different path > + """ > + if path =3D=3D "mergeable": > + command =3D self.dut.target + "/app/testpmd " + \ > + "-c 0x3 -n 3 -- -i " + \ > + "--nb-cores=3D1 --txd=3D1024 --rxd=3D1024" > + elif path =3D=3D "normal": > + command =3D self.dut.target + "/app/testpmd " + \ > + "-c 0x3 -n 3 -- -i " + \ > + "--tx-offloads=3D0x0 --enable-hw-vlan-strip " + \ > + "--nb-cores=3D1 --txd=3D1024 --rxd=3D1024" > + elif path =3D=3D "vector_rx": > + command =3D self.dut.target + "/app/testpmd " + \ > + "-c 0x3 -n 3 -- -i " + \ > + "--nb-cores=3D1 --txd=3D1024 --rxd=3D1024" > + self.vm_dut.send_expect(command, "testpmd> ", 30) > + self.vm_dut.send_expect("set fwd mac", "testpmd> ", 30) > + self.vm_dut.send_expect("start", "testpmd> ", 30) > + > + def start_one_vm(self, modem=3D0, mergeable=3D0): > + """ > + start qemu > + """ > + self.vm =3D VM(self.dut, 'vm0', 'vhost_sample') > + vm_params =3D {} > + vm_params['driver'] =3D 'vhost-user' > + vm_params['opt_path'] =3D './vhost-net' > + vm_params['opt_mac'] =3D self.virtio1_mac > + if modem =3D=3D 1 and mergeable =3D=3D 0: > + vm_params['opt_settings'] =3D "disable- > modern=3Dfalse,mrg_rxbuf=3Doff,rx_queue_size=3D1024,tx_queue_size=3D1024" > + elif modem =3D=3D 1 and mergeable =3D=3D 1: > + vm_params['opt_settings'] =3D "disable- > modern=3Dfalse,mrg_rxbuf=3Don,rx_queue_size=3D1024,tx_queue_size=3D1024" > + elif modem =3D=3D 0 and mergeable =3D=3D 0: > + vm_params['opt_settings'] =3D "disable- > modern=3Dtrue,mrg_rxbuf=3Doff,rx_queue_size=3D1024,tx_queue_size=3D1024" > + elif modem =3D=3D 0 and mergeable =3D=3D 1: > + vm_params['opt_settings'] =3D "disable- > modern=3Dtrue,mrg_rxbuf=3Don,rx_queue_size=3D1024,tx_queue_size=3D1024" > + self.vm.set_vm_device(**vm_params) > + > + try: > + self.vm_dut =3D self.vm.start() > + if self.vm_dut is None: > + raise Exception("Set up VM ENV failed") > + except Exception as e: > + self.logger.error("ERROR: Failure for %s" % str(e)) > + > + def check_port_throughput_after_port_stop(self): > + """ > + check the throughput after port stop > + """ > + loop =3D 1 > + while(loop <=3D 5): > + out =3D self.vhost.send_expect("show port stats 0", "testpmd= >", 60) > + lines =3D re.search("Rx-pps:\s*(\d*)", out) > + result =3D lines.group(1) > + if result =3D=3D "0": > + break > + time.sleep(3) > + loop =3D loop + 1 > + self.verify(result =3D=3D "0", "port stop failed, it alse can > + recevie data after stop.") > + > + def check_port_link_status_after_port_restart(self): > + """ > + check the link status after port restart > + """ > + loop =3D 1 > + while(loop <=3D 5): > + out =3D self.vhost.send_expect("show port info all", "testpm= d> ", 120) > + port_status =3D re.findall("Link\s*status:\s*([a-z]*)", out) > + if("down" not in port_status): > + break > + time.sleep(3) > + loop =3D loop + 1 > + > + self.verify("down" not in port_status, "port can not up after > + restart") > + > + def port_restart(self): > + self.vhost.send_expect("stop", "testpmd> ", 120) > + self.vhost.send_expect("port stop 0", "testpmd> ", 120) > + self.check_port_throughput_after_port_stop() > + self.vhost.send_expect("clear port stats all", "testpmd> ", 120) > + self.vhost.send_expect("port start all", "testpmd> ", 120) > + self.check_port_link_status_after_port_restart() > + self.vhost.send_expect("start", "testpmd> ", 120) > + > + def update_table_info(self, case_info, frame_size, Mpps, throughtput= , > Cycle): > + results_row =3D [frame_size] > + results_row.append(case_info) > + results_row.append(Mpps) > + results_row.append(throughtput) > + results_row.append(Cycle) > + self.result_table_add(results_row) > + > + def calculate_avg_throughput(self, frame_size): > + """ > + start to send packet and get the throughput > + """ > + payload =3D frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip'] > + flow =3D > '[Ether(dst=3D"%s")/IP(src=3D"192.168.4.1",dst=3D"192.168.3.1")/("X"*%d)]= ' % ( > + self.dst_mac, payload) > + self.tester.scapy_append('wrpcap("pvp_multipath.pcap", %s)' % fl= ow) > + self.tester.scapy_execute() > + > + tgenInput =3D [] > + port =3D self.tester.get_local_port(self.dut_ports[0]) > + tgenInput.append((port, port, "pvp_multipath.pcap")) > + _, pps =3D self.tester.traffic_generator_throughput(tgenInput, d= elay=3D30) > + Mpps =3D pps / 1000000.0 > + self.verify(Mpps > 0, "can not receive packets of frame size %d"= % > (frame_size)) > + throughput =3D Mpps * 100 / \ > + float(self.wirespeed(self.nic, frame_size, 1)) > + return Mpps, throughput > + > + def send_and_verify(self, case_info): > + """ > + start to send packets and verify it > + """ > + for frame_size in self.frame_sizes: > + info =3D "Running test %s, and %d frame size." % (self.runni= ng_case, > frame_size) > + self.logger.info(info) > + > + Mpps, throughput =3D self.calculate_avg_throughput(frame_siz= e) > + self.update_table_info(case_info, frame_size, Mpps, > + throughput, "Before Restart") > + > + self.port_restart() > + Mpps, throughput =3D self.calculate_avg_throughput(frame_siz= e) > + self.update_table_info(case_info, frame_size, Mpps, > + throughput, "After Restart") > + > + def close_all_testpmd(self): > + """ > + close testpmd about vhost-user and vm_testpmd > + """ > + self.vhost.send_expect("quit", "#", 60) > + self.vm_dut.send_expect("quit", "#", 60) > + > + def close_session(self): > + """ > + close session of vhost-user > + """ > + self.dut.close_session(self.vhost) > + > + def test_perf_pvp_qemu_mergeable_mac(self): > + """ > + performance for [frame_sizes] and restart port on virtio 0.95 > mergeable path > + """ > + self.start_vhost_testpmd() > + self.start_one_vm(modem=3D0, mergeable=3D1) > + self.start_vm_testpmd(path=3D"mergeable") > + self.send_and_verify("virtio0.95 mergeable") > + self.close_all_testpmd() > + self.result_table_print() > + self.vm.stop() > + > + def test_perf_pvp_qemu_normal_mac(self): > + """ > + performance for [frame_sizes] and restart port ob virtio0.95 nor= mal > path > + """ > + self.start_vhost_testpmd() > + self.start_one_vm(modem=3D0, mergeable=3D0) > + self.start_vm_testpmd(path=3D"normal") > + self.send_and_verify("virtio0.95 normal") > + self.close_all_testpmd() > + self.result_table_print() > + self.vm.stop() > + > + def test_perf_pvp_qemu_vector_rx_mac(self): > + """ > + performance for [frame_sizes] and restart port on virtio0.95 vec= tor_rx > + """ > + self.start_vhost_testpmd() > + self.start_one_vm(modem=3D0, mergeable=3D0) > + self.start_vm_testpmd(path=3D"vector_rx") > + self.send_and_verify("virtio0.95 vector_rx") > + self.close_all_testpmd() > + self.result_table_print() > + self.vm.stop() > + > + def test_perf_pvp_qemu_modern_mergeable_mac(self): > + """ > + performance for [frame_sizes] and restart port on virtio1.0 merg= eable > path > + """ > + self.start_vhost_testpmd() > + self.start_one_vm(modem=3D1, mergeable=3D1) > + self.start_vm_testpmd(path=3D"mergeable") > + self.send_and_verify("virtio1.0 mergeable") > + self.close_all_testpmd() > + self.result_table_print() > + self.vm.stop() > + > + def test_perf_pvp_qemu_modern_normal_path(self): > + """ > + performance for [frame_sizes] and restart port on virito1.0 norm= al > path > + """ > + self.start_vhost_testpmd() > + self.start_one_vm(modem=3D1, mergeable=3D0) > + self.start_vm_testpmd(path=3D"normal") > + self.send_and_verify("virtio1.0 normal") > + self.close_all_testpmd() > + self.result_table_print() > + self.vm.stop() > + > + def test_perf_pvp_qemu_modern_vector_rx_mac(self): > + """ > + performance for frame_sizes and restart port on virtio1.0 vector= rx > + """ > + self.start_vhost_testpmd() > + self.start_one_vm(modem=3D1, mergeable=3D0) > + self.start_vm_testpmd(path=3D"vector_rx") > + self.send_and_verify("virtio1.0 vector_rx") > + self.close_all_testpmd() > + self.result_table_print() > + self.vm.stop() > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > + self.close_session() > + time.sleep(2) > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > -- > 2.7.4