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 4965EA05D3 for ; Mon, 20 May 2019 03:07:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EC697152A; Mon, 20 May 2019 03:07:50 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 6FD5FA49 for ; Mon, 20 May 2019 03:07:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 May 2019 18:07:46 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 19 May 2019 18:07:46 -0700 Received: from fmsmsx161.amr.corp.intel.com (10.18.125.9) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 19 May 2019 18:07:46 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX161.amr.corp.intel.com (10.18.125.9) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 19 May 2019 18:07:45 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.33]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.10]) with mapi id 14.03.0415.000; Mon, 20 May 2019 09:07:43 +0800 From: "Wang, Yinan" To: "Ma, LihongX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V1] Add testsuite vm2vm virtio net perf Thread-Index: AQHVDFS9jJbjOsDlSU6vy5qYB6E8JaZzOCjw Date: Mon, 20 May 2019 01:07:44 +0000 Message-ID: References: <1558032184-23034-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1558032184-23034-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDc3MGU0NzMtMTU2OC00NWM1LTk1OWEtMjdlYzJmODhkODQ1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoidUt3S3paNHRtYTJCVE1QNHc2S3RoeTlhdHJ2ak91Q01DcEcwa2JZRExxTVJQelRSZmFXckFxM0ZpZ0dJKzFhZiJ9 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 net perf 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 net perf >=20 > Signed-off-by: lihong > --- > tests/TestSuite_vm2vm_virtio_net_perf.py | 282 > +++++++++++++++++++++++++++++++ > 1 file changed, 282 insertions(+) > create mode 100644 tests/TestSuite_vm2vm_virtio_net_perf.py >=20 > diff --git a/tests/TestSuite_vm2vm_virtio_net_perf.py > b/tests/TestSuite_vm2vm_virtio_net_perf.py > new file mode 100644 > index 0000000..dbcf5c4 > --- /dev/null > +++ b/tests/TestSuite_vm2vm_virtio_net_perf.py > @@ -0,0 +1,282 @@ > +# 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-net VM2VM tso/tso > +zero-copy/ufo/tso_ufo capability check. > +""" > +import re > +import time > +import utils > +from virt_common import VM > +from test_case import TestCase > + > + > +class TestVM2VMVirtioNetPerf(TestCase): > + def set_up_all(self): > + core_config =3D "1S/4C/1T" > + cores_num =3D len([n for n in self.dut.cores if int(n['socket']) > + =3D=3D 0]) > + self.verify(cores_num >=3D 4, > + "There has not enough cores to test this suite %s" % > + self.suite_name) > + cores =3D self.dut.get_core_list(core_config) > + self.coremask =3D utils.create_mask(cores) > + self.memory_channel =3D self.dut.get_memory_channels() > + self.vm_num =3D 2 > + self.virtio_ip1 =3D "1.1.1.2" > + self.virtio_ip2 =3D "1.1.1.3" > + self.vritio_mac1 =3D "52:54:00:00:00:01" > + self.vritio_mac2 =3D "52:54:00:00:00:02" > + self.vm_dut =3D None > + > + def set_up(self): > + """ > + run before each test case. > + """ > + self.table_header =3D ['Mode', '[M|G]bits/sec'] > + 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, zerocopy=3DFalse): > + """ > + launch the testpmd with different parameters > + """ > + if zerocopy is True: > + zerocopy_arg =3D ",dequeue-zero-copy=3D1" > + else: > + zerocopy_arg =3D "" > + 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%s' " + \ > + "--vdev 'net_vhost1,iface=3Dvhost-net1,queues=3D1%s' " + \ > + "-- -i --nb-cores=3D1 --txd=3D1024 --rxd=3D1024 --txfreet=3D= 992 " > + > + self.command_line =3D self.command_line % ( > + self.coremask, self.memory_channel, > + zerocopy_arg, zerocopy_arg) > + self.vhost.send_expect(self.command_line, "testpmd> ", 30) > + self.vhost.send_expect("start", "testpmd> ", 30) > + > + def start_vms(self, mode=3D"tso"): > + """ > + start two VM, each VM has one virtio device > + """ > + setting_args =3D > "mrg_rxbuf=3Don,csum=3Don,guest_csum=3Don,host_tso4=3Don,guest_tso4=3Don,= guest_ > ecn=3Don" > + if mode =3D=3D "tso": > + setting_args +=3D ",gso=3Don" > + elif mode =3D=3D "ufo": > + setting_args +=3D ",guest_ufo=3Don,host_ufo=3Don" > + > + 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)) > + vm_dut.restore_interfaces() > + > + self.vm_dut.append(vm_dut) > + self.vm.append(vm_info) > + > + def config_vm_env(self): > + """ > + set virtio device IP and run arp protocal > + """ > + vm1_intf =3D self.vm_dut[0].ports_info[0]['intf'] > + vm2_intf =3D self.vm_dut[1].ports_info[0]['intf'] > + self.vm_dut[0].send_expect("ifconfig %s %s" % (vm1_intf, > self.virtio_ip1), "#", 10) > + self.vm_dut[1].send_expect("ifconfig %s %s" % (vm2_intf, > self.virtio_ip2), "#", 10) > + self.vm_dut[0].send_expect("arp -s %s %s" % (self.virtio_ip2, > self.vritio_mac2), "#", 10) > + self.vm_dut[1].send_expect("arp -s %s %s" % (self.virtio_ip1, > + self.vritio_mac1), "#", 10) > + > + def start_iperf(self, mode): > + """ > + run perf command between to vms > + """ > + # clear the port xstats before iperf > + self.vhost.send_expect("clear port xstats all", "testpmd> ", > + 10) > + > + if mode =3D=3D "tso": > + iperf_server =3D "iperf -s -i 1" > + iperf_client =3D "iperf -c 1.1.1.2 -i 1 -t 30" > + elif mode =3D=3D "ufo": > + iperf_server =3D "iperf -s -u -i 1" > + iperf_client =3D "iperf -c 1.1.1.2 -i 1 -t 30 -P 4 -u -b 1G = -l 9000" > + self.vm_dut[0].send_expect("%s > iperf_server.log &" % > iperf_server, "", 10) > + self.vm_dut[1].send_expect("%s > iperf_client.log &" % iperf_cli= ent, > "", 60) > + time.sleep(90) > + > + def get_perf_result(self): > + """ > + get the iperf test result > + """ > + self.vm_dut[1].session.copy_file_from("%s/iperf_client.log" % > self.dut.base_dir) > + fp =3D open("./iperf_client.log") > + fmsg =3D fp.read() > + fp.close() > + # remove the server report info from msg > + index =3D fmsg.find("Server Report") > + if index !=3D -1: > + fmsg =3D fmsg[:index] > + iperfdata =3D re.compile('\S*\s*[M|G]bits/sec').findall(fmsg) > + # the last data of iperf is the ave data from 0-30 sec > + self.verify(len(iperfdata) !=3D 0, "The iperf data between to vm= s is 0") > + self.logger.info("The iperf data between vms is %s" % > + iperfdata[-1]) > + > + # put the result to table > + results_row =3D ["vm2vm", iperfdata[-1]] > + self.result_table_add(results_row) > + > + # rm the iperf log file in vm > + self.vm_dut[0].send_expect('rm iperf_server.log', '#', 10) > + self.vm_dut[1].send_expect('rm iperf_client.log', '#', 10) > + > + def verify_xstats_info_on_vhost(self): > + """ > + check both 2VMs can receive and send big packets to each other > + """ > + out_tx =3D self.vhost.send_expect("show port xstats 0", "testpmd= > ", > 20) > + out_rx =3D self.vhost.send_expect("show port xstats 1", "testpmd= > > + ", 20) > + > + rx_info =3D re.search("rx_size_1523_to_max_packets:\s*(\d*)", > out_rx) > + tx_info =3D re.search("tx_size_1523_to_max_packets:\s*(\d*)", > + out_tx) > + > + self.verify(int(rx_info.group(1)) > 0, > + "Port 1 not receive packet greater than 1522") > + self.verify(int(tx_info.group(1)) > 0, > + "Port 0 not forward packet greater than 1522") > + > + def send_and_verify(self, mode): > + """ > + start to send packets and verify it > + """ > + self.start_iperf(mode) > + self.get_perf_result() > + self.verify_xstats_info_on_vhost() > + self.result_table_print() > + > + def stop_all_apps(self): > + for i in range(len(self.vm)): > + self.vm[i].stop() > + self.vhost.send_expect("quit", "#", 30) > + > + def offload_capbility_check(self, vm_client): > + """ > + check UFO and TSO offload status on for the Virtio-net driver in= VM > + """ > + vm_intf =3D vm_client.ports_info[0]['intf'] > + vm_client.send_expect('ethtool -k %s > offload.log' % vm_intf, '= #', > 10) > + fmsg =3D vm_client.send_expect("cat ./offload.log", "#") > + udp_info =3D re.search("udp-fragmentation-offload:\s*(\S*)", fms= g) > + tcp_info =3D re.search("tx-tcp-segmentation:\s*(\S*)", fmsg) > + tcp_enc_info =3D re.search("tx-tcp-ecn-segmentation:\s*(\S*)", f= msg) > + tcp6_info =3D re.search("tx-tcp6-segmentation:\s*(\S*)", fmsg) > + > + self.verify(udp_info is not None and udp_info.group(1) =3D=3D "o= n", > + "the udp-fragmentation-offload in vm not right") > + self.verify(tcp_info is not None and tcp_info.group(1) =3D=3D "o= n", > + "tx-tcp-segmentation in vm not right") > + self.verify(tcp_enc_info is not None and tcp_enc_info.group(1) = =3D=3D > "on", > + "tx-tcp-ecn-segmentation in vm not right") > + self.verify(tcp6_info is not None and tcp6_info.group(1) =3D=3D = "on", > + "tx-tcp6-segmentation in vm not right") > + > + def test_vhost_vm2vm_tso_iperf(self): > + """ > + vhost-user + virtio-net VM2VM with tcp traffic > + """ > + self.start_vhost_testpmd(zerocopy=3DFalse) > + self.start_vms(mode=3D"tso") > + self.config_vm_env() > + self.send_and_verify(mode=3D"tso") > + self.stop_all_apps() > + > + def test_vhost_vm2vm_tso_iperf_zerocopy(self): > + """ > + vhost-user + virtio-net VM2VM zero-copy with tcp traffic > + """ > + self.start_vhost_testpmd(zerocopy=3DTrue) > + self.start_vms(mode=3D"tso") > + self.config_vm_env() > + self.send_and_verify(mode=3D"tso") > + self.stop_all_apps() > + > + def test_vhost_vm2vm_ufo_iperf(self): > + """ > + vhost-user + virtio-net VM2VM with udp traffic > + """ > + self.start_vhost_testpmd(zerocopy=3DFalse) > + self.start_vms(mode=3D"ufo") > + self.config_vm_env() > + self.send_and_verify(mode=3D"ufo") > + self.stop_all_apps() > + > + def test_vhost_vm2vm_ufo_capbility(self): > + """ > + check virtio-net device capability > + """ > + self.start_vhost_testpmd(zerocopy=3DFalse) > + self.start_vms(mode=3D"ufo") > + self.offload_capbility_check(self.vm_dut[0]) > + self.offload_capbility_check(self.vm_dut[1]) > + 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