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 C9D54A04F0; Fri, 27 Dec 2019 09:30:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B32A51BFF7; Fri, 27 Dec 2019 09:30:54 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id DDB821BFF1 for ; Fri, 27 Dec 2019 09:30:51 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Dec 2019 00:30:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,362,1571727600"; d="scan'208";a="243177334" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 27 Dec 2019 00:30:50 -0800 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 27 Dec 2019 00:30:49 -0800 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 27 Dec 2019 00:30:49 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.72]) with mapi id 14.03.0439.000; Fri, 27 Dec 2019 16:30:47 +0800 From: "Wang, Yinan" To: "Ma, LihongX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V1] tests/vm2vm_virtio_net_perf: update code according plan Thread-Index: AQHVuVd79Y1vSCPTAkSDuUa1A+/xI6fKZ+zggANFL4A= Date: Fri, 27 Dec 2019 08:30:46 +0000 Message-ID: References: <1577054526-19946-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWU1NGZlM2QtMzYzZi00MzVkLTk5ZGItZGIyM2E3ZmUwNmI4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNjhFTVwvNWZ6UXpQQU5rRkQ4UndpYzYxR1NGQVJaMXlYcW9tRWdqeW82ZWt5M2tJMGFkTFpcL2VXb3crTmRFWlZFIn0= x-ctpclassification: CTP_NT 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="iso-2022-jp" 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" Acked-by: Wang, Yinan > -----Original Message----- > From: Ma, LihongX > Sent: 2019=1B$BG/=1B(B12=1B$B7n=1B(B25=1B$BF|=1B(B 14:35 > To: dts@dpdk.org > Cc: Wang, Yinan > Subject: RE: [dts][PATCH V1] tests/vm2vm_virtio_net_perf: update code > according plan >=20 > Tested-by: ma,lihong >=20 > -----Original Message----- > From: Ma, LihongX > 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 accordi= ng > 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 dequeu= e > zero copy. > +please use qemu version greater 4.1.94 which support packed feathur to t= est > 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.base_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= ,guest_ec > n=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/payload /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/payload', '# ') > + 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_packet( > 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_pac > ket(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_pack > et(self): > + """ > + VM2VM packed ring virtio-net mergeable dequeue zero copy test > with 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 > test 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