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 3C42FA05D3 for ; Mon, 20 May 2019 03:07:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2A89728F3; Mon, 20 May 2019 03:07:59 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id BFB54A49 for ; Mon, 20 May 2019 03:07:56 +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 orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 May 2019 18:07:55 -0700 X-ExtLoop1: 1 Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga006.jf.intel.com with ESMTP; 19 May 2019 18:07:55 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 19 May 2019 18:07:55 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 19 May 2019 18:07:54 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.33]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.216]) with mapi id 14.03.0415.000; Mon, 20 May 2019 09:07:52 +0800 From: "Wang, Yinan" To: "Ma, LihongX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V1] Add testsuite vm2vm virtio pmd Thread-Index: AQHVDFSzsgHCnqZQj06+oeAS09j9AqZzODQQ Date: Mon, 20 May 2019 01:07:52 +0000 Message-ID: References: <1558032169-22989-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1558032169-22989-1-git-send-email-lihongx.ma@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzkzZjMzMzMtMGE5OS00ZWI5LTk0MDgtNDk2MTNhODg5MDhmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUHpKano4UDhmMXp3ZmVETTVzNW9GaUdkdGxlenorUktEN1JpU2QrWmpoY3VhTWVJM1RxTWk3MnFpUmlUa2VkTyJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1] Add testsuite vm2vm virtio pmd 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" Acked-by: Wang, Yinan > -----Original Message----- > From: Ma, LihongX > Sent: 2019=1B$BG/=1B(B5=1B$B7n=1B(B17=1B$BF|=1B(B 2:43 > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX > > Subject: [dts][PATCH V1] Add testsuite vm2vm virtio pmd >=20 > Signed-off-by: lihong > --- > tests/TestSuite_vm2vm_virtio_pmd.py | 239 > ++++++++++++++++++++++++++++++++++++ > 1 file changed, 239 insertions(+) > create mode 100644 tests/TestSuite_vm2vm_virtio_pmd.py >=20 > diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py > b/tests/TestSuite_vm2vm_virtio_pmd.py > new file mode 100644 > index 0000000..9a62ac8 > --- /dev/null > +++ b/tests/TestSuite_vm2vm_virtio_pmd.py > @@ -0,0 +1,239 @@ > +# 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. > + > +Test cases for Vhost-user/Virtio-pmd VM2VM """ > +import re > +import time > +import utils > +from virt_common import VM > +from test_case import TestCase > + > + > +class TestVM2VMVirtioPMD(TestCase): > + def set_up_all(self): > + self.core_config =3D "1S/4C/1T" > + self.cores_num =3D len([n for n in self.dut.cores if int(n['sock= et']) > + =3D=3D 0]) > + self.verify(self.cores_num >=3D 4, > + "There has not enough cores to test this suite %s" % > + self.suite_name) > + self.cores =3D self.dut.get_core_list(self.core_config) > + self.coremask =3D utils.create_mask(self.cores) > + self.memory_channel =3D self.dut.get_memory_channels() > + self.vm_num =3D 2 > + > + def set_up(self): > + """ > + run before each test case. > + """ > + self.table_header =3D ["FrameSize(B)", "Mode", > + "Throughput(Mpps)", "Path"] > + self.result_table_create(self.table_header) > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + self.vhost =3D self.dut.new_session(suite=3D"vhost") > + self.vm_dut =3D [] > + self.vm =3D [] > + > + def start_vhost_testpmd(self): > + """ > + launch the testpmd on vhost side > + """ > + self.command_line =3D self.dut.target + "/app/testpmd -c %s -n %= d " + > \ > + "--socket-mem 2048,2048 --legacy-mem --no-pci > --file-prefix=3Dvhost " + \ > + "--vdev 'net_vhost0,iface=3Dvhost-net0,queues=3D1' " + \ > + "--vdev 'net_vhost1,iface=3Dvhost-net1,queues=3D1' " + \ > + "-- -i --nb-cores=3D1 --txd=3D1024 --rxd=3D1024" > + > + self.command_line =3D self.command_line % ( > + self.coremask, self.memory_channel) > + self.vhost.send_expect(self.command_line, "testpmd> ", 30) > + self.vhost.send_expect("set fwd mac", "testpmd> ", 30) > + self.vhost.send_expect("start", "testpmd> ", 30) > + > + def start_vm_testpmd(self, vm_client, path_mode): > + """ > + launch the testpmd in vm > + """ > + if path_mode =3D=3D "mergeable": > + command =3D self.dut.target + "/app/testpmd " + \ > + "-c 0x3 -n 4 -- -i --tx-offloads=3D0x00 " + \ > + "--enable-hw-vlan-strip --txd=3D1024 --rxd=3D102= 4" > + elif path_mode =3D=3D "normal": > + command =3D self.dut.target + "/app/testpmd " + \ > + "-c 0x3 -n 4 -- -i --tx-offloads=3D0x00 " + \ > + "--enable-hw-vlan-strip --txd=3D1024 --rxd=3D102= 4" > + elif path_mode =3D=3D "vector_rx": > + command =3D self.dut.target + "/app/testpmd " + \ > + "-c 0x3 -n 4 -- -i --txd=3D1024 --rxd=3D1024" > + vm_client.send_expect(command, "testpmd> ", 20) > + > + def start_vms(self, mode=3D0, mergeable=3DTrue): > + """ > + start two VM, each VM has one virtio device > + """ > + # for virtio 0.95, start vm with "disable-modern=3Dtrue" > + # for virito 1.0, start vm with "disable-modern=3Dfalse" > + if mode =3D=3D 0: > + setting_args =3D "disable-modern=3Dtrue" > + else: > + setting_args =3D "disable-modern=3Dfalse" > + if mergeable is True: > + setting_args +=3D "," + "mrg_rxbuf=3Don" > + else: > + setting_args +=3D "," + "mrg_rxbuf=3Doff" > + setting_args +=3D > ",csum=3Don,gso=3Don,guest_csum=3Don,host_tso4=3Don,guest_tso4=3Don,guest= _ecn=3Do > n" > + > + for i in range(self.vm_num): > + vm_dut =3D None > + vm_info =3D VM(self.dut, 'vm%d' % i, 'vhost_sample') > + vm_params =3D {} > + vm_params['driver'] =3D 'vhost-user' > + vm_params['opt_path'] =3D './vhost-net%d' % i > + vm_params['opt_mac'] =3D "52:54:00:00:00:0%d" % (i+1) > + vm_params['opt_settings'] =3D setting_args > + vm_info.set_vm_device(**vm_params) > + time.sleep(3) > + try: > + vm_dut =3D vm_info.start() > + if vm_dut is None: > + raise Exception("Set up VM ENV failed") > + except Exception as e: > + print utils.RED("Failure for %s" % str(e)) > + > + self.vm_dut.append(vm_dut) > + self.vm.append(vm_info) > + > + def calculate_avg_throughput(self): > + results =3D 0.0 > + for i in range(10): > + out =3D self.vhost.send_expect("show port stats 0", "testpmd= > ", > 60) > + time.sleep(5) > + lines =3D re.search("Tx-pps:\s*(\d*)", out) > + result =3D lines.group(1) > + results +=3D float(result) > + Mpps =3D results / (1000000 * 10) > + self.verify(Mpps > 0, "%s can not receive packets" % > self.running_case) > + return Mpps > + > + def update_table_info(self, case_info, frame_size, Mpps, path): > + results_row =3D [frame_size] > + results_row.append(case_info) > + results_row.append(Mpps) > + results_row.append(path) > + self.result_table_add(results_row) > + > + def send_and_verify(self, mode, path): > + """ > + start to send packets and verify it > + """ > + # start to send packets > + self.vm_dut[0].send_expect("set fwd rxonly", "testpmd> ", 10) > + self.vm_dut[0].send_expect("start", "testpmd> ", 10) > + self.vm_dut[1].send_expect("set fwd txonly", "testpmd> ", 10) > + self.vm_dut[1].send_expect("set txpkts 64", "testpmd> ", 10) > + self.vm_dut[1].send_expect("start tx_first 32", "testpmd> ", 10) > + Mpps =3D self.calculate_avg_throughput() > + self.update_table_info(mode, 64, Mpps, path) > + self.result_table_print() > + > + def stop_all_apps(self): > + for i in range(len(self.vm)): > + self.vm_dut[i].send_expect("quit", "#", 20) > + self.vm[i].stop() > + self.vhost.send_expect("quit", "#", 30) > + > + def test_vhost_vm2vm_virito_pmd_with_mergeable_path(self): > + """ > + vhost-user + virtio-pmd with mergeable path > + """ > + path_mode =3D "mergeable" > + self.start_vhost_testpmd() > + self.start_vms(mode=3D0, mergeable=3DTrue) > + self.start_vm_testpmd(self.vm_dut[0], path_mode) > + self.start_vm_testpmd(self.vm_dut[1], path_mode) > + self.send_and_verify(mode=3D"virtio 0.95", path=3Dpath_mode) > + self.stop_all_apps() > + > + def test_vhost_vm2vm_virtio_pmd_with_normal_path(self): > + """ > + vhost-user + virtio-pmd with normal path > + """ > + path_mode =3D "normal" > + self.start_vhost_testpmd() > + self.start_vms(mode=3D0, mergeable=3DFalse) > + self.start_vm_testpmd(self.vm_dut[0], path_mode) > + self.start_vm_testpmd(self.vm_dut[1], path_mode) > + self.send_and_verify(mode=3D"virtio 0.95", path=3Dpath_mode) > + self.stop_all_apps() > + > + def test_vhost_vm2vm_virtio_pmd_with_vector_rx_path(self): > + """ > + vhost-user + virtio-pmd with vector_rx path > + """ > + path_mode =3D "vector_rx" > + self.start_vhost_testpmd() > + self.start_vms(mode=3D0, mergeable=3DFalse) > + self.start_vm_testpmd(self.vm_dut[0], path_mode) > + self.start_vm_testpmd(self.vm_dut[1], path_mode) > + self.send_and_verify(mode=3D"virtio 0.95", path=3Dpath_mode) > + self.stop_all_apps() > + > + def test_vhost_vm2vm_virito_10_pmd_with_mergeable_path(self): > + """ > + vhost-user + virtio1.0-pmd with mergeable path > + """ > + path_mode =3D "mergeable" > + self.start_vhost_testpmd() > + self.start_vms(mode=3D1, mergeable=3DTrue) > + self.start_vm_testpmd(self.vm_dut[0], path_mode) > + self.start_vm_testpmd(self.vm_dut[1], path_mode) > + self.send_and_verify(mode=3D"virtio 1.0", path=3Dpath_mode) > + self.stop_all_apps() > + > + 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", "#") > + time.sleep(2) > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > -- > 2.7.4