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 892F3A04F0; Fri, 27 Dec 2019 09:30:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6FDD61BFF4; Fri, 27 Dec 2019 09:30:24 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 0D5F31BFEE for ; Fri, 27 Dec 2019 09:30:21 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Dec 2019 00:30:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,362,1571727600"; d="scan'208";a="418220862" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga005.fm.intel.com with ESMTP; 27 Dec 2019 00:30:20 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 27 Dec 2019 00:30:20 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 27 Dec 2019 00:30:19 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx602.amr.corp.intel.com (10.18.126.82) 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, 27 Dec 2019 00:30:19 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.29]) with mapi id 14.03.0439.000; Fri, 27 Dec 2019 16:30:18 +0800 From: "Wang, Yinan" To: "Ma, LihongX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V1] tests/vhost_dequeue_zero_copy: update suite according to plan Thread-Index: AQHVuuMAOsRkvCfDsUu5BIdBhImq5KfKjjywgAMbqtA= Date: Fri, 27 Dec 2019 08:30:17 +0000 Message-ID: References: <1577224391-23714-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjk4ODIxNGItNzU4OC00MWZlLTk1ZmMtZDY0YjQ0YzU0ZGE1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiV21KVDVEMGIzVFpLS0ZVUWhlYVcwenR1XC9zY0VZY0xwR0V0UFlGSis1ZW5RNUpOUG90cVNSdWoza3ZrZjlROFcifQ== 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/vhost_dequeue_zero_copy: update suite 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" Acked-by: Wang, Yinan > -----Original Message----- > From: Ma, LihongX > Sent: 2019=1B$BG/=1B(B12=1B$B7n=1B(B25=1B$BF|=1B(B 17:03 > To: dts@dpdk.org > Cc: Wang, Yinan > Subject: RE: [dts][PATCH V1] tests/vhost_dequeue_zero_copy: update suite > according to plan >=20 > Tested-by:ma,lihong >=20 > -----Original Message----- > From: Ma, LihongX > Sent: Wednesday, December 25, 2019 5:53 AM > To: dts@dpdk.org > Cc: Wang, Yinan ; Ma, LihongX > > Subject: [dts][PATCH V1] tests/vhost_dequeue_zero_copy: update suite > according to plan >=20 > Signed-off-by: lihong > --- > tests/TestSuite_vhost_dequeue_zero_copy.py | 393 > +++++++++++++++++++---------- > 1 file changed, 261 insertions(+), 132 deletions(-) >=20 > diff --git a/tests/TestSuite_vhost_dequeue_zero_copy.py > b/tests/TestSuite_vhost_dequeue_zero_copy.py > index 5705064..4052437 100644 > --- a/tests/TestSuite_vhost_dequeue_zero_copy.py > +++ b/tests/TestSuite_vhost_dequeue_zero_copy.py > @@ -38,6 +38,7 @@ There are three topology test (PVP/VM2VM/VM2NIC) for > this feature. > And this testsuite implement the topology of PVP. > Testsuite vm2vm_net_perf implement the topology VM2VM Testsuite gso > implement the topology VM2NIC > +To run this suite, the qemu version should support packed ring. > """ > import utils > import time > @@ -45,7 +46,8 @@ import re > from settings import HEADER_SIZE > from virt_common import VM > from test_case import TestCase > -from pktgen import PacketGeneratorHelper > +from packet import Packet > +from pktgen import TRANSMIT_CONT >=20 >=20 > class TestVhostDequeueZeroCopy(TestCase): > @@ -54,19 +56,19 @@ class TestVhostDequeueZeroCopy(TestCase): > """ > Run at the start of each test suite. > """ > + self.verify(self.nic in ("fortville_spirit"), "the port can not > + run this suite") >=20 > self.tester.extend_external_packet_generator(TestVhostDequeueZeroCopy, se= lf) > self.frame_sizes =3D [64, 128, 256, 512, 1024, 1518] > - self.queue_number =3D 1 > - self.nb_cores =3D 1 > self.dut_ports =3D self.dut.get_ports() > self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for = testing") > self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) > - self.cores_num =3D len([n for n in self.dut.cores if int(n['sock= et']) > - =3D=3D self.ports_socket]) > - self.mem_channels =3D self.dut.get_memory_channels() > self.dst_mac =3D self.dut.get_mac_address(self.dut_ports[0]) > + self.tx_port =3D self.tester.get_local_port(self.dut_ports[0]) > + self.port_pci =3D self.dut.ports_info[self.dut_ports[0]]['pci'] > self.vm_dut =3D None > + self.virtio_user =3D None > self.virtio1_mac =3D "52:54:00:00:00:01" > + self.header_size =3D HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + > + HEADER_SIZE['udp'] >=20 > self.logger.info("you can config packet_size in file %s.cfg," % > self.suite_name + \ > "in region 'suite' like packet_sizes=3D[64, 128, 256= ]") > @@ -74,64 +76,93 @@ class TestVhostDequeueZeroCopy(TestCase): > if 'packet_sizes' in self.get_suite_cfg(): > self.frame_sizes =3D self.get_suite_cfg()['packet_sizes'] >=20 > - 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, '# ') > - # create an instance to set stream field setting > - self.pktgen_helper =3D PacketGeneratorHelper() > self.base_dir =3D self.dut.base_dir.replace('~', '/root') > + self.vhost_user =3D self.dut.new_session(suite=3D"vhost-user") >=20 > def set_up(self): > """ > Run before each test case. > """ > # Clean the execution ENV > - 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, "#"= ) > # Prepare the result table > self.table_header =3D ["FrameSize(B)", "Throughput(Mpps)", > "% linerate", "Queue number", "Cycle"] > self.result_table_create(self.table_header) > + self.vm_dut =3D None > + self.big_pkt_record =3D {} >=20 > - self.vhost =3D self.dut.new_session(suite=3D"vhost-user") > - > - def get_core_mask(self): > + def get_core_list(self): > """ > check whether the server has enough cores to run case > + if want to get the best perf of the vhost, the vhost tesptmd at = least > + should have 3 cores to start testpmd > """ > - core_config =3D "1S/%dC/1T" % (self.nb_cores + 1) > - self.verify(self.cores_num >=3D (self.nb_cores + 1), > - "There has not enought cores to test this case %s" % > self.running_case) > - core_list =3D self.dut.get_core_list( > + if self.nb_cores =3D=3D 1: > + cores_num =3D 2 > + else: > + cores_num =3D 1 > + core_config =3D "1S/%dC/1T" % (self.nb_cores + cores_num) > + self.core_list =3D self.dut.get_core_list( > core_config, socket=3Dself.ports_socket) > - self.core_mask =3D utils.create_mask(core_list) > + self.verify(len(self.core_list) >=3D (self.nb_cores + cores_num)= , > + "There has not enought cores to test this case %s" % > + self.running_case) >=20 > - def launch_testpmd_on_vhost(self, txfreet): > + def launch_testpmd_as_vhost(self, txfreet, zero_copy=3DTrue, > client_mode=3DFalse): > """ > launch testpmd on vhost > """ > - self.get_core_mask() > + self.get_core_list() >=20 > + mode_info =3D "" > + if client_mode is True: > + mode_info =3D ',client=3D1' > + zero_copy_info =3D 1 > + if zero_copy is False: > + zero_copy_info =3D 0 > if txfreet =3D=3D "normal": > - txfreet_args =3D "--txfreet=3D992" > + txfreet_args =3D "--txd=3D1024 --rxd=3D1024 --txfreet=3D992" > elif txfreet =3D=3D "maximum": > - txfreet_args =3D "--txfreet=3D1020 --txrs=3D4" > - command_client =3D self.dut.target + "/app/testpmd " + \ > - " -n %d -c %s --socket-mem 1024,1024 " + \ > - " --legacy-mem --file-prefix=3Dvhost " + \ > - " --vdev > 'eth_vhost0,iface=3D%s/vhost-net,queues=3D%d,dequeue-zero-copy=3D1' " + \ > - " -- -i --nb-cores=3D%d --rxq=3D%d --txq=3D%d "= + \ > - "--txd=3D1024 --rxd=3D1024 %s" > + txfreet_args =3D "--txrs=3D4 --txd=3D992 --rxd=3D992 --txfre= et=3D988" > + elif txfreet =3D=3D "vector_rx": > + txfreet_args =3D "--txd=3D1024 --rxd=3D1024 --txfreet=3D992 = --txrs=3D32" > + > + eal_params =3D self.dut.create_eal_parameters(cores=3Dself.core_= list, > + prefix=3D'vhost', ports=3D[self.port_pci]) > + command_client =3D self.dut.target + "/app/testpmd %s " + \ > + " --socket-mem 1024,1024 --legacy-mem " + \ > + " --vdev > 'eth_vhost0,iface=3D%s/vhost-net,queues=3D%d,dequeue-zero-copy=3D%d%s' " = + \ > + " -- -i --nb-cores=3D%d --rxq=3D%d --txq=3D%d %= s" > command_line_client =3D command_client % ( > - self.mem_channels, self.core_mask, self.base_dir, > - self.queue_number, self.nb_cores, > + eal_params, self.base_dir, self.queue_number, > + zero_copy_info, mode_info, self.nb_cores, > self.queue_number, self.queue_number, txfreet_args) > - self.vhost.send_expect(command_line_client, "testpmd> ", 120) > - self.vhost.send_expect("set fwd mac", "testpmd> ", 120) > + self.vhost_user.send_expect(command_line_client, "testpmd> ", 12= 0) > + self.vhost_user.send_expect("set fwd mac", "testpmd> ", 120) >=20 > - def launch_testpmd_on_vm(self): > + def launch_testpmd_as_virtio_user(self, path_mode): > + """ > + launch testpmd use vhost-net with path mode > + """ > + # To get the best perf, the vhost and virtio testpmd should not = use > same cores, > + # so get the additional 3 cores to start virtio testpmd > + core_config =3D "1S/%dC/1T" % (len(self.core_list) + 3) > + core_list =3D self.dut.get_core_list( > + core_config, socket=3Dself.ports_socket) > + self.verify(len(core_list) >=3D (len(self.core_list) + 3), > + "There has not enought cores to test this case %s" % > self.running_case) > + eal_params =3D > self.dut.create_eal_parameters(cores=3Dcore_list[len(self.core_list):], > + prefix=3D'virtio', no_pci=3DTrue) > + command_line =3D self.dut.target + "/app/testpmd %s " + \ > + "--socket-mem 1024,1024 --legacy-mem " + \ > + > "--vdev=3Dnet_virtio_user0,mac=3D00:01:02:03:04:05,path=3D./vhost-net,que= ue_size=3D > 1024,%s " + \ > + "-- -i --tx-offloads=3D0x0 --nb-cores=3D%d --txd= =3D1024 > --rxd=3D1024" > + command_line =3D command_line % (eal_params, path_mode, > self.nb_cores) > + self.virtio_user.send_expect(command_line, 'testpmd> ', 120) > + self.virtio_user.send_expect('set fwd mac', 'testpmd> ', 120) > + self.virtio_user.send_expect('start', 'testpmd> ', 120) > + > + def start_testpmd_on_vm(self, fwd_mode=3D'mac'): > """ > start testpmd in vm depend on different path > """ > @@ -142,12 +173,12 @@ class TestVhostDequeueZeroCopy(TestCase): > command_line =3D command % (self.nb_cores, > self.queue_number, > self.queue_number) > self.vm_dut.send_expect(command_line, "testpmd> ", 30) > + self.vm_dut.send_expect('set fwd %s' % fwd_mode, "testpmd> ", 30= ) > + self.vm_dut.send_expect('start', "testpmd> ", 30) >=20 > - def relaunch_testpmd_on_vm(self): > + def restart_testpmd_on_vm(self, fwd_mode): > self.vm_dut.send_expect("quit", "# ", 30) > - self.launch_testpmd_on_vm() > - self.vm_dut.send_expect("set fwd mac", "testpmd> ", 30) > - self.vm_dut.send_expect("start", "testpmd> ", 30) > + self.start_testpmd_on_vm(fwd_mode) >=20 > def set_vm_vcpu(self): > """ > @@ -166,7 +197,7 @@ class TestVhostDequeueZeroCopy(TestCase): > if 'cpupin' in self.vm.params[i]['cpu'][0].keys(): > self.vm.params[i]['cpu'][0].pop('cpupin') >=20 > - def start_one_vm(self): > + def start_one_vm(self, mode=3D'client', packed=3DFalse): > """ > start qemu > """ > @@ -176,10 +207,14 @@ class TestVhostDequeueZeroCopy(TestCase): > vm_params['driver'] =3D 'vhost-user' > vm_params['opt_path'] =3D '%s/vhost-net' % self.base_dir > vm_params['opt_mac'] =3D self.virtio1_mac > + if mode =3D=3D 'server': > + vm_params['opt_server'] =3D 'server' > opt_args =3D > "mrg_rxbuf=3Don,rx_queue_size=3D1024,tx_queue_size=3D1024" > if self.queue_number > 1: > vm_params['opt_queue'] =3D self.queue_number > opt_args +=3D ",mq=3Don,vectors=3D%d" % (2*self.queue_number= + 2) > + if packed is True: > + opt_args +=3D ',packed=3Don' > vm_params['opt_settings'] =3D opt_args > self.vm.set_vm_device(**vm_params) > self.set_vm_vcpu() > @@ -190,7 +225,26 @@ class TestVhostDequeueZeroCopy(TestCase): > if self.vm_dut is None: > raise Exception("Set up VM ENV failed") > except Exception as e: > - self.logger.error("ERROR: Failure for %s" % str(e)) > + self.logger.error("ERROR: Failure for %s, " % str(e) + \ > + "if 'packed not found' in output of start qemu log, = " + \ > + "please use the qemu version which support packed > ring") > + raise e > + > + def prepare_test_evn(self, vhost_txfreet_mode, vhost_zero_copy, > vhost_client_mode, > + vm_testpmd_fwd_mode, packed_mode): > + """ > + start vhost testpmd and launch qemu, start testpmd on vm > + """ > + if vhost_client_mode is True: > + vm_mode =3D 'server' > + else: > + vm_mode =3D 'client' > + self.launch_testpmd_as_vhost(txfreet=3Dvhost_txfreet_mode, > zero_copy=3Dvhost_zero_copy, > + client_mode=3Dvhost_client_mode) > + self.start_one_vm(mode=3Dvm_mode, packed=3Dpacked_mode) > + self.start_testpmd_on_vm(fwd_mode=3Dvm_testpmd_fwd_mode) > + # start testpmd at host side after VM and virtio-pmd launched > + self.vhost_user.send_expect("start", "testpmd> ", 120) >=20 > def update_table_info(self, frame_size, Mpps, throughtput, cycle): > results_row =3D [frame_size] > @@ -200,50 +254,64 @@ class TestVhostDequeueZeroCopy(TestCase): > results_row.append(cycle) > self.result_table_add(results_row) >=20 > - def set_fields(self): > - """ > - set ip protocol field behavior > - """ > - fields_config =3D {'ip': {'dst': {'action': 'random'}, }, } > - return fields_config > + # record the big pkt Mpps > + if frame_size =3D=3D 1518: > + self.big_pkt_record[cycle] =3D Mpps >=20 > - def calculate_avg_throughput(self, frame_size, loopback): > + def calculate_avg_throughput(self, frame_size, fwd_mode): > """ > start to send packet and get the throughput > """ > - payload =3D frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip'] = - > HEADER_SIZE['udp'] > - flow =3D > '[Ether(dst=3D"%s")/IP(src=3D"192.168.4.1",proto=3D255)/UDP()/("X"*%d)]' = % ( > + payload =3D frame_size - self.header_size > + flow =3D > + 'Ether(dst=3D"%s")/IP(src=3D"192.168.4.1",proto=3D255)/UDP(sport=3D33,d= port=3D34 > + )/("X"*%d)' % ( > self.dst_mac, payload) > - self.tester.scapy_append('wrpcap("%s/zero_copy.pcap", %s)' % ( > - self.out_path, flow)) > - self.tester.scapy_execute() > - > - tgenInput =3D [] > - port =3D self.tester.get_local_port(self.dut_ports[0]) > - tgenInput.append((port, port, "%s/zero_copy.pcap" % self.out_pat= h)) > - vm_config =3D self.set_fields() > + pkt =3D Packet(pkt_str=3Dflow) > + pkt.save_pcapfile(self.tester, "%s/zero_copy.pcap" % > self.tester.tmp_file) > + stream_option =3D { > + 'pcap': "%s/zero_copy.pcap" % self.tester.tmp_file, > + 'fields_config': { > + 'ip': {'src': {'action': 'random', 'start': '16.0.0.1', = 'step': 1, > 'end': '16.0.0.64'}}}, > + 'stream_config': { > + 'rate': 100, > + 'transmit_mode': TRANSMIT_CONT, > + } > + } > self.tester.pktgen.clear_streams() > - streams =3D > self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100, vm_config, > self.tester.pktgen) > - # set traffic option > - traffic_opt =3D {'delay': 5, 'duration': 20} > - _, pps =3D self.tester.pktgen.measure_throughput(stream_ids=3Dst= reams, > options=3Dtraffic_opt) > - Mpps =3D pps / 1000000.0 > + stream_id =3D self.tester.pktgen.add_stream(self.tx_port, self.t= x_port, > + "%s/zero_copy.pcap" % > self.tester.tmp_file) > + self.tester.pktgen.config_stream(stream_id, stream_option) > + traffic_opt =3D { > + 'method': 'throughput', > + 'rate': 100, > + 'interval': 6, > + 'duration': 30} > + stats =3D self.tester.pktgen.measure([stream_id], traffic_opt) > + > + if isinstance(stats, list): > + # if get multi result, ignore the first one, because it may = not > stable > + num =3D len(stats) > + Mpps =3D 0 > + for index in range(1, num): > + Mpps +=3D stats[index][1] > + Mpps =3D Mpps / 1000000.0 / (num-1) > + else: > + Mpps =3D stats[1] / 1000000.0 > # when the fwd mode is rxonly, we can not receive data, so shoul= d > not verify it > - if loopback !=3D "rxonly": > + if fwd_mode !=3D "rxonly": > self.verify(Mpps > 0, "can not receive packets of frame size= %d" % > (frame_size)) > throughput =3D Mpps * 100 / \ > float(self.wirespeed(self.nic, frame_size, 1)) > return Mpps, throughput >=20 > - def check_packets_of_each_queue(self, frame_size, loopback): > + def check_packets_of_each_queue(self, frame_size, fwd_mode): > """ > check each queue has receive packets > """ > - if loopback =3D=3D "rxonly": > + if fwd_mode =3D=3D "rxonly": > verify_port =3D 1 > else: > verify_port =3D 2 > - out =3D self.vhost.send_expect("stop", "testpmd> ", 60) > + out =3D self.vhost_user.send_expect("stop", "testpmd> ", 60) > for port_index in range(0, verify_port): > for queue_index in range(0, self.queue_number): > queue_info =3D re.findall("RX\s*Port=3D\s*%d/Queue=3D\s*= %d" % > @@ -260,9 +328,9 @@ class TestVhostDequeueZeroCopy(TestCase): > "frame_size:%d, rx-packets:%d, tx-packets:%d" % > (frame_size, rx_packets, tx_packets)) >=20 > - self.vhost.send_expect("start", "testpmd> ", 60) > + self.vhost_user.send_expect("start", "testpmd> ", 60) >=20 > - def send_and_verify(self, cycle=3D"", loopback=3D""): > + def send_and_verify_throughput(self, cycle=3D"", fwd_mode=3D""): > """ > start to send packets and verify it > """ > @@ -270,110 +338,171 @@ class TestVhostDequeueZeroCopy(TestCase): > info =3D "Running test %s, and %d frame size." % > (self.running_case, frame_size) > self.logger.info(info) >=20 > - Mpps, throughput =3D self.calculate_avg_throughput(frame_siz= e, > loopback) > - if loopback !=3D "rxonly": > + Mpps, throughput =3D self.calculate_avg_throughput(frame_siz= e, > fwd_mode) > + if fwd_mode !=3D "rxonly": > self.update_table_info(frame_size, Mpps, throughput, > cycle) > # when multi queues, check each queue can receive packets > if self.queue_number > 1: > - self.check_packets_of_each_queue(frame_size, loopback) > + self.check_packets_of_each_queue(frame_size, > fwd_mode) > + > + def check_perf_drop_between_with_and_without_zero_copy(self): > + """ > + for dequeue-zero-copy=3D0, about the small pkts we expect ~10% g= ain > + compare to dequeue-zero-copy=3D1 > + """ > + value_with_zero_copy =3D 0 > + value_without_zero_copy =3D 0 > + if 'dequeue-zero-copy=3D1' in self.big_pkt_record.keys(): > + value_with_zero_copy =3D > self.big_pkt_record['dequeue-zero-copy=3D1'] > + if 'dequeue-zero-copy=3D0' in self.big_pkt_record.keys(): > + value_without_zero_copy =3D > self.big_pkt_record['dequeue-zero-copy=3D0'] > + self.verify(value_with_zero_copy !=3D 0 and > value_without_zero_copy !=3D 0, > + 'can not get the value of big pkts, please check > self.frame_sizes') > + self.verify(value_with_zero_copy - value_without_zero_copy >=3D > value_with_zero_copy*0.1, > + 'the drop with dequeue-zero-copy=3D0 is not as expected'= ) >=20 > def close_all_testpmd_and_vm(self): > """ > close testpmd about vhost-user and vm_testpmd > """ > - self.vhost.send_expect("quit", "#", 60) > - self.vm_dut.send_expect("quit", "#", 60) > - self.dut.close_session(self.vhost) > - self.vm.stop() > + if getattr(self, 'vhost_user', None): > + self.vhost_user.send_expect("quit", "#", 60) > + if getattr(self, 'virtio_user', None): > + self.virtio_user.send_expect("quit", "#", 60) > + self.dut.close_session(self.virtio_user) > + self.virtio_user =3D None > + if getattr(self, 'vm_dut', None): > + self.vm_dut.send_expect("quit", "#", 60) > + self.vm.stop() >=20 > - def test_perf_pvp_dequeue_zero_copy(self): > + def test_perf_pvp_split_ring_dequeue_zero_copy(self): > """ > - performance of pvp zero-copy with [frame_sizes] > + pvp split ring dequeue zero-copy test > """ > self.nb_cores =3D 1 > self.queue_number =3D 1 > - self.launch_testpmd_on_vhost(txfreet=3D"normal") > - self.start_one_vm() > - self.launch_testpmd_on_vm() > - # set fwd mode on vm > - self.vm_dut.send_expect("set fwd mac", "testpmd> ", 30) > - self.vm_dut.send_expect("start", "testpmd> ", 30) > - # start testpmd at host side after VM and virtio-pmd launched > - self.vhost.send_expect("start", "testpmd> ", 120) > - self.send_and_verify() > + self.logger.info('start vhost testpmd with dequeue-zero-copy=3D1= to > test') > + self.prepare_test_evn(vhost_txfreet_mode=3D'normal', > vhost_zero_copy=3DTrue, > + vhost_client_mode=3DFalse, > vm_testpmd_fwd_mode=3D'mac', packed_mode=3DFalse) > + self.send_and_verify_throughput(cycle=3D'dequeue-zero-copy=3D1') > + > self.close_all_testpmd_and_vm() > + self.logger.info('start vhost testpmd with dequeue-zero-copy=3D0= to > test') > + self.prepare_test_evn(vhost_txfreet_mode=3D'normal', > vhost_zero_copy=3DFalse, > + vhost_client_mode=3DFalse, > vm_testpmd_fwd_mode=3D'mac', packed_mode=3DFalse) > + self.send_and_verify_throughput(cycle=3D'dequeue-zero-copy=3D0') > self.result_table_print() > + self.check_perf_drop_between_with_and_without_zero_copy() >=20 > - def test_perf_pvp_dequeue_zero_copy_with_2_queue(self): > + def test_perf_pvp_packed_ring_dequeue_zero_copy(self): > """ > - pvp dequeue zero-copy test with 2 queues > + pvp packed ring dequeue zero-copy test > + """ > + self.nb_cores =3D 1 > + self.queue_number =3D 1 > + self.logger.info('start vhost testpmd with dequeue-zero-copy=3D1= to > test') > + self.prepare_test_evn(vhost_txfreet_mode=3D'normal', > vhost_zero_copy=3DTrue, > + vhost_client_mode=3DFalse, > vm_testpmd_fwd_mode=3D'mac', packed_mode=3DTrue) > + self.send_and_verify_throughput(cycle=3D'dequeue-zero-copy=3D1') > + > + self.close_all_testpmd_and_vm() > + self.logger.info('start vhost testpmd with dequeue-zero-copy=3D0= to > test') > + self.prepare_test_evn(vhost_txfreet_mode=3D'normal', > vhost_zero_copy=3DFalse, > + vhost_client_mode=3DFalse, > vm_testpmd_fwd_mode=3D'mac', packed_mode=3DTrue) > + self.send_and_verify_throughput(cycle=3D'dequeue-zero-copy=3D0') > + self.result_table_print() > + self.check_perf_drop_between_with_and_without_zero_copy() > + > + def test_perf_pvp_split_ring_dequeue_zero_copy_with_2_queue(self): > + """ > + pvp split ring dequeue zero-copy test with 2 queues > """ > self.nb_cores =3D 2 > self.queue_number =3D 2 > - self.launch_testpmd_on_vhost(txfreet=3D"normal") > - self.start_one_vm() > - self.launch_testpmd_on_vm() > - # set fwd mode on vm > - self.vm_dut.send_expect("set fwd mac", "testpmd> ", 30) > - self.vm_dut.send_expect("start", "testpmd> ", 30) > - # start testpmd at host side after VM and virtio-pmd launched > - self.vhost.send_expect("start", "testpmd> ", 120) > - # when multi queues, the function will check each queue can rece= ive > packets > - self.send_and_verify() > - self.close_all_testpmd_and_vm() > + self.prepare_test_evn(vhost_txfreet_mode=3D'normal', > vhost_zero_copy=3DTrue, > + vhost_client_mode=3DFalse, > vm_testpmd_fwd_mode=3D'mac', packed_mode=3DFalse) > + self.send_and_verify_throughput(cycle=3D'dequeue-zero-copy=3D1') > self.result_table_print() >=20 > - def test_perf_pvp_dequeue_zero_copy_with_driver_unload(self): > + def > test_perf_pvp_packed_ring_dequeue_zero_copy_with_2_queue(self): > """ > - pvp dequeue zero-copy test with driver unload test > + pvp packed ring dequeue zero-copy test with 2 queues > + """ > + self.nb_cores =3D 2 > + self.queue_number =3D 2 > + self.prepare_test_evn(vhost_txfreet_mode=3D'normal', > vhost_zero_copy=3DTrue, > + vhost_client_mode=3DFalse, > vm_testpmd_fwd_mode=3D'mac', packed_mode=3DTrue) > + self.send_and_verify_throughput(cycle=3D'dequeue-zero-copy=3D1') > + self.result_table_print() > + > + def > test_perf_pvp_split_ring_dequeue_zero_copy_with_driver_unload(self): > + """ > + pvp split ring dequeue zero-copy test with driver reload test > """ > self.nb_cores =3D 4 > self.queue_number =3D 16 > - self.launch_testpmd_on_vhost(txfreet=3D"normal") > - self.start_one_vm() > - self.launch_testpmd_on_vm() > - # set fwd mode on vm > - self.vm_dut.send_expect("set fwd rxonly", "testpmd> ", 30) > - self.vm_dut.send_expect("start", "testpmd> ", 30) > - # start testpmd at host side after VM and virtio-pmd launched > - self.vhost.send_expect("start", "testpmd> ", 120) > - # when multi queues, the function will check each queue can rece= ive > packets > - self.send_and_verify(cycle=3D"befor relaunch", loopback=3D"rxonl= y") > + self.prepare_test_evn(vhost_txfreet_mode=3D'normal', > vhost_zero_copy=3DTrue, > + vhost_client_mode=3DTrue, > vm_testpmd_fwd_mode=3D'rxonly', packed_mode=3DFalse) > + self.send_and_verify_throughput(cycle=3D"before relaunch", > + fwd_mode=3D"rxonly") >=20 > # relaunch testpmd at virtio side in VM for driver reloading > - self.relaunch_testpmd_on_vm() > - self.send_and_verify(cycle=3D"after relaunch") > - self.close_all_testpmd_and_vm() > + self.restart_testpmd_on_vm(fwd_mode=3D'mac') > + self.send_and_verify_throughput(cycle=3D"after relaunch") > self.result_table_print() >=20 > - def test_perf_pvp_dequeue_zero_copy_with_maximum_txfreet(self): > + def > test_perf_pvp_packed_ring_dequeue_zero_copy_with_driver_unload(self): > """ > - pvp dequeue zero-copy test with maximum txfreet > + pvp packed ring dequeue zero-copy test with driver reload test > """ > self.nb_cores =3D 4 > self.queue_number =3D 16 > - self.launch_testpmd_on_vhost(txfreet=3D"maximum") > - self.start_one_vm() > - self.launch_testpmd_on_vm() > - # set fwd mode on vm > - self.vm_dut.send_expect("set fwd mac", "testpmd> ", 30) > - self.vm_dut.send_expect("start", "testpmd> ", 30) > - # start testpmd at host side after VM and virtio-pmd launched > - self.vhost.send_expect("start", "testpmd> ", 120) > - # when multi queues, the function will check each queue can rece= ive > packets > - self.send_and_verify() > - self.close_all_testpmd_and_vm() > + self.prepare_test_evn(vhost_txfreet_mode=3D'normal', > vhost_zero_copy=3DTrue, > + vhost_client_mode=3DTrue, > vm_testpmd_fwd_mode=3D'rxonly', packed_mode=3DTrue) > + self.send_and_verify_throughput(cycle=3D"before relaunch", > + fwd_mode=3D"rxonly") > + > + # relaunch testpmd at virtio side in VM for driver reloading > + self.restart_testpmd_on_vm(fwd_mode=3D'mac') > + self.send_and_verify_throughput(cycle=3D"after relaunch") > + self.result_table_print() > + > + def > test_perf_pvp_split_ring_dequeue_zero_copy_with_maximum_txfreet(self): > + """ > + pvp split ring dequeue zero-copy test with maximum txfreet > + """ > + self.nb_cores =3D 4 > + self.queue_number =3D 16 > + self.prepare_test_evn(vhost_txfreet_mode=3D'maximum', > vhost_zero_copy=3DTrue, > + vhost_client_mode=3DTrue, > vm_testpmd_fwd_mode=3D'mac', packed_mode=3DFalse) > + self.send_and_verify_throughput(cycle=3D'dequeue-zero-copy=3D1') > + self.result_table_print() > + > + def test_perf_pvp_split_ring_dequeue_zero_copy_with_vector_rx(self): > + """ > + pvp split ring dequeue zero-copy test with vector_rx path > + """ > + self.nb_cores =3D 1 > + self.queue_number =3D 1 > + path_mode =3D 'packed_vq=3D0,in_order=3D0,mrg_rxbuf=3D0' > + self.virtio_user =3D self.dut.new_session(suite=3D"virtio-user") > + > + self.logger.info('start vhost testpmd with dequeue-zero-copy=3D1= to > test') > + self.launch_testpmd_as_vhost(txfreet=3D"vector_rx", zero_copy=3D= True, > client_mode=3DFalse) > + self.vhost_user.send_expect("start", "testpmd> ", 120) > + self.launch_testpmd_as_virtio_user(path_mode) > + self.send_and_verify_throughput(cycle=3D'dequeue-zero-copy=3D1') > self.result_table_print() >=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.close_all_testpmd_and_vm() > + self.dut.kill_all() > time.sleep(2) >=20 > def tear_down_all(self): > """ > Run after each test suite. > """ > + if getattr(self, 'vhost_user', None): > + self.dut.close_session(self.vhost_user) > -- > 2.7.4