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 EB2F2A04F0; Fri, 27 Dec 2019 07:12:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 82E341BFEE; Fri, 27 Dec 2019 07:12:05 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 8E6151BFE9 for ; Fri, 27 Dec 2019 07:12:03 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Dec 2019 22:12:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,362,1571727600"; d="scan'208";a="220430455" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 26 Dec 2019 22:12:02 -0800 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 26 Dec 2019 22:12:02 -0800 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 26 Dec 2019 22:11:59 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 26 Dec 2019 22:11:59 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.19]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.214]) with mapi id 14.03.0439.000; Fri, 27 Dec 2019 14:11:57 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Wang, Yinan" , "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] tests/vm2vm_virtio_net_perf: update code according plan Thread-Index: AQHVuVeDkSjFWzEBpEWhZGhZkz/ziqfNhlyw Date: Fri, 27 Dec 2019 06:11:56 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB8ECA4@SHSMSX101.ccr.corp.intel.com> References: <1577054526-19946-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1577054526-19946-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.2.0.6 dlp-reaction: no-action 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/vm2vm_virtio_net_perf: update code according plan 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: Monday, December 23, 2019 6:42 AM > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX > > Subject: [dts] [PATCH V1] tests/vm2vm_virtio_net_perf: update code > according plan >=20 > 1. optimize the code > 2. add new test cases according to plan >=20 > Signed-off-by: lihong > --- > tests/TestSuite_vm2vm_virtio_net_perf.py | 195 +++++++++++++++++++++--- > ------- > 1 file changed, 131 insertions(+), 64 deletions(-) >=20 > diff --git a/tests/TestSuite_vm2vm_virtio_net_perf.py > b/tests/TestSuite_vm2vm_virtio_net_perf.py > index f94b4a3..13640a3 100644 > --- a/tests/TestSuite_vm2vm_virtio_net_perf.py > +++ b/tests/TestSuite_vm2vm_virtio_net_perf.py > @@ -32,34 +32,39 @@ > """ > DPDK Test suite. >=20 > -Test cases for vhost-user + virtio-net VM2VM tso/tso -zero- > copy/ufo/tso_ufo capability check. > +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 > dequeue zero copy. > +please use qemu version greater 4.1.94 which support packed feathur to > test this suite. > """ > import re > import time > -import utils > +import string > +import random > from virt_common import VM > from test_case import TestCase > +from pmd_output import PmdOutput >=20 >=20 > 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, > + 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) > - 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 > 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) >=20 > def set_up(self): > """ > @@ -67,10 +72,7 @@ class TestVM2VMVirtioNetPerf(TestCase): > """ > 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 %s/vhost-net*" % self.base_dir, "#"= ) > - self.vhost =3D self.dut.new_session(suite=3D"vhost") > self.vm_dut =3D [] > self.vm =3D [] >=20 > @@ -82,29 +84,33 @@ class TestVM2VMVirtioNetPerf(TestCase): > 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 " + > \ > + eal_params =3D self.dut.create_eal_parameters(cores=3Dself.cores= _list, > + prefix=3D'vhost', no_pci=3DTrue) > + self.command_line =3D self.dut.target + "/app/testpmd %s " + \ > + "--socket-mem %s --legacy-mem " + \ > "--vdev 'net_vhost0,iface=3D%s/vhost-net0,queues=3D1%s' " + = \ > "--vdev 'net_vhost1,iface=3D%s/vhost-net1,queues=3D1%s' " + = \ > "-- -i --nb-cores=3D1 --txd=3D1024 --rxd=3D1024" >=20 > self.command_line =3D self.command_line % ( > - self.coremask, self.memory_channel, self.bas= e_dir, > + eal_params, self.socket_mem, self.base_dir, > zerocopy_arg, self.base_dir, zerocopy_arg) > - self.vhost.send_expect(self.command_line, "testpmd> ", 30) > - self.vhost.send_expect("start", "testpmd> ", 30) > + self.pmd_vhost.execute_cmd(self.command_line, timeout=3D30) > + self.pmd_vhost.execute_cmd('start', timeout=3D30) >=20 > - def start_vms(self, mode=3D"normal"): > + 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= ,gues > t_ecn=3Don" > - if mode =3D=3D "tso": > - setting_args +=3D ",gso=3Don" > - elif mode =3D=3D "ufo": > + if mode =3D=3D "ufo": > setting_args +=3D ",guest_ufo=3Don,host_ufo=3Don" > - elif mode =3D=3D "normal": > + 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 >=20 > for i in range(self.vm_num): > vm_dut =3D None > @@ -121,7 +127,8 @@ class TestVM2VMVirtioNetPerf(TestCase): > 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.logger.error("Failure for %s" % str(e)) > + raise e > vm_dut.restore_interfaces() >=20 > self.vm_dut.append(vm_dut) > @@ -138,6 +145,14 @@ class TestVM2VMVirtioNetPerf(TestCase): > 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) >=20 > + 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 @@ -159,6 +174,7 @@ class > TestVM2VMVirtioNetPerf(TestCase): > """ > 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() > @@ -195,9 +211,10 @@ class TestVM2VMVirtioNetPerf(TestCase): > self.verify(int(tx_info.group(1)) > 0, > "Port 0 not forward packet greater than 1522") >=20 > - def send_and_verify(self, mode): > + def start_iperf_and_verify_vhost_xstats_info(self, mode): > """ > - start to send packets and verify it > + 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() > @@ -207,7 +224,7 @@ class TestVM2VMVirtioNetPerf(TestCase): > def stop_all_apps(self): > for i in range(len(self.vm)): > self.vm[i].stop() > - self.vhost.send_expect("quit", "#", 30) > + self.pmd_vhost.quit() >=20 > def offload_capbility_check(self, vm_client): > """ > @@ -230,13 +247,15 @@ class TestVM2VMVirtioNetPerf(TestCase): > self.verify(tcp6_info is not None and tcp6_info.group(1) =3D=3D = "on", > "tx-tcp6-segmentation in vm not right") >=20 > - def check_payload_valid(self): > + def check_scp_file_valid_between_vms(self): > """ > scp 64b and 64KB file form VM1 to VM2, check the data is valid > """ > # create a 64b and 64K size file > + data =3D '' > for b_size in [64, 65535]: > - data =3D 'x'*b_size > + for char in range(b_size): > + data +=3D random.choice(self.random_string) > self.vm_dut[0].send_expect('echo "%s" > /tmp/payload' % data= , '# ') > # scp this file to vm1 > out =3D self.vm_dut[1].send_command('scp root@%s:/tmp/payloa= d > /root' % self.virtio_ip1, timeout=3D5) @@ -244,69 +263,117 @@ class > TestVM2VMVirtioNetPerf(TestCase): > self.vm_dut[1].send_command('yes', timeout=3D3) > self.vm_dut[1].send_command(self.vm[0].password, timeout=3D3= ) > # get the file info in vm1, and check it valid > - file_info =3D self.vm_dut[1].send_expect('cat /root/payload'= , '# ') > - self.verify(file_info =3D=3D data, 'the file info is invalid= as: %s' % file_info) > + md5_send =3D self.vm_dut[0].send_expect('md5sum /tmp/payload= ', '# > ') > + md5_revd =3D self.vm_dut[1].send_expect('md5sum /root/payloa= d', '# > ') > + md5_send =3D md5_send[: md5_send.find(' ')] > + md5_revd =3D md5_revd[: md5_revd.find(' ')] > + self.verify(md5_send =3D=3D md5_revd, 'the received file is > + different with send file') >=20 > - def test_vhost_vm2vm_tso_iperf(self): > + def test_vm2vm_split_ring_iperf_with_tso(self): > """ > - vhost-user + virtio-net VM2VM with tcp traffic > + VM2VM split ring vhost-user/virtio-net test 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() > + zerocopy =3D False > + path_mode =3D "tso" > + self.prepare_test_env(zerocopy, path_mode) > + self.start_iperf_and_verify_vhost_xstats_info(mode=3D"tso") >=20 > - def test_vhost_vm2vm_tso_iperf_zerocopy(self): > + def test_vm2vm_packed_ring_iperf_with_tso(self): > """ > - vhost-user + virtio-net VM2VM zero-copy with tcp traffic > + VM2VM packed ring vhost-user/virtio-net test 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() > + zerocopy =3D False > + path_mode =3D "tso" > + packed_mode =3D True > + self.prepare_test_env(zerocopy, path_mode, packed_mode) > + self.start_iperf_and_verify_vhost_xstats_info(mode=3D"tso") >=20 > - def test_vhost_vm2vm_ufo_iperf(self): > + def test_vm2vm_split_ring_iperf_with_ufo(self): > """ > - vhost-user + virtio-net VM2VM with udp traffic > + VM2VM split ring vhost-user/virtio-net test 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() > + zerocopy =3D False > + path_mode =3D "ufo" > + self.prepare_test_env(zerocopy, path_mode) > + self.start_iperf_and_verify_vhost_xstats_info(mode=3D"ufo") > + > + def test_vm2vm_packed_ring_iperf_with_ufo(self): > + """ > + VM2VM packed ring vhost-user/virtio-net test with udp traffic > + """ > + zerocopy =3D False > + path_mode =3D "ufo" > + packed_mode =3D True > + self.prepare_test_env(zerocopy, path_mode, packed_mode) > + self.start_iperf_and_verify_vhost_xstats_info(mode=3D"ufo") >=20 > - def test_vhost_vm2vm_ufo_capbility(self): > + def test_vm2vm_split_ring_device_capbility(self): > """ > - check virtio-net device capability > + Check split ring 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() >=20 > - def test_vhost_vm2vm_packet_payload_valid_check(self): > + def test_vm2vm_packed_ring_device_capbility(self): > """ > - VM2VM vhost-user/virtio-net test with large packet payload valid= check > + Check split ring virtio-net device capability > """ > self.start_vhost_testpmd(zerocopy=3DFalse) > - self.start_vms(mode=3D"normal") > - self.config_vm_env() > - self.check_payload_valid() > - self.stop_all_apps() > + self.start_vms(mode=3D"ufo", packed=3DTrue) > + self.offload_capbility_check(self.vm_dut[0]) > + self.offload_capbility_check(self.vm_dut[1]) > + > + def > test_vm2vm_split_ring_zero_copy_with_mergeable_path_check_large_pack > et(self): > + """ > + VM2VM virtio-net split ring mergeable zero copy test with large = packet > payload valid check > + """ > + zerocopy =3D True > + path_mode =3D 'mergeable' > + self.prepare_test_env(zerocopy, path_mode) > + self.check_scp_file_valid_between_vms() > + > + def > test_vm2vm_split_ring_zero_copy_with_no_mergeable_path_check_large_p > acket(self): > + """ > + VM2VM virtio-net split ring non-mergeable zero copy test with la= rge > packet payload valid check > + """ > + zerocopy =3D True > + path_mode =3D 'normal' > + self.prepare_test_env(zerocopy, path_mode) > + self.check_scp_file_valid_between_vms() > + > + def > test_vm2vm_packed_ring_zero_copy_with_mergeable_path_check_large_pa > cket(self): > + """ > + VM2VM packed ring virtio-net mergeable dequeue zero copy test wi= th > large packet payload valid check > + """ > + zerocopy =3D True > + path_mode =3D 'mergeable' > + packed_mode =3D True > + self.prepare_test_env(zerocopy, path_mode, packed_mode) > + self.check_scp_file_valid_between_vms() > + > + def > test_vm2vm_packed_ring_zero_copy_with_no_mergeable_path_check_large > _packet(self): > + """ > + VM2VM packed ring virtio-net non-mergeable dequeue zero copy tes= t > with large packet payload valid check > + """ > + zerocopy =3D True > + path_mode =3D 'normal' > + packed_mode =3D True > + self.prepare_test_env(zerocopy, path_mode, packed_mode) > + self.check_scp_file_valid_between_vms() >=20 > 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.stop_all_apps() > + self.dut.kill_all() > time.sleep(2) >=20 > def tear_down_all(self): > """ > Run after each test suite. > """ > - pass > + if getattr(self, 'vhost', None): > + self.dut.close_session(self.vhost) > -- > 2.7.4