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 2B3B2A0096 for ; Wed, 5 Jun 2019 04:16:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F05FE1B945; Wed, 5 Jun 2019 04:16:56 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 236B12A6A for ; Wed, 5 Jun 2019 04:16:54 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2019 19:16:54 -0700 X-ExtLoop1: 1 Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 04 Jun 2019 19:16:54 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 4 Jun 2019 19:16:53 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.10]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.6]) with mapi id 14.03.0415.000; Wed, 5 Jun 2019 10:16:52 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Wang, Yinan" , "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] tests: add testsuite pvp diff qemu version Thread-Index: AQHVFr8d8oImO/2TdU6ECWVMHt35naaMW/DA Date: Wed, 5 Jun 2019 02:16:51 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BAA0579@SHSMSX101.ccr.corp.intel.com> References: <1559177323-17295-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1559177323-17295-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGE3MWU1ODktYjdhYS00MGQ5LWExZjctNmFhMzRkNDRiZTQ4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUjVPVWRqaVwvWnJaNUo2OXMzam83TFlYb1d5TE5yNTVITlAxMHVreTlvZ2hoZW53TlhhM0RQYWRvTjlZN1wveVBLIn0= 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] tests: add testsuite pvp diff qemu version 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: Thursday, May 30, 2019 8:49 AM > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX > > Subject: [dts] [PATCH V1] tests: add testsuite pvp diff qemu version >=20 > Signed-off-by: lihong > --- > tests/TestSuite_pvp_diff_qemu_version.py | 300 > +++++++++++++++++++++++++++++++ > 1 file changed, 300 insertions(+) > create mode 100644 tests/TestSuite_pvp_diff_qemu_version.py >=20 > diff --git a/tests/TestSuite_pvp_diff_qemu_version.py > b/tests/TestSuite_pvp_diff_qemu_version.py > new file mode 100644 > index 0000000..d238a90 > --- /dev/null > +++ b/tests/TestSuite_pvp_diff_qemu_version.py > @@ -0,0 +1,300 @@ > +# BSD LICENSE > +# > +# Copyright(c) <2019> Intel Corporation. > +# 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. > + > +Vhost PVP performance using differnet Qemu test suite. > +Can config the qemu version in config file like: > +qemu =3D > + path=3Dqemu-2.5/bin/qemu-system-x86_64; > + path=3Dqemu-2.6/bin/qemu-system-x86_64; > +""" > +import re > +import time > +import utils > +from scapy.utils import wrpcap > +from test_case import TestCase > +from settings import HEADER_SIZE > +from virt_common import VM > + > + > +class TestVhostPVPDiffQemuVersion(TestCase): > + def set_up_all(self): > + # Get and verify the ports > + self.dut_ports =3D self.dut.get_ports() > + self.pf =3D self.dut_ports[0] > + # Get the port's socket > + netdev =3D self.dut.ports_info[self.pf]['port'] > + self.socket =3D netdev.get_nic_socket() > + self.cores_num =3D len([n for n in self.dut.cores if int(n['sock= et']) > + =3D=3D self.socket]) > + > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > + self.verify(self.cores_num >=3D 3, > + "There has not enought cores to test this suite") > + self.cores =3D self.dut.get_core_list("1S/3C/1T", socket=3Dself.= socket) > + self.coremask =3D utils.create_mask(self.cores) > + self.memory_channel =3D 4 > + self.vm_dut =3D None > + self.packet_params_set() > + > + self.logger.info("You can config all the path of qemu version yo= u want > to" + \ > + " tested in the conf file %s.cfg" % self.suite_n= ame) > + self.logger.info("You can config packet_size in file %s.cfg," % > self.suite_name + \ > + " in region 'suite' like packet_sizes=3D[64, 128= , 256]") > + res =3D self.verify_qemu_version_config() > + self.verify(res is True, "The path of qemu version in config > + file not right") > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + self.vhost =3D self.dut.new_session(suite=3D"vhost-user") > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("killall -I qemu-system-x86_64", '#', 20) > + > + def packet_params_set(self): > + self.frame_sizes =3D [64, 128, 256, 512, 1024, 1500] > + # get the frame_sizes from cfg file > + if 'packet_sizes' in self.get_suite_cfg(): > + self.frame_sizes =3D self.get_suite_cfg()['packet_sizes'] > + > + self.virtio1_mac =3D "52:54:00:00:00:01" > + self.src1 =3D "192.168.4.1" > + self.dst1 =3D "192.168.3.1" > + self.header_row =3D ["QemuVersion", "FrameSize(B)", > "Throughput(Mpps)", > + "LineRate(%)", "Cycle"] > + > + def get_qemu_list_from_config(self): > + """ > + get the config of qemu path in vm params > + """ > + config_qemu =3D False > + params_num =3D len(self.vm.params) > + for qemu_index in range(params_num): > + if self.vm.params[qemu_index].keys()[0] =3D=3D "qemu": > + qemu_num =3D len(self.vm.params[qemu_index]["qemu"]) > + config_qemu =3D True > + break > + self.verify(config_qemu is True, > + "Please config qemu path which you want to test in conf = gile") > + self.qemu_pos =3D qemu_index > + self.qemu_list =3D self.vm.params[qemu_index]["qemu"] > + > + def verify_qemu_version_config(self): > + """ > + verify the config has config enough qemu version > + """ > + self.vm =3D VM(self.dut, 'vm0', self.suite_name) > + self.vm.load_config() > + # get qemu version list from config file > + self.get_qemu_list_from_config() > + qemu_num =3D len(self.qemu_list) > + for i in range(qemu_num): > + qemu_path =3D self.qemu_list[i]["path"] > + > + out =3D self.dut.send_expect("ls %s" % qemu_path, "#") > + if 'No such file or directory' in out: > + self.logger.error("No emulator [ %s ] on the DUT [ %s ]"= % > + (qemu_path, self.dut.get_ip_address())) > + return False > + out =3D self.dut.send_expect("[ -x %s ];echo $?" % qemu_path= , '# ') > + if out !=3D '0': > + self.logger.error("Emulator [ %s ] not executable on the= DUT > [ %s ]" % > + (qemu_path, self.dut.get_ip_address())) > + return False > + > + out =3D self.dut.send_expect("%s --version" % qemu_path, "#"= ) > + result =3D re.search("QEMU\s*emulator\s*version\s*(\d*.\d*)"= , out) > + version =3D result.group(1) > + # update the version info to self.qemu_list > + self.qemu_list[i].update({"version": "qemu-%s" % version}) > + > + # print all the qemu version you config > + config_qemu_version =3D "" > + for i in range(len(self.qemu_list)): > + config_qemu_version +=3D self.qemu_list[i]["version"] + " " > + self.logger.info("The suite will test the qemu version of: %s" > + % config_qemu_version) > + > + return True > + > + def rm_vm_qemu_path_config(self): > + """ > + According it has config all qemu path, so pop the qemu path info= in > params > + when start the vm set the qemu path info > + """ > + params_num =3D len(self.vm.params) > + for qemu_index in range(params_num): > + if self.vm.params[qemu_index].keys()[0] =3D=3D "qemu": > + qemu_num =3D len(self.vm.params[qemu_index]["qemu"]) > + break > + self.verify(qemu_index < params_num, "Please config qemu path in > conf gile") > + self.vm.params.pop(qemu_index) > + > + def start_vm(self, path, modem): > + """ > + start vm > + """ > + self.vm =3D VM(self.dut, 'vm0', 'pvp_diff_qemu_version') > + 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): > + vm_params['opt_settings'] =3D "disable-modern=3Dfalse,mrg_rx= buf=3Don" > + elif(modem =3D=3D 0): > + vm_params['opt_settings'] =3D "disable-modern=3Dtrue,mrg_rxb= uf=3Don" > + self.vm.set_vm_device(**vm_params) > + self.vm.load_config() > + self.rm_vm_qemu_path_config() > + # set qemu version info > + self.vm.set_qemu_emulator(path) > + # Due to we have change the params info before, > + # so need to start vm with load_config=3DFalse > + try: > + self.vm_dut =3D self.vm.start(load_config=3DFalse) > + 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 start_vhost_testpmd(self): > + """ > + Launch the vhost testpmd > + """ > + command_line_client =3D self.dut.target + "/app/testpmd -n %d -c= %s \ > + --socket-mem 1024,1024 --file-prefix=3Dvhost \ > + --vdev 'eth_vhost0,iface=3Dvhost-net,queues=3D1' -- \ > + -i --nb-cores=3D1 --txd=3D1024 --rxd=3D1024" > + command_line_client =3D command_line_client % ( > + self.memory_channel, self.coremask) > + self.vhost.send_expect(command_line_client, "testpmd> ", 30) > + self.vhost.send_expect("set fwd mac", "testpmd> ", 30) > + self.vhost.send_expect("start", "testpmd> ", 30) > + > + def vm_testpmd_start(self): > + """ > + Start testpmd in vm > + """ > + if self.vm_dut is not None: > + vm_testpmd =3D self.dut.target + "/app/testpmd -c 0x3 -n 3" = \ > + + " -- -i --nb-cores=3D1 --txd=3D1024 --rxd=3D1024" > + self.vm_dut.send_expect(vm_testpmd, "testpmd> ", 20) > + self.vm_dut.send_expect("set fwd mac", "testpmd> ", 20) > + self.vm_dut.send_expect("start", "testpmd> ") > + > + def send_verify(self, qemu_version, vlan_id1=3D0, tag=3D"Performance= "): > + self.result_table_create(self.header_row) > + 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) > + payload =3D frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['i= p'] > + flow =3D > '[Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"%s",dst=3D"%s")/("X"*%d)]'= % ( > + self.virtio1_mac, vlan_id1, self.src1, self.dst1, payloa= d) > + > self.tester.scapy_append('wrpcap("pvp_diff_qemu_version.pcap", %s)' % flo= w) > + self.tester.scapy_execute() > + > + tgenInput =3D [] > + port =3D self.tester.get_local_port(self.pf) > + tgenInput.append((port, port, "pvp_diff_qemu_version.pcap")) > + _, pps =3D self.tester.traffic_generator_throughput( > + tgenInput, delay=3D30) > + Mpps =3D pps / 1000000.0 > + pct =3D Mpps * 100 / float(self.wirespeed(self.nic, frame_si= ze, 1)) > + self.verify(Mpps !=3D 0, "can not received data of frame siz= e %d" % > frame_size) > + # update print table info > + data_row =3D [qemu_version, frame_size, str(Mpps), str(pct),= tag] > + self.result_table_add(data_row) > + > + self.result_table_print() > + > + def close_testpmd_and_qemu(self): > + """ > + stop testpmd in vhost and qemu > + close the qemu > + """ > + self.vm_dut.send_expect("quit", "#", 20) > + self.vhost.send_expect("quit", "#", 20) > + self.vm.stop() > + self.dut.send_expect("killall -I testpmd", '#', 20) > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + > + def test_perf_vhost_pvp_diffrent_qemu_version_mergeable_mac(self): > + """ > + Test the performance of one vm with virtio 0.95 on mergeable pat= h > + """ > + for i in range(len(self.qemu_list)): > + path =3D self.qemu_list[i]["path"] > + version =3D self.qemu_list[i]["version"] > + self.start_vhost_testpmd() > + self.start_vm(path, 0) > + # Start testpmd in vm > + self.vm_testpmd_start() > + self.logger.info("now testing the qemu path of %s" % path) > + time.sleep(5) > + vlan_id1 =3D 1000 > + self.send_verify(version, vlan_id1, "virtio-0.95, Mergeable"= ) > + self.close_testpmd_and_qemu() > + > + def > test_perf_vhost_pvp_diffrent_qemu_version_modern_mergeable_mac(self): > + """ > + Test the performance of one vm with virtio 1.0 on mergeable path > + """ > + for i in range(len(self.qemu_list)): > + path =3D self.qemu_list[i]["path"] > + version =3D self.qemu_list[i]["version"] > + self.start_vhost_testpmd() > + self.start_vm(path, 1) > + # Start testpmd in vm > + self.vm_testpmd_start() > + self.logger.info("now testing the qemu path of %s" % path) > + time.sleep(5) > + vlan_id1 =3D 1000 > + self.send_verify(version, vlan_id1, "virtio-1.0, Mergeable") > + self.close_testpmd_and_qemu() > + > + def tear_down(self): > + """ > + Run after each test case. > + Clear qemu and testpmd to avoid blocking the following TCs > + """ > + self.dut.close_session(self.vhost) > + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > + self.dut.send_expect("killall -s INT testpmd", "#") > + time.sleep(2) > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > -- > 2.7.4