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 CD117A00C3; Mon, 8 Jun 2020 08:38:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9261F1BE8A; Mon, 8 Jun 2020 08:38:37 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 2C2721BE85 for ; Mon, 8 Jun 2020 08:38:36 +0200 (CEST) IronPort-SDR: 4Lt4t+S65JDEO81D/rAI3e5ZoKD5mpT7LBm7e66mskAlZKXGeX9yqp+fco3tj7DNcurl2li5QY ou1dbDW339hQ== 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/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2020 23:38:35 -0700 IronPort-SDR: gpGQIIAkG7HG1xcPoqnspY6Xek4ApY0TkWhrKI1OMLCqF2dF74P2nvQbTiz4qIp1NM21dzJl0y DT+SG1Bpj3jg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,487,1583222400"; d="scan'208";a="259346221" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga007.jf.intel.com with ESMTP; 07 Jun 2020 23:38:34 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 7 Jun 2020 23:38:34 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 7 Jun 2020 23:38:34 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.170) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 7 Jun 2020 23:38:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z3URP1kz0lbDVpkXgRxzid3tNYdy0uqRULq0FnlkcA3z9Y89o2qAjL5Koaul+Lrx2c3I40LCV7PGrjssB4y10aQQ9r0+hHAfWCpWoHJ+5Eff8Tf07wJoGsyLP3B3pVv5ZZL+WVxuUlhHEXxsk4kEmycm3zBwaKIQZ/OYZuFJ/laZ7y6qae1G3sEDu4KiujJC3/LWjQKf2K2pf2SBG/jRRTj5IV740HD0xDKyiZAOTS+k3zLQN1hCLMN1EGb9v3yh8sq7kC8l1rmDUkaohYPLx0iUA/fGLlt+lPXlNLE7sSvgBXqUVceLE28q2CZ3u5pN8lvQXio5VmEmPneUoX6Sfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dyKIRWgA0loXPUiKMD8i/Dl+I7HIQoFa+aIPNcY6q8c=; b=EKQA4ggID8OUgPfr3RBANDcnZKz3JKVKBX4pDO1/1zTSHHuACcQ9J8OGMPaFtLpbtBSPEZin/u8hpanNRb3KDoU5AAmWxoS0MHC/8bdVUaNd8uhx3KpZnit4iqEdG6ccHIbXXI3GxaEwj9nNJMI9nIhaDkOmrMUIVjgAkyXWcWeJMfSwF/UCOaOp3lD2r/VRh0rrt1nFrUATQgwLjgIGRIm9DO48bB/e3IbaeMsRXzmkbGspC1oS6DaThA4jhvdz5nTE1N0LXRCc8il5hZfPPlNtCNGHpZzrCGJNhq5y+n3LbqOflC9sJgAdhVXlTtyx7yYdH5fzGH+5VAbLrsaaVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dyKIRWgA0loXPUiKMD8i/Dl+I7HIQoFa+aIPNcY6q8c=; b=vxAO/test+i8/cS18AhnVPVSd0aTgMjMUD6Tyz2O4oRBryqQzI3uAfVK/9gWdJrjPTrNcEEJRSq59MA68xlzNLhPmGcMunanln1tI0+jSeTSmFtFpusQ30kkLxCGzhjzlcO0U5r1B5npuv97cX7NIqYIhjz4pJvD1iklXpz6U2o= Received: from BYAPR11MB3655.namprd11.prod.outlook.com (2603:10b6:a03:f6::11) by BYAPR11MB3638.namprd11.prod.outlook.com (2603:10b6:a03:f8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Mon, 8 Jun 2020 06:38:32 +0000 Received: from BYAPR11MB3655.namprd11.prod.outlook.com ([fe80::19e6:cfc0:35a1:1e03]) by BYAPR11MB3655.namprd11.prod.outlook.com ([fe80::19e6:cfc0:35a1:1e03%2]) with mapi id 15.20.3066.023; Mon, 8 Jun 2020 06:38:32 +0000 From: "Wang, Yinan" To: "Xiao, QimaiX" , "dts@dpdk.org" CC: "Xiao, QimaiX" Thread-Topic: [dts] [PATCH V1]perf_vm2vm_virtio_net_perf: add case perf_vm2vm_virtio_net_perf to dts Thread-Index: AQHWMmrt6jR4RZMhnE6SwtpbqVNb+6jOWfCA Date: Mon, 8 Jun 2020 06:38:32 +0000 Message-ID: References: <1590393315-23987-1-git-send-email-qimaix.xiao@intel.com> In-Reply-To: <1590393315-23987-1-git-send-email-qimaix.xiao@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ae78c76d-99f7-48f2-5d8f-08d80b769049 x-ms-traffictypediagnostic: BYAPR11MB3638: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1332; x-forefront-prvs: 042857DBB5 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OYTWw1HaVXxqRcnYuBJvx1P/P+kU9h7sFgGGfQBVMaZ7/MpqmnrxF/VhWBhClyjNlEZCBOedKt9x0i997ERQypLEVJxPc4V9vgy9HzFPdvyJCnfTZSwPSUPxY1BKRocdw/VsD6Rn8DaXcVHDRFNMEHccVbTTSthiOH9i6lc+ZGZa+e9ZHXVNTUnP3kWZjmUBX1g9TWyjHTWaFdZLj+B+Lr4jTjneRR9D/+gaVd3XNaCJf6w1AutYpUUH1wWDEu3/zvsbm+e+UagjAAMTE7fugdRSykdXWAIvPr/dc1mkM0R2pqp8ZDrdYfBvcjTQOOg1sL41EmtcMAug0ymdvNYRng== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3655.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(376002)(396003)(346002)(136003)(366004)(39860400002)(52536014)(2906002)(33656002)(30864003)(71200400001)(76116006)(8936002)(86362001)(5660300002)(55016002)(186003)(26005)(53546011)(66946007)(107886003)(19627235002)(6506007)(7696005)(478600001)(66556008)(316002)(66446008)(64756008)(66476007)(9686003)(110136005)(4326008)(83380400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: bLeJKZUcGX/X9+XjezSCm3OhE6bAgCtSSTOfyqAJISUyjlwVJmhaQIZ6VGoAb0IfLuuyN5V3HXycxNUhmjvrzsre41pgWzxvFmk4rc0eS7fRL4EgxXrAJpTtdokreyp0Gljflb/jVhV8p8UcVGNW/uYUUGZ/ve7/SxwY71tY6vU+nn9qmJdNCYo6Zhmag0BTbKT+aklIUjcdqKwmD3WEDCSsSjX8XqqcczyqIcwN7YY7XRII4E8f2+tyJZjUmQwCSEvXbr/mWOXd32G9D8b9vpSKctIjct+4/hZx4gEXlIThv/RSrtvP/m0yvppomTZS5T/yE74eg/kQN2FRPQMmNm/5EVE6NqNKDVS+m3IjnWLn6t37W6kJ0oOXRvOHPKVV1srkqX+J49hf0Ex8jGO64FdQY911XJ6bOLC0xai2trXKcQFg1DKXWI24raN4qwHz+GX5Kieei63rXK8235r30AR+AyIjLkGGUkmKOBip6VQ= Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: ae78c76d-99f7-48f2-5d8f-08d80b769049 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2020 06:38:32.6149 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: DJKpsbSEl4+AJLN/LNgYzGFZ1Z2FN06YCJHgmEBf5jPF7GDtoE9RyMa/Z3JTeC2JoawzhHYs/KeogwX92eEXXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3638 X-OriginatorOrg: intel.com Subject: Re: [dts] [PATCH V1]perf_vm2vm_virtio_net_perf: add case perf_vm2vm_virtio_net_perf to dts 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: dts On Behalf Of Xiao Qimai > Sent: 2020=1B$BG/=1B(B5=1B$B7n=1B(B25=1B$BF|=1B(B 15:55 > To: dts@dpdk.org > Cc: Xiao, QimaiX > Subject: [dts] [PATCH V1]perf_vm2vm_virtio_net_perf: add case > perf_vm2vm_virtio_net_perf to dts >=20 > *. add case perf_vm2vm_virtio_net_perf >=20 > Signed-off-by: Xiao Qimai > --- > tests/TestSuite_perf_vm2vm_virtio_net_perf.py | 365 > ++++++++++++++++++++++++++ > 1 file changed, 365 insertions(+) > create mode 100644 tests/TestSuite_perf_vm2vm_virtio_net_perf.py >=20 > diff --git a/tests/TestSuite_perf_vm2vm_virtio_net_perf.py > b/tests/TestSuite_perf_vm2vm_virtio_net_perf.py > new file mode 100644 > index 0000000..532cdf7 > --- /dev/null > +++ b/tests/TestSuite_perf_vm2vm_virtio_net_perf.py > @@ -0,0 +1,365 @@ > +# BSD LICENSE > +# > +# Copyright(c) <2020> 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. > + > +vm2vm split ring and packed ring with tx offload (TSO and UFO) with non- > mergeable path. > +vm2vm split ring and packed ring with UFO about virtio-net device capabi= lity > with non-mergeable path. > +vm2vm split ring and packed ring vhost-user/virtio-net check the > +payload of large packet is valid with mergeable and non-mergeable dequeu= e > zero copy. > +please use qemu version greater 4.1.94 which support packed feathur to t= est > this suite. > +""" > +import re > +import os > +import rst > +import json > +import time > +import string > +import random > +from virt_common import VM > +from test_case import TestCase > +from pmd_output import PmdOutput > +from settings import UPDATE_EXPECTED, load_global_setting from copy > +import deepcopy > + > + > +class TestPerfVM2VMVirtioNetPerf(TestCase): > + def set_up_all(self): > + core_config =3D "1S/4C/1T" > + self.cores_list =3D self.dut.get_core_list(core_config) > + self.verify(len(self.cores_list) >=3D 4, > + "There has not enough cores to test this suite %s" % > + self.suite_name) > + 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.base_dir =3D self.dut.base_dir.replace('~', '/root') > + self.random_string =3D string.ascii_letters + string.digits > + socket_num =3D len(set([int(core['socket']) for core in self.dut= .cores])) > + self.socket_mem =3D ','.join(['2048']*socket_num) > + self.vhost =3D self.dut.new_session(suite=3D"vhost") > + self.pmd_vhost =3D PmdOutput(self.dut, self.vhost) > + self.json_obj =3D dict() > + self.save_result_flag =3D True > + > + def set_up(self): > + """ > + run before each test case. > + """ > + self.dut.send_expect("rm -rf %s/vhost-net*" % self.base_dir, "#"= ) > + self.vm_dut =3D [] > + self.vm =3D [] > + self.gap =3D self.get_suite_cfg()['accepted_tolerance'] > + self.test_duration =3D self.get_suite_cfg()['test_duration'] > + self.test_parameter =3D self.get_suite_cfg()['test_parameters'] > + self.test_result =3D {} > + self.table_header =3D ['Mode', 'Type', 'TXD/RXD', 'Throughput', = 'Expected > Throughput', > + 'Throughput Difference'] > + > + def handle_expected(self): > + """ > + Update expected numbers to configurate file: conf/$suite_name.cf= g > + """ > + if load_global_setting(UPDATE_EXPECTED) =3D=3D "yes": > + self.expected_throughput[self.test_parameter] =3D > + self.throughput > + > + def handle_results(self): > + header =3D self.table_header > + ret_data =3D {} > + ret_data[header[0]] =3D 'vm2vm' > + ret_data[header[1]] =3D 'iperf' > + ret_data[header[2]] =3D self.test_parameter > + ret_data[header[3]] =3D self.throughput > + ret_data[header[4]] =3D self.expected_throughput[self.test_param= eter] > + expected =3D re.search('(.*\d)(\s?.+)', > self.expected_throughput[self.test_parameter]) > + self.expected_data =3D float(expected.group(1)) > + self.expect_unit =3D expected.group(2).strip() > + self.verify(self.throughput_unit =3D=3D self.expect_unit, "data = unit not correct, > expect: %s, result: %s" % (self.expect_unit, self.throughput_unit)) > + self.gap_data =3D round((self.throughput_data - self.expected_da= ta), 3) > + ret_data[header[5]] =3D str(self.gap_data) + ' ' + self.expect_u= nit > + self.test_result =3D deepcopy(ret_data) > + self.result_table_create(header) > + self.result_table_add(list(self.test_result.values())) > + # present test results to screen > + self.result_table_print() > + # save test results as a file > + if self.save_result_flag: > + self.save_result(self.test_result) > + > + def save_result(self, data): > + ''' > + Saves the test results as a separated file named with > + self.nic+_perf_virtio_user_pvp.json in output folder > + if self.save_result_flag is True > + ''' > + case_name =3D self.running_case > + self.json_obj[case_name] =3D list() > + status_result =3D [] > + row_in =3D data > + row_dict0 =3D dict() > + row_dict0['performance'] =3D list() > + row_dict0['parameters'] =3D list() > + gap =3D self.expected_data * -float(self.gap) * 0.01 > + > + self.logger.info("Accept tolerance are %0.3f %s" % (gap, self.ex= pect_unit)) > + self.logger.info("Throughput Difference are %0.3f %s" % (self.ga= p_data, > self.expect_unit)) > + if self.throughput_data > self.expected_data + gap: > + row_dict0['status'] =3D 'PASS' > + else: > + row_dict0['status'] =3D 'FAIL' > + row_dict1 =3D dict(name=3D"Throughput", value=3Dself.throughput_= data, > unit=3Dself.throughput_unit, delta=3Dself.gap_data) > + row_dict2 =3D dict(name=3D"Txd/Rxd", value=3Drow_in["TXD/RXD"], > unit=3D"descriptor") > + row_dict0['performance'].append(row_dict1) > + row_dict0['parameters'].append(row_dict2) > + self.json_obj[case_name].append(row_dict0) > + status_result.append(row_dict0['status']) > + with open(os.path.join(rst.path2Result, > + '{0:s}_{1}.json'.format( > + self.nic, self.suite_name)), 'w') as = fp: > + json.dump(self.json_obj, fp) > + > + self.verify("FAIL" not in status_result, "Exceeded Gap") > + > + 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 "" > + testcmd =3D self.dut.target + "/app/testpmd " > + vdev1 =3D "--vdev 'net_vhost0,iface=3D%s/vhost-net0,queues=3D1%s= ' " % > (self.base_dir, zerocopy_arg) > + vdev2 =3D "--vdev 'net_vhost1,iface=3D%s/vhost-net1,queues=3D1%s= ' " % > (self.base_dir, zerocopy_arg) > + eal_params =3D self.dut.create_eal_parameters(cores=3Dself.cores= _list, > prefix=3D'vhost', no_pci=3DTrue) > + para =3D " -- -i --nb-cores=3D2 --txd=3D1024 --rxd=3D1024" > + self.command_line =3D testcmd + eal_params + vdev1 + vdev2 + par= a > + self.pmd_vhost.execute_cmd(self.command_line, timeout=3D30) > + self.pmd_vhost.execute_cmd('start', timeout=3D30) > + > + def start_vms(self, mode=3D"mergeable", packed=3DFalse): > + """ > + start two VM, each VM has one virtio device > + """ > + setting_args =3D > "mrg_rxbuf=3Doff,csum=3Don,guest_csum=3Don,host_tso4=3Don,guest_tso4=3Don= ,guest_e > cn=3Don" > + if mode =3D=3D "ufo": > + setting_args +=3D ",guest_ufo=3Don,host_ufo=3Don" > + elif mode =3D=3D "mergeable": > + setting_args =3D "mrg_rxbuf=3Don" > + elif mode =3D=3D "normal": > + setting_args =3D "mrg_rxbuf=3Doff" > + if packed is True: > + setting_args =3D "%s,packed=3Don" % setting_args > + > + 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 self.base_dir + '/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(set_target=3DFalse) > + if vm_dut is None: > + raise Exception("Set up VM ENV failed") > + except Exception as e: > + self.logger.error("Failure for %s" % str(e)) > + raise 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.vi= rtio_ip1), > "#", 10) > + self.vm_dut[1].send_expect("ifconfig %s %s" % (vm2_intf, self.vi= rtio_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 prepare_test_env(self, zerocopy, path_mode, packed_mode=3DFalse)= : > + """ > + start vhost testpmd and qemu, and config the vm env > + """ > + self.start_vhost_testpmd(zerocopy) > + self.start_vms(mode=3Dpath_mode, packed=3Dpacked_mode) > + self.config_vm_env() > + > + 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 "ufo": > + iperf_server =3D "iperf -s -u -i 1" > + iperf_client =3D "iperf -c 1.1.1.2 -i 1 -t %s -P 4 -u -b 1G = -l 9000" % > self.test_duration > + else: > + iperf_server =3D "iperf -s -i 1" > + iperf_client =3D "iperf -c 1.1.1.2 -i 1 -t %s" % self.test_d= uration > + self.vm_dut[0].send_expect("%s > iperf_server.log &" % iperf_ser= ver, "", > 10) > + self.vm_dut[1].send_expect("%s > iperf_client.log &" % iperf_cli= ent, "", 60) > + time.sleep(int(self.test_duration)+3) > + > + def get_perf_result(self): > + """ > + get the iperf test result > + """ > + self.vm_dut[0].send_expect('pkill iperf', '# ') > + 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(\d+\.\d+)\s([MG]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.throughput_unit =3D iperfdata[-1][1] > + self.throughput_data =3D round(float(iperfdata[-1][0]), 3) > + self.throughput =3D str(self.throughput_data) + ' ' + self.throu= ghput_unit > + self.logger.info("The iperf data between vms is %s" % > + self.throughput) > + > + # 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*)", ou= t_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 start_iperf_and_verify_vhost_xstats_info(self, mode): > + """ > + start to send packets and verify vm can received data of iperf > + and verify the vhost can received big pkts in testpmd > + """ > + self.start_iperf(mode) > + self.get_perf_result() > + self.verify_xstats_info_on_vhost() > + > + def stop_all_apps(self): > + for i in range(len(self.vm)): > + self.vm[i].stop() > + self.pmd_vhost.quit() > + > + def test_vm2vm_split_ring_iperf_with_tso(self): > + """ > + VM2VM split ring vhost-user/virtio-net test with tcp traffic > + """ > + zerocopy =3D False > + path_mode =3D "tso" > + self.test_target =3D "split_tso" > + self.expected_throughput =3D > self.get_suite_cfg()['expected_throughput'][self.test_target] > + self.prepare_test_env(zerocopy, path_mode) > + self.start_iperf_and_verify_vhost_xstats_info(mode=3D"tso") > + self.handle_expected() > + self.handle_results() > + > + def test_vm2vm_split_ring_dequeue_zero_copy_iperf_with_tso(self): > + """ > + VM2VM split ring vhost-user/virtio-net zero copy test with tcp t= raffic > + """ > + zerocopy =3D True > + path_mode =3D "tso" > + self.test_target =3D "split_zero_copy_tso" > + self.expected_throughput =3D > self.get_suite_cfg()['expected_throughput'][self.test_target] > + self.prepare_test_env(zerocopy, path_mode) > + self.start_iperf_and_verify_vhost_xstats_info(mode=3D"tso") > + self.handle_expected() > + self.handle_results() > + > + def test_vm2vm_packed_ring_iperf_with_tso(self): > + """ > + VM2VM packed ring vhost-user/virtio-net test with tcp traffic > + """ > + zerocopy =3D False > + path_mode =3D "tso" > + self.test_target =3D "packed_tso" > + self.expected_throughput =3D > self.get_suite_cfg()['expected_throughput'][self.test_target] > + packed_mode =3D True > + self.prepare_test_env(zerocopy, path_mode, packed_mode) > + self.start_iperf_and_verify_vhost_xstats_info(mode=3D"tso") > + self.handle_expected() > + self.handle_results() > + > + def test_vm2vm_packed_ring_dequeue_zero_copy_iperf_with_tso(self): > + """ > + VM2VM packed ring vhost-user/virtio-net zero copy test with tcp = traffic > + """ > + zerocopy =3D True > + path_mode =3D "tso" > + packed_mode =3D True > + self.test_target =3D "packed_zero_copy_tso" > + self.expected_throughput =3D > self.get_suite_cfg()['expected_throughput'][self.test_target] > + self.prepare_test_env(zerocopy, path_mode, packed_mode) > + self.start_iperf_and_verify_vhost_xstats_info(mode=3D"tso") > + self.handle_expected() > + self.handle_results() > + > + def tear_down(self): > + """ > + run after each test case. > + """ > + self.stop_all_apps() > + self.dut.kill_all() > + time.sleep(2) > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + > + """ > + if getattr(self, 'vhost', None): > + self.dut.close_session(self.vhost) > -- > 1.8.3.1