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 CE30AA3160 for ; Sat, 12 Oct 2019 08:00:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B8E341EB88; Sat, 12 Oct 2019 08:00:19 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id C26EB1BECC for ; Sat, 12 Oct 2019 08:00:17 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2019 23:00:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,286,1566889200"; d="scan'208";a="200987169" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 11 Oct 2019 23:00:16 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 11 Oct 2019 23:00:16 -0700 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; Fri, 11 Oct 2019 23:00:15 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) 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; Fri, 11 Oct 2019 23:00:14 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.96]) by shsmsx102.ccr.corp.intel.com ([169.254.2.176]) with mapi id 14.03.0439.000; Sat, 12 Oct 2019 14:00:13 +0800 From: "Tu, Lijuan" To: "Ma, LihongX" , "dts@dpdk.org" CC: "Wang, Yinan" , "Ma, LihongX" Thread-Topic: [dts] [PATCH V1] tests/vm2vm_virtio_pmd: update code according to plan Thread-Index: AQHVfwe9EZ3ZSsLru02WGfP6FiDrKadWhn3w Date: Sat, 12 Oct 2019 06:00:12 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB3EC10@SHSMSX101.ccr.corp.intel.com> References: <1570643209-6554-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1570643209-6554-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-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODU0YzNlNDktZDY3YS00MDljLWEzNGItMjIwY2NkZGFkYmYwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiYlwvdTJkbndZcSt1UFlzN3FwZjcrdHRlUFNzZVZjVHJ1anJtT3U3bHhETmJrNmlpb3NTbGZDdThjTFVWT2JZTnIifQ== 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_pmd: update code according to 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" Fail to apply > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong > Sent: Thursday, October 10, 2019 1:47 AM > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX > > Subject: [dts] [PATCH V1] tests/vm2vm_virtio_pmd: update code according t= o > plan >=20 > 1. add test cases of virtio 1.1 mergeable path 2. complie dpdk only when = first > time start vm to redece running time >=20 > Signed-off-by: lihong > --- > tests/TestSuite_vm2vm_virtio_pmd.py | 144 > +++++++++++++++++++++++++++--------- > 1 file changed, 110 insertions(+), 34 deletions(-) >=20 > diff --git a/tests/TestSuite_vm2vm_virtio_pmd.py > b/tests/TestSuite_vm2vm_virtio_pmd.py > index 2db020f..68ba73d 100644 > --- a/tests/TestSuite_vm2vm_virtio_pmd.py > +++ b/tests/TestSuite_vm2vm_virtio_pmd.py > @@ -35,6 +35,7 @@ DPDK Test suite. > Test cases for Vhost-user/Virtio-pmd VM2VM Test cases for vhost/virtio- > pmd(0.95/1.0) VM2VM test with 3 rx/tx paths, includes mergeable, normal, > vector_rx. > +Test cases fro vhost/virtio-pmd(1.1) VM2VM test with mergeable path. > About mergeable path check the large packet payload. > """ > import re > @@ -47,18 +48,18 @@ from packet import load_pcapfile >=20 > 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 > self.dump_pcap =3D "/root/pdump-rx.pcap" > + socket_num =3D len(set([int(core['socket']) for core in self.dut= .cores])) > + self.socket_mem =3D ','.join(['1024']*socket_num) > self.base_dir =3D self.dut.base_dir.replace('~', '/root') > + self.vhost_user =3D self.dut.new_session(suite=3D"vhost") > + self.enable_pcap_lib_in_dpdk(self.dut) > + self.virtio_user0 =3D None > + self.virtio_user1 =3D None > + self.flag_compiled =3D False > + self.backup_speed =3D self.dut.skip_setup >=20 > def set_up(self): > """ > @@ -70,10 +71,19 @@ class TestVM2VMVirtioPMD(TestCase): > 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 > + def get_core_list(self, cores_num): > + """ > + create core mask > + """ > + self.core_config =3D "1S/%dC/1T" % cores_num > + self.cores_list =3D self.dut.get_core_list(self.core_config) > + self.verify(len(self.cores_list) >=3D cores_num, > + "There has not enough cores to test this case %s" % > + self.running_case) > + > def enable_pcap_lib_in_dpdk(self, client_dut): > """ > enable pcap lib in dpdk code and recompile @@ -92,17 +102,52 @@ > class TestVM2VMVirtioPMD(TestCase): > """ > launch the testpmd on vhost side > """ > + vhost_mask =3D utils.create_mask(self.cores_list[0:2]) > self.command_line =3D self.dut.target + "/app/testpmd -c %s -n %= d " + \ > - "--socket-mem 2048,2048 --legacy-mem --no-pci --file-prefix= =3Dvhost " + > \ > + "--socket-mem %s --legacy-mem --no-pci --file-prefix=3Dvhost > + " + \ > "--vdev 'net_vhost0,iface=3D%s/vhost-net0,queues=3D1' " + \ > "--vdev 'net_vhost1,iface=3D%s/vhost-net1,queues=3D1' " + \ > "-- -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, > self.base_dir) > - 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) > + vhost_mask, self.memory_channel, self.socket= _mem, > + self.base_dir, self.base_dir) > + self.vhost_user.send_expect(self.command_line, "testpmd> ", 30) > + self.vhost_user.send_expect("set fwd mac", "testpmd> ", 30) > + self.vhost_user.send_expect("start", "testpmd> ", 30) > + > + def start_virtio_testpmd_with_vhost_net1(self, path_mode, > extern_param): > + """ > + launch the testpmd as virtio with vhost_net1 > + """ > + self.virtio_user1 =3D self.dut.new_session(suite=3D"virtio_user1= ") > + virtio_mask =3D utils.create_mask(self.cores_list[2:4]) > + command_line =3D self.dut.target + "/app/testpmd -c %s -n %d " += \ > + "--socket-mem %s --no-pci --file-prefix=3Dvirtio " + \ > + "--vdev=3Dnet_virtio_user1,mac=3D00:01:02:03:04:05,path=3D./= vhost- > net1,queues=3D1,%s " + \ > + "-- -i --nb-cores=3D1 --txd=3D1024 --rxd=3D1024 %s" > + command_line =3D command_line % (virtio_mask, self.memory_channe= l, > + self.socket_mem, path_mode, extern_param) > + self.virtio_user1.send_expect(command_line, 'testpmd> ', 30) > + self.virtio_user1.send_expect('set fwd rxonly', 'testpmd> ', 30) > + self.virtio_user1.send_expect('start', 'testpmd> ', 30) > + > + def start_virtio_testpmd_with_vhost_net0(self, path_mode, > extern_param): > + """ > + launch the testpmd as virtio with vhost_net0 > + """ > + self.virtio_user0 =3D self.dut.new_session(suite=3D"virtio_user0= ") > + virtio_mask =3D utils.create_mask(self.cores_list[4:6]) > + command_line =3D self.dut.target + "/app/testpmd -c %s -n %d " += \ > + "--socket-mem %s --no-pci --file-prefix=3Dvirtio0 " + \ > + "--vdev=3Dnet_virtio_user0,mac=3D00:01:02:03:04:05,path=3D./= vhost- > net0,queues=3D1,%s " + \ > + "-- -i --nb-cores=3D1 --txd=3D1024 --rxd=3D1024 %s" > + command_line =3D command_line % (virtio_mask, self.memory_channe= l, > + self.socket_mem, path_mode, extern_param) > + self.virtio_user0.send_expect(command_line, 'testpmd> ', 30) > + self.virtio_user0.send_expect('set txpkts 2000,2000,2000,2000', > 'testpmd> ', 30) > + self.virtio_user0.send_expect('set burst 1', 'testpmd> ', 30) > + self.virtio_user0.send_expect('start tx_first 10', 'testpmd> ', > + 30) >=20 > def start_vm_testpmd(self, vm_client, path_mode, extern_param=3D""): > """ > @@ -121,15 +166,15 @@ class TestVM2VMVirtioPMD(TestCase): > "--file-prefix=3Dvirtio -- -i --txd=3D1024 --rxd= =3D1024 %s" > vm_client.send_expect(command % extern_param, "testpmd> ", 20) >=20 > - def launch_pdump_in_vm(self, vm_client): > + def launch_pdump_to_capture_pkt(self, client_dut, dump_port): > """ > bootup pdump in VM > """ > - self.vm_dump =3D vm_client.new_session(suite=3D"pdump") > + self.pdump_session =3D client_dut.new_session(suite=3D"pdump") > command_line =3D self.target + "/app/dpdk-pdump " + \ > "-v --file-prefix=3Dvirtio -- " + \ > - "--pdump 'port=3D0,queue=3D*,rx-dev=3D%s,mbuf-size= =3D8000'" > - self.vm_dump.send_expect(command_line % self.dump_pcap, 'Port') > + "--pdump '%s,queue=3D*,rx-dev=3D%s,mbuf-size=3D8000= '" > + self.pdump_session.send_expect(command_line % (dump_port, > + self.dump_pcap), 'Port') >=20 > def start_vms(self, mode=3D0, mergeable=3DTrue): > """ > @@ -147,6 +192,8 @@ class TestVM2VMVirtioPMD(TestCase): > setting_args +=3D "," + "mrg_rxbuf=3Doff" > setting_args +=3D > ",csum=3Don,gso=3Don,guest_csum=3Don,host_tso4=3Don,guest_tso4=3Don,guest= _ecn=3D > on" >=20 > + if self.flag_compiled: > + self.dut.skip_setup =3D True > for i in range(self.vm_num): > vm_dut =3D None > vm_info =3D VM(self.dut, 'vm%d' % i, 'vhost_sample') @@ -166= ,13 > +213,14 @@ class TestVM2VMVirtioPMD(TestCase): >=20 > self.vm_dut.append(vm_dut) > self.vm.append(vm_info) > + self.flag_compiled =3D True >=20 > 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) > + out =3D self.vhost_user.send_expect("show port stats 1", > + "testpmd> ", 60) > time.sleep(5) > - lines =3D re.search("Tx-pps:\s*(\d*)", out) > + lines =3D re.search("Rx-pps:\s*(\d*)", out) > result =3D lines.group(1) > results +=3D float(result) > Mpps =3D results / (1000000 * 10) @@ -201,16 +249,16 @@ class > TestVM2VMVirtioPMD(TestCase): > self.update_table_info(mode, 64, Mpps, path) > self.result_table_print() >=20 > - def check_packet_payload_valid(self, vm_dut): > + def check_packet_payload_valid(self, client_dut): > """ > check the payload is valid > """ > # stop pdump > - self.vm_dump.send_expect('^c', '# ', 60) > + self.pdump_session.send_expect('^c', '# ', 60) > # quit testpmd > - vm_dut.send_expect('quit', '#', 60) > + client_dut.send_expect('quit', '# ', 60) > time.sleep(2) > - vm_dut.session.copy_file_from(src=3D"%s" % self.dump_pcap, dst= =3D"%s" % > self.dump_pcap) > + client_dut.session.copy_file_from(src=3D"%s" % self.dump_pcap, > + dst=3D"%s" % self.dump_pcap) > pkts =3D load_pcapfile(self.dump_pcap) > self.verify(len(pkts) =3D=3D 10, "The vm0 do not capture all the= packets") > data =3D str(pkts[0].pktgen.pkt['Raw']) @@ -222,55 +270,63 @@ cl= ass > TestVM2VMVirtioPMD(TestCase): > 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) > + self.vhost_user.send_expect("quit", "#", 30) > + if self.virtio_user1: > + self.virtio_user1.send_expect('quit', '# ', 30) > + self.dut.close_session(self.virtio_user1) > + self.virtio_user1 =3D None > + if self.virtio_user0: > + self.virtio_user0.send_expect('quit', '# ', 30) > + self.dut.close_session(self.virtio_user0) > + self.virtio_user0 =3D None >=20 > def test_vhost_vm2vm_virtio_pmd_with_normal_path(self): > """ > vhost-user + virtio-pmd with normal path > """ > path_mode =3D "normal" > + self.get_core_list(2) > 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 normal path", path=3Dpa= th_mode) > - self.stop_all_apps() >=20 > def test_vhost_vm2vm_virito_10_pmd_with_normal_path(self): > """ > vhost-user + virtio1.0-pmd with normal path > """ > path_mode =3D "normal" > + self.get_core_list(2) > self.start_vhost_testpmd() > self.start_vms(mode=3D1, 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 1.0 normal path", path=3Dpat= h_mode) > - self.stop_all_apps() >=20 > 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.get_core_list(2) > 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 vector_rx", path=3Dpath= _mode) > - self.stop_all_apps() >=20 > def test_vhost_vm2vm_virtioi10_pmd_with_vector_rx_path(self): > """ > vhost-user + virtio1.0-pmd with vector_rx path > """ > path_mode =3D "vector_rx" > + self.get_core_list(2) > self.start_vhost_testpmd() > self.start_vms(mode=3D1, 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 1.0 vector_rx", path=3Dpath_= mode) > - self.stop_all_apps() >=20 > def test_vhost_vm2vm_virito_pmd_with_mergeable_path(self): > """ > @@ -278,6 +334,8 @@ class TestVM2VMVirtioPMD(TestCase): > """ > path_mode =3D "mergeable" > extern_param =3D '--max-pkt-len=3D9600' > + dump_port =3D 'port=3D0' > + self.get_core_list(2) > self.start_vhost_testpmd() > self.start_vms(mode=3D0, mergeable=3DTrue) > # enable pcap in VM0 > @@ -288,7 +346,7 @@ class TestVM2VMVirtioPMD(TestCase): > self.start_vm_testpmd(self.vm_dut[0], path_mode, extern_param) > self.vm_dut[0].send_expect('set fwd rxonly', 'testpmd> ', 30) > self.vm_dut[0].send_expect('start', 'testpmd> ', 30) > - self.launch_pdump_in_vm(self.vm_dut[0]) > + self.launch_pdump_to_capture_pkt(self.vm_dut[0], dump_port) > # start testpmd in VM1 and start to send packet > self.start_vm_testpmd(self.vm_dut[1], path_mode, extern_param) > self.vm_dut[1].send_expect('set txpkts 2000,2000,2000,2000', 'te= stpmd> > ', 30) @@ -298,7 +356,6 @@ class TestVM2VMVirtioPMD(TestCase): > self.check_packet_payload_valid(self.vm_dut[0]) > # reset the evn in vm > self.disable_pcap_lib_in_dpdk(self.vm_dut[0]) > - self.stop_all_apps() >=20 > def test_vhost_vm2vm_virito_10_pmd_with_mergeable_path(self): > """ > @@ -306,6 +363,8 @@ class TestVM2VMVirtioPMD(TestCase): > """ > path_mode =3D "mergeable" > extern_param =3D '--max-pkt-len=3D9600' > + dump_port =3D 'port=3D0' > + self.get_core_list(2) > self.start_vhost_testpmd() > self.start_vms(mode=3D1, mergeable=3DTrue) > # enable pcap in VM0 > @@ -316,7 +375,7 @@ class TestVM2VMVirtioPMD(TestCase): > self.start_vm_testpmd(self.vm_dut[0], path_mode, extern_param) > self.vm_dut[0].send_expect('set fwd rxonly', 'testpmd> ', 30) > self.vm_dut[0].send_expect('start', 'testpmd> ', 30) > - self.launch_pdump_in_vm(self.vm_dut[0]) > + self.launch_pdump_to_capture_pkt(self.vm_dut[0], dump_port) > # start testpmd in VM1 and start to send packet > self.start_vm_testpmd(self.vm_dut[1], path_mode, extern_param) > self.vm_dut[1].send_expect('set txpkts 2000,2000,2000,2000', 'te= stpmd> > ', 30) @@ -326,13 +385,27 @@ class TestVM2VMVirtioPMD(TestCase): > self.check_packet_payload_valid(self.vm_dut[0]) > # reset the evn in vm > self.disable_pcap_lib_in_dpdk(self.vm_dut[0]) > - self.stop_all_apps() > + > + def test_vhost_vm2vm_virtio_11_pmd_with_mergeable_path(self): > + """ > + vm2vm vhost-user/virtio1.1-pmd mergeable path test with payload > check > + """ > + mode_info =3D 'packed_vq=3D1,mrg_rxbuf=3D1,in_order=3D0' > + extern_param =3D '--max-pkt-len=3D9600' > + dump_port =3D 'device_id=3Dnet_virtio_user1' > + self.get_core_list(6) > + self.start_vhost_testpmd() > + self.start_virtio_testpmd_with_vhost_net1(mode_info, extern_para= m) > + self.launch_pdump_to_capture_pkt(self.dut, dump_port) > + self.start_virtio_testpmd_with_vhost_net0(mode_info, extern_para= m) > + self.check_packet_payload_valid(self.dut) >=20 > def tear_down(self): > # > # Run after each test case. > # > - self.dut.send_expect("killall -s INT testpmd", "#") > + self.stop_all_apps() > + self.dut.kill_all() > self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > time.sleep(2) >=20 > @@ -340,4 +413,7 @@ class TestVM2VMVirtioPMD(TestCase): > """ > Run after each test suite. > """ > + self.disable_pcap_lib_in_dpdk(self.dut) > + self.dut.close_session(self.vhost_user) > + self.dut.skip_setup =3D self.backup_speed > pass > -- > 2.7.4