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 A45E4A0613 for ; Tue, 24 Sep 2019 11:19:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 99DE32BE1; Tue, 24 Sep 2019 11:19:31 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id AF6BE2BBB for ; Tue, 24 Sep 2019 11:19:30 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Sep 2019 02:19:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,543,1559545200"; d="scan'208";a="193393788" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga006.jf.intel.com with ESMTP; 24 Sep 2019 02:19:29 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 24 Sep 2019 02:19:28 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.92]) by shsmsx102.ccr.corp.intel.com ([169.254.2.113]) with mapi id 14.03.0439.000; Tue, 24 Sep 2019 17:19:27 +0800 From: "Tu, Lijuan" To: "Zhu, WenhuiX" , "dts@dpdk.org" CC: "Zhu, WenhuiX" Thread-Topic: [dts] [PATCH V1] tests/virtio_user_as_exceptional_path:add new case Thread-Index: AQHVbtGMTIVIJi2jbEueC5CCwEDQo6c6lKIg Date: Tue, 24 Sep 2019 09:19:26 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB2775D@SHSMSX101.ccr.corp.intel.com> References: <1568887678-30872-1-git-send-email-wenhuix.zhu@intel.com> In-Reply-To: <1568887678-30872-1-git-send-email-wenhuix.zhu@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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTY1NTM5MjYtMzg1Yi00MWEzLWI3OGMtMzhjNWZmNDRmNmNkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZzJ4K0lvSlZUcEZYNVJUekJOZlJYT0p2WkVsUzBucTdjazhWbTBzXC95bFg5NXRreG5tR1FvTGRpSTN2R1I2S0UifQ== 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/virtio_user_as_exceptional_path:add new case 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 zhu wenhui > Sent: Thursday, September 19, 2019 6:08 PM > To: dts@dpdk.org > Cc: Zhu, WenhuiX > Subject: [dts] [PATCH V1] tests/virtio_user_as_exceptional_path:add new > case >=20 > Add new cases. >=20 > Signed-off-by: zhu wenhui > --- > ...stSuite_virtio_user_as_exceptional_path.py | 159 ++++++++++++++---- > 1 file changed, 125 insertions(+), 34 deletions(-) >=20 > diff --git a/tests/TestSuite_virtio_user_as_exceptional_path.py > b/tests/TestSuite_virtio_user_as_exceptional_path.py > index 0330f7e..2ca29ed 100644 > --- a/tests/TestSuite_virtio_user_as_exceptional_path.py > +++ b/tests/TestSuite_virtio_user_as_exceptional_path.py > @@ -38,8 +38,9 @@ import re > import time > import utils > from test_case import TestCase > +from settings import HEADER_SIZE > import vhost_peer_conf as peer > - > +from pktgen import PacketGeneratorHelper >=20 > class TestVirtioUserAsExceptionalPath(TestCase): >=20 > @@ -47,14 +48,42 @@ class TestVirtioUserAsExceptionalPath(TestCase): > # Get and verify the ports > self.dut_ports =3D self.dut.get_ports() > self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > - # Get the port's socket and get the core for testpmd > - self.pf =3D self.dut_ports[0] > - netdev =3D self.dut.ports_info[self.pf]['port'] > + self.memory_channel =3D self.dut.get_memory_channels() > + self.pci0 =3D self.dut.ports_info[0]['pci'] > + pf_info =3D self.dut_ports[0] > + netdev =3D self.dut.ports_info[pf_info]['port'] > self.socket =3D netdev.get_nic_socket() > + self.virtio_ip1 =3D "2.2.2.1" > + self.virtio_ip2 =3D "2.2.2.21" > + self.virtio_mac =3D "52:54:00:00:00:01" > + self.out_path =3D '/tmp' > + > + out =3D self.tester.send_expect('ls -d %s' % self.out_path, '# '= ) > + if 'No such file or directory' in out: > + self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') > + # set diff arg about mem_socket base on socket number > + if len(set([int(core['socket']) for core in self.dut.cores])) = =3D=3D 1: > + self.socket_mem =3D '1024' > + else: > + self.socket_mem =3D '1024,1024' > + self.pktgen_helper =3D PacketGeneratorHelper() > + self.peer_pci_setup =3D False > + self.prepare_dpdk() > + > + def set_up(self): > + # > + # Run before each test case. > + # > + # Clean the execution ENV > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + self.dut.send_expect("killall -s INT testpmd", "#") > + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > + self.dut.send_expect("modprobe vhost-net", "#") > + self.peer_pci_setup =3D False > + > + def get_pci_info_from_cfg(self): > + # Get the port's socket and get the core for testpmd > self.cores =3D self.dut.get_core_list("1S/2C/1T", socket=3Dself.= socket) > - self.virtio_ip1 =3D "1.1.1.2" > - self.virtio_mac1 =3D "52:54:00:00:00:01" > - self.memory_channel =3D self.dut.get_memory_channels() >=20 > self.pci =3D peer.get_pci_info() > self.pci_drv =3D peer.get_pci_driver_info() @@ -71,24 +100,32 @@= class > TestVirtioUserAsExceptionalPath(TestCase): > self.dut.send_expect( > "./usertools/dpdk-devbind.py -b igb_uio %s" % > self.pci, '#', 30) > + self.peer_pci_setup =3D True >=20 > - # set diff arg about mem_socket base on socket number > - if len(set([int(core['socket']) for core in self.dut.cores])) = =3D=3D 1: > - self.socket_mem =3D '1024' > + def launch_testpmd_vhost(self): > + if self.queue =3D=3D 1: > + comment =3D "" > + cores_number =3D 3 > else: > - self.socket_mem =3D '1024,1024' > - > - self.prepare_dpdk() > - > - def set_up(self): > - # > - # Run before each test case. > - # > - # Clean the execution ENV > - self.dut.send_expect("rm -rf ./vhost-net*", "#") > - self.dut.send_expect("killall -s INT testpmd", "#") > - self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > - self.dut.send_expect("modprobe vhost-net", "#") > + comment =3D " --txq=3D2 --rxq=3D2 --nb-cores=3D1" > + cores_number =3D 4 > + cores_config =3D '1S/%sC/1T' % cores_number > + cores_list =3D self.dut.get_core_list(cores_config, socket=3Dsel= f.socket) > + self.verify(len(cores_list) >=3D cores_number, "Failed to get co= res list") > + core_mask =3D utils.create_mask(cores_list[0:2]) > + self.testcmd =3D self.target + "/app/testpmd -c %s -n %d -w %s = --socket- > mem %s" \ > + + " --vdev=3Dvirtio_user0,mac=3D%s,path=3D/dev/v= host-net,"\ > + "queue_size=3D1024,queues=3D%s -- -i --rxd=3D102= 4 --txd=3D1024 %s" > + self.testcmd_start =3D self.testcmd % (core_mask, self.memory_ch= annel, > + self.pci0, self.socket_mem, self.virtio_mac, self.queue,= comment) > + self.vhost_user =3D self.dut.new_session(suite=3D"user") > + self.vhost_user.send_expect(self.testcmd_start, "testpmd> ", 120= ) > + self.vhost_user.send_expect("start", "testpmd>", 120) > + vhost_pid =3D self.dut.send_expect("ps -aux | grep vhost | grep = -v grep | > awk '{print $2}'", "# ") > + vhost_pid_list =3D vhost_pid.split("\r\n") > + self.dut.send_expect("taskset -pc %s %s" % (cores_list[-1], > vhost_pid_list[1]), "# ") > + if self.queue =3D=3D 2: > + self.dut.send_expect("taskset -pc %s %s" % (cores_list[-2], > + vhost_pid_list[2]), "# ") >=20 > def launch_testpmd_exception_path(self): > self.testcmd =3D self.target + "/app/testpmd -c %s -n %d --socke= t-mem %s > --legacy-mem" \ @@ -96,7 +133,7 @@ class > TestVirtioUserAsExceptionalPath(TestCase): > + " --rxd=3D1024 --txd=3D1024" > self.coremask =3D utils.create_mask(self.cores) > self.testcmd_start =3D self.testcmd % (self.coremask, > self.memory_channel, > - self.socket_mem, self.virtio_mac1) > + self.socket_mem, self.virtio_mac) > self.vhost_user =3D self.dut.new_session(suite=3D"user") > self.vhost_user.send_expect("modprobe vhost-net", "#", 120) > self.vhost_user.send_expect(self.testcmd_start, "testpmd> ", 120= ) @@ - > 115,6 +152,12 @@ class TestVirtioUserAsExceptionalPath(TestCase): > self.vhost_user.send_expect("port start 1", "testpmd> ", 120) > self.vhost_user.send_expect("start", "testpmd> ", 120) >=20 > + def set_route_table(self): > + self.dut.send_expect("ifconfig tap0 up", "#") > + self.dut.send_expect("ifconfig tap0 2.2.2.2/24 up", "#") > + self.dut.send_expect("route add -net 2.2.2.0/24 gw 2.2.2.1 dev t= ap0", > "#") > + self.dut.send_expect("arp -s 2.2.2.1 %s" % self.virtio_mac, > + "#") > + > def prepare_tap_device(self): > self.dut.send_expect("ifconfig tap0 up", "#") > self.dut.send_expect("ifconfig tap0 1.1.1.2", "#") @@ -146,6 +18= 9,7 @@ > class TestVirtioUserAsExceptionalPath(TestCase): > self.dut.send_expect( > "sed -i '/parse_ethernet(eth_hdr, &info/i\#endif' ./app/test= - > pmd/csumonly.c", "#") > self.dut.build_install_dpdk(self.dut.target) > + time.sleep(3) >=20 > def unprepare_dpdk(self): > # Recovery the DPDK code to original @@ -172,7 +216,37 @@ class > TestVirtioUserAsExceptionalPath(TestCase): > self.output_result =3D "Iperf throughput is %s" % iperfdata[-1] > self.logger.info(self.output_result) >=20 > + def send_and_verify_loss(self): > + header_row =3D ["Frame Size", "zero_loss_rate", "tx_pkts", "rx_p= kts", > "queue"] > + self.result_table_create(header_row) > + frame_size =3D 64 > + tgen_input =3D [] > + port =3D self.tester.get_local_port(self.dut_ports[0]) > + payload =3D frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip'] = - > HEADER_SIZE['tcp'] > + flow1 =3D 'Ether(dst=3D"%s")/IP(dst=3D"%s", src=3D"%s")/TCP()/("= X"*%d)' % \ > + (self.virtio_mac, self.virtio_ip2, self.virtio_ip1, payl= oad) > + self.tester.scapy_append('wrpcap("%s/exceptional_path.pcap", %s)= ' % > (self.out_path, flow1)) > + self.tester.scapy_execute() > + tgen_input.append((port, port, "%s/exceptional_path.pcap" % > self.out_path)) > + for rate_value in range(20, -1, -1): > + rate_value =3D rate_value * 0.5 > + vm_config =3D {'mac': {'dst': {'range': 1, 'step': 1, 'actio= n': 'inc'}, }, } > + self.tester.pktgen.clear_streams() > + streams =3D > self.pktgen_helper.prepare_stream_from_tginput(tgen_input, rate_value, > vm_config, self.tester.pktgen) > + options =3D {'duration': 5, 'rate': rate_value, 'delay': 5} > + result =3D self.tester.pktgen.measure_loss(stream_ids=3Dstre= ams, > options=3Doptions) > + tx_pkts =3D result[1] > + rx_pkts =3D result[2] > + if tx_pkts - rx_pkts <=3D 20: > + break > + data_row =3D [frame_size, rate_value, tx_pkts, rx_pkts, self.que= ue] > + self.result_table_add(data_row) > + self.result_table_print() > + self.vhost_user.send_expect("quit", "#") > + self.verify(rate_value > 0, "The received package did not reach > + the expected value") > + > def test_vhost_exception_path_TAP_original(self): > + self.get_pci_info_from_cfg() > self.config_kernel_nic_host() > self.launch_testpmd_exception_path() > self.dut.get_session_output(timeout=3D2) > @@ -195,6 +269,7 @@ class TestVirtioUserAsExceptionalPath(TestCase): > self.dut.close_session(self.iperf) >=20 > def test_vhost_exception_path_NIC_original(self): > + self.get_pci_info_from_cfg() > self.config_kernel_nic_host() > self.launch_testpmd_exception_path() > time.sleep(5) > @@ -216,27 +291,43 @@ class TestVirtioUserAsExceptionalPath(TestCase): > self.dut.send_expect("ip netns del ns1", "#") > self.dut.close_session(self.iperf) >=20 > + def test_perf_vhost_single_queue(self): > + self.queue =3D 1 > + self.launch_testpmd_vhost() > + self.set_route_table() > + self.send_and_verify_loss() > + > + def test_perf_vhost_multiple_queue(self): > + self.queue =3D 2 > + self.launch_testpmd_vhost() > + self.set_route_table() > + self.send_and_verify_loss() > + > def tear_down(self): > # > # Run after each test case. > # > + self.dut.kill_all() > + self.dut.close_session(self.vhost_user) > 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", "#") > time.sleep(2) > - self.dut.send_expect( > - "./usertools/dpdk-devbind.py -u %s" % (self.peer_pci), '# ',= 30) > - self.dut.send_expect( > - "./usertools/dpdk-devbind.py -b %s %s" % > - (self.pci_drv, self.peer_pci), '# ', 30) > + if self.peer_pci_setup: > + self.dut.send_expect( > + "./usertools/dpdk-devbind.py -u %s" % (self.peer_pci), '= # ', 30) > + self.dut.send_expect( > + "./usertools/dpdk-devbind.py -b %s %s" % > + (self.pci_drv, self.peer_pci), '# ', 30) >=20 > def tear_down_all(self): > """ > Run after each test suite. > """ > self.unprepare_dpdk() > - self.dut.send_expect( > - "./usertools/dpdk-devbind.py -u %s" % (self.pci), '# ', 30) > - self.dut.send_expect( > - "./usertools/dpdk-devbind.py -b %s %s" % > - (self.pci_drv, self.pci), '# ', 30) > + if self.peer_pci_setup: > + self.dut.send_expect( > + "./usertools/dpdk-devbind.py -u %s" % (self.pci), '# ', = 30) > + self.dut.send_expect( > + "./usertools/dpdk-devbind.py -b %s %s" % > + (self.pci_drv, self.pci), '# ', 30) > -- > 2.17.2