From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 6A99A8F9E for ; Fri, 22 Jan 2016 03:33:25 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP; 21 Jan 2016 18:33:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,328,1449561600"; d="scan'208";a="33961980" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 21 Jan 2016 18:33:24 -0800 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 21 Jan 2016 18:33:23 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 21 Jan 2016 18:33:23 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.172]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.209]) with mapi id 14.03.0248.002; Fri, 22 Jan 2016 10:33:20 +0800 From: "Fu, JingguoX" To: "Xu, Qian Q" , "dts@dpdk.org" Thread-Topic: [DTS][PATCH 2/3] virtio: update vhost user cases Thread-Index: AQHRVBcAJD2eTaswIk2W7vQQKxpCKJ8Fl7owgAAP4DCAAR8JgIAACEbg Date: Fri, 22 Jan 2016 02:33:21 +0000 Message-ID: <6BD6202160B55B409D423293115822622BA9971A@shsmsx102.ccr.corp.intel.com> References: <1453358572-30310-1-git-send-email-jingguox.fu@intel.com> <1453358572-30310-2-git-send-email-jingguox.fu@intel.com> <82F45D86ADE5454A95A89742C8D1410E031BBF13@shsmsx102.ccr.corp.intel.com> <6BD6202160B55B409D423293115822622BA9917A@shsmsx102.ccr.corp.intel.com> <82F45D86ADE5454A95A89742C8D1410E031BC562@shsmsx102.ccr.corp.intel.com> In-Reply-To: <82F45D86ADE5454A95A89742C8D1410E031BC562@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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] [DTS][PATCH 2/3] virtio: update vhost user cases 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: , X-List-Received-Date: Fri, 22 Jan 2016 02:33:26 -0000 Ok, as we discussion , I update the table head title by patch: virtio-updat= e-virtio-data-table-head-title-format.patch Thanks, Jingguo Fu -----Original Message----- From: Xu, Qian Q=20 Sent: Friday, January 22, 2016 9:55 AM To: Fu, JingguoX; dts@dpdk.org Cc: Liu, Yong; Xu, Qian Q Subject: RE: [DTS][PATCH 2/3] virtio: update vhost user cases Jingguo I'm fine with item1 and item3, but as to item2, the logic is correct and it= 's similar as we test PF performance, all nic port will RX ixia traffic and= TX the traffic back to IXIA, when testing performance, we default take tra= ffic is 100% Linerate, and the traffic return to IXIA is called throughput,= since virtio/NIC port will do RX and TX, so if you say it's TX, it's not a= ccurate, so we can say it's throughput which will not cause confusion. Does= it make sense?=20 Thanks Qian -----Original Message----- From: Fu, JingguoX Sent: Thursday, January 21, 2016 5:03 PM To: Xu, Qian Q; dts@dpdk.org Cc: Liu, Yong Subject: RE: [DTS][PATCH 2/3] virtio: update vhost user cases Hi, qian For self.dut.send_expect("rm -rf ./vhost-net", "#", 20), I found that somet= imes it could not remove when the case failed at some different stages, so = I put it at set_up() stage for each case, to make sure that when a new ca= se start, it would not affect by the vhost-net from the prior case. For recvpkt and send pkt, I think the logic as bellows: For ixia, it will send packet to a virtio device, then the first virtio dev= ice will receive packets, and it will forward the packets to the second vir= tio device. At last, the second virtio will send out the packets it receive= d, then from IXIA end, we see the receive rate.=20 This logic based on the discussion with Ouyang Changchun originally. If we = need to re-define it , maybe we can set a quickly discussion for it. And at last, for the data table, originally we put the mode and case name t= o the table, we receive some comments for remove them. So now, it will disa= ppear from the table. For my part, I don't think it necessary to put them i= nto the table. Every case has its own table, and it seems too much redunda= nt info if put them in the table. =20 Thanks, Jingguo Fu -----Original Message----- From: Xu, Qian Q Sent: Thursday, January 21, 2016 3:58 PM To: Fu, JingguoX; dts@dpdk.org Cc: Liu, Yong Subject: RE: [DTS][PATCH 2/3] virtio: update vhost user cases See my comments below.=20 Thanks Qian -----Original Message----- From: Fu, JingguoX Sent: Thursday, January 21, 2016 2:43 PM To: dts@dpdk.org Cc: Liu, Yong; Xu, Qian Q; Fu, JingguoX Subject: [DTS][PATCH 2/3] virtio: update vhost user cases 1: optimize case 2: add get rx rate for generator 3: better way to check vhost.out file Signed-off-by: Jingguo Fu --- tests/TestSuite_vhost_user_one_copy_one_vm.py | 202 ++++++++++++----------= ---- 1 file changed, 94 insertions(+), 108 deletions(-) diff --git a/tests/TestSuite_vhost_user_one_copy_one_vm.py b/tests/TestSuit= e_vhost_user_one_copy_one_vm.py index 32e47ad..971d9c2 100644 --- a/tests/TestSuite_vhost_user_one_copy_one_vm.py +++ b/tests/TestSuite_vhost_user_one_copy_one_vm.py @@ -47,13 +47,18 @@ from etgen import IxiaPacketGenerator from qemu_kvm im= port QEMUKvm =20 =20 -class TestVhostSample(TestCase, IxiaPacketGenerator): +class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator): =20 def set_up_all(self): # To Extend IXIA packet generator method, call the tester's method= . - self.tester.extend_external_packet_generator(TestVhostSample, self= ) + =20 + self.tester.extend_external_packet_generator(TestVhostUserOneCopyOneVm + , self) =20 # Build target with modified config file + self.dut.send_expect( + "sed -i -e 's/CONFIG_RTE_LIBRTE_VHOST_USER=3D.*$/CONFIG_RTE_LI= BRTE" + "_VHOST_USER=3Dy/' ./config/common_linuxapp", + "# ", + 30) self.dut.build_install_dpdk(self.target) =20 # Get and verify the ports @@ -78,10 +83,16 @@ class TestVhostSample(TestCase, IxiaPacketGenerator): " -c %s -n %d --socket-mem 1024,1024 -- -p 0x1 --mergeable %d"= + \ " --zero-copy %d --vm2vm %d 2 > ./vhost.out &" # build the vhost sample in vhost-user mode. - self.dut.send_expect( - "sed -i -e 's/define MAX_QUEUES 512/define MAX_QUEUES 128/'" - " ./examples/vhost/main.c", - "#") + if self.nic in ['niantic']: + self.dut.send_expect( + "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 128= /' " + "./examples/vhost/main.c", + "#", 10) + else: + self.dut.send_expect( + "sed -i -e 's/#define MAX_QUEUES.*$/#define MAX_QUEUES 512= /' " + "./examples/vhost/main.c", + "#", 10) out =3D self.dut.send_expect("make -C examples/vhost", "#") self.verify("Error" not in out, "compilation error") self.verify("No such file" not in out, "Not found file error") @@ = -97,7 +108,7 @@ class TestVhostSample(TestCase, IxiaPacketGenerator): self.dst2 =3D "192.168.4.1" self.vm_dut =3D None =20 - self.header_row =3D ["Test", "Mode", "Frame", "Mpps", "% linerate"= ] + self.header_row =3D ["FrameSize(B)", "RecvPackets(Mpps)",=20 + "SendPackets(Mpps)", "LineRate(%)"] In fact, Recvpkt is the ixia sending traffic rate, sendpkt is the ixia rece= ived packet rate and the virtio/vhost throughput, the naming recvpkt is a l= ittle confusing, since we know we will send line rate traffic, no need list= here. Suggest to remove recvpkt, and change sendpkt name as throughput, an= d if removed Test and mode, how do we know which case has the perf and whic= h mode is using in the result check?=20 self.memory_channel =3D 4 =20 def set_up(self): @@ -108,30 +119,19 @@ class TestVhostSample(TestCase, IxiaPacketGenerator): =20 if "jumbo" in self.running_case: self.jumbo =3D 1 - self.frame_sizes =3D [ - 68, - 128, - 256, - 512, - 1024, - 1280, - 1518, - 2048, - 5000, - 9000] + self.frame_sizes =3D [64, 128, 256, 512, 1024, 1280, 1518,=20 + 2048, 5000, 9000] self.vm_testpmd =3D "./x86_64-native-linuxapp-gcc/app/testpmd = -c 0x3 -n 3" \ - + \ - " -- -i --txqflags=3D0xf00 --disable-hw-vlan-filter --max-= pkt-len 9600" + + " -- -i --txqflags=3D0xf00 " \ + + "--disable-hw-vlan-filter --max-pkt-len 9600" else: self.jumbo =3D 0 - self.frame_sizes =3D [68, 128, 256, 512, 1024, 1280, 1518] + self.frame_sizes =3D [64, 128, 256, 512, 1024, 1280, 1518] self.vm_testpmd =3D "./x86_64-native-linuxapp-gcc/app/testpmd = -c 0x3 -n 3" \ + " -- -i --txqflags=3D0xf00 --disable-hw-vlan-filter" self.dut.send_expect("rm -rf ./vhost.out", "#") =20 self.launch_vhost_sample() =20 - print "Start VM with 2virtio\n" # start VM with 2virtio self.start_onevm() =20 @@ -146,15 +146,14 @@ class TestVhostSample(TestCase, IxiaPacketGenerator): time.sleep(30) try: print "Launch vhost sample\n" - out =3D self.dut.send_expect( - "cat ./vhost.out", - "VHOST_CONFIG: bind to vhost-net", - 20) + self.dut.session.copy_file_from("/root/dpdk/vhost.out") + fp =3D open('./vhost.out', 'r') + out =3D fp.read() + fp.close() if "Error" in out: raise Exception("Launch vhost sample failed") except Exception as e: print dts.RED("Failed to launch vhost sample: %s" % str(e)) - self.dut.send_expect("rm -rf ./vhost-net", "#", 20) Why remove this line? We need remove the module and ensure next time the ap= p can be launched successfully, when exception happened, the sample will no= t remove the module.=20 =20 def start_onevm(self): # @@ -172,7 +171,7 @@ class TestVhostSample(TestCase, IxiaPacketGenerator): self.vm.set_vm_device(**vm_params) =20 try: - self.vm_dut =3D self.vm.start(auto_portmap=3DFalse) + self.vm_dut =3D self.vm.start() if self.vm_dut is None: raise Exception("Set up VM ENV failed") except Exception as e: @@ -267,23 +266,76 @@ class TestVhostSample(TestCase, IxiaPacketGenerator): self.vm_dut.send_expect("ip route show", "#") print self.vm_dut.send_expect("arp -a", "#") =20 + def get_transmission_results(self, rx_port_list, tx_port_list, delay= =3D5): + time.sleep(delay) + recvbpsRate =3D 0 + recvRate =3D 0 + txbpsRate =3D 0 + txRate =3D 0 + for port in tx_port_list: + self.stat_get_rate_stat_all_stats(port) + out =3D self.send_expect('stat cget -framesSent', '%', 10) + txRate +=3D int(out.strip()) + self.logger.info("Port %s: TX %f Mpps" % (port, (txRate * 1.0 = / 1000000))) + out =3D self.send_expect('stat cget -bitsSent', '%', 10) + txbpsRate +=3D int(out.strip()) + self.logger.info("Port %s: TX %f Mbps" % (port, (txbpsRate * 1= .0 / 1000000))) + for port in rx_port_list: + self.stat_get_rate_stat_all_stats(port) + out =3D self.send_expect('stat cget -framesReceived', '%', 10) + recvRate +=3D int(out.strip()) + out =3D self.send_expect('stat cget -oversize', '%', 10) + recvRate +=3D int(out.strip()) + self.logger.info("Port %s: RX %f Mpps" % (port, (recvRate * 1.= 0 / 1000000))) + out =3D self.send_expect('stat cget -bitsReceived', '%', 10) + recvbpsRate +=3D int(out.strip()) + self.logger.info("Port %s: RX %f Mbps" % (port,=20 + (recvbpsRate * 1.0 / 1000000))) + + return (txRate,recvRate) + + def send_verify(self, case, frame_sizes, vlan_id1=3D0): + dts.results_table_add_header(self.header_row) + for frame_size in frame_sizes: + info =3D "Running test %s, and %d frame size.\n" % (case, fram= e_size) + self.logger.info(info) + payload =3D frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip'= ] + flow =3D '[Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"%s",ds= t=3D"%s")/("X"*%d)]' % ( + self.virtio1_mac, vlan_id1, self.src1, self.dst1, payload) + self.tester.scapy_append('wrpcap("flow.pcap", %s)' % flow) + self.tester.scapy_execute() + + tgenInput =3D [] + port =3D self.tester.get_local_port(self.pf) + tgenInput.append((port, port, "flow.pcap")) + + recvpkt, sendpkt =3D self.tester.traffic_generator_throughput( + tgenInput, delay=3D15) + recvpkt /=3D 1000000.0 + sendpkt /=3D 1000000.0 + pct =3D sendpkt * 100 / recvpkt + data_row =3D [frame_size, str(recvpkt), str(sendpkt),=20 + str(pct)] + dts.results_table_add_row(data_row) + dts.results_table_print() + def test_perf_user_one_vm_legacy_fwd(self): # # Test the performance of one vm with 2virtio devices in legacy fw= d # # Restore the virtio interfaces to use legacy driver self.vm_dut.restore_interfaces() - self.set_legacy_disablefw() # Set the legacy fwd rules then get the VLAN id from vhost sample # output self.set_onevm_legacy_fwd() - time.sleep(5) - out_clean =3D self.dut.get_session_output(timeout=3D2) - out =3D self.dut.send_expect("cat ./vhost.out", "# ", 20) + + self.dut.get_session_output(timeout=3D2) + self.dut.session.copy_file_from("/root/dpdk/vhost.out") + fp =3D open('./vhost.out', 'r') + out =3D fp.read() + fp.close() # Get the VLAN ID for virtio - print out, "\ncheck the vlan info: \n" + print "Check the vlan info: \n" l1 =3D re.findall( 'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' % (str(self.virtio1_mac)), out) @@ -297,41 +349,7 @@ class TestV= hostSample(TestCase, IxiaPacketGenerator): vlan_id2 =3D l2[0] print "vlan_id2 is ", vlan_id2 =20 - dts.results_table_add_header(self.header_row) - - # Create pcap file and ixia traffic - for frame_size in self.frame_sizes: - info =3D "Running test %s, and %d frame size.\n" % ( - self.running_case, frame_size) - self.logger.info(info) - - payload_size =3D frame_size - HEADER_SIZE['eth'] - HEADER_SIZE= ['ip'] - flow1 =3D '[Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"%s",d= st=3D"%s")/("X"*%d)]' % ( - self.virtio1_mac, vlan_id1, self.src1, self.dst1, payload_= size) - flow2 =3D '[Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"%s",d= st=3D"%s")/("X"*%d)]' % ( - self.virtio2_mac, vlan_id2, self.src2, self.dst2, payload_= size) - - self.tester.scapy_append('wrpcap("flow1.pcap", %s)' % flow1) - self.tester.scapy_append('wrpcap("flow2.pcap",%s)' % flow2) - self.tester.scapy_execute() - - # Capture the performance - tgenInput =3D [] - port =3D self.tester.get_local_port(self.pf) - tgenInput.append((port, port, "flow2.pcap")) - - _, pps =3D self.tester.traffic_generator_throughput( - tgenInput, delay=3D15) - pps /=3D 1000000.0 - linerate =3D self.wirespeed(self.nic, frame_size, 1) - pct =3D pps * 100 / linerate - scenario =3D self.running_case - mode =3D "vhost user" - data_row =3D [scenario, mode, frame_size, str(pps), str(pct)] - dts.results_table_add_row(data_row) - - dts.results_table_print() - + self.send_verify(self.running_case, self.frame_sizes, vlan_id1) # Stop the Vhost sample self.dut.send_expect("killall -s INT vhost-switch", "#", 20) =20 @@ -339,16 +357,18 @@ class TestVhostSample(TestCase, IxiaPacketGenerator): # # Test the performance of one vm with 2virtio devices in legacy fw= d # - # start testpmd on VM self.vm_testpmd_start() time.sleep(5) # Clean the output to ensure the commands cat ./vhost.out can be s= ent # and got answered correctly. - out_clean =3D self.dut.get_session_output(timeout=3D2) - out =3D self.dut.send_expect("cat ./vhost.out", "# ", 20) + self.dut.get_session_output(timeout=3D2) + self.dut.session.copy_file_from("/root/dpdk/vhost.out") + fp =3D open('./vhost.out', 'r') + out =3D fp.read() + fp.close() # Get the VLAN ID for virtio - print out, "\ncheck the vlan info: \n" + print "Check the vlan info: \n" l1 =3D re.findall( 'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' % (str(self.virtio1_mac)), out) @@ -361,43 +381,9 @@ class TestV= hostSample(TestCase, IxiaPacketGenerator): if len(l2) > 0: vlan_id2 =3D l2[0] print vlan_id2 - - dts.results_table_add_header(self.header_row) - - # Create pcap file and ixia traffic - for frame_size in self.frame_sizes: - info =3D "Running test %s, and %d frame size.\n" % ( - self.running_case, frame_size) - self.logger.info(info) - - payload_size =3D frame_size - HEADER_SIZE['eth'] - HEADER_SIZE= ['ip'] - flow1 =3D '[Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"%s",d= st=3D"%s")/("X"*%d)]' % ( - self.virtio1_mac, vlan_id1, self.src1, self.dst1, payload_= size) - flow2 =3D '[Ether(dst=3D"%s")/Dot1Q(vlan=3D%s)/IP(src=3D"%s",d= st=3D"%s")/("X"*%d)]' % ( - self.virtio2_mac, vlan_id2, self.src2, self.dst2, payload_= size) - self.tester.scapy_append('wrpcap("flow1.pcap", %s)' % flow1) - self.tester.scapy_append('wrpcap("flow2.pcap",%s)' % flow2) - self.tester.scapy_execute() - - # Capture the performance - tgenInput =3D [] - port =3D self.tester.get_local_port(self.pf) - tgenInput.append((port, port, "flow1.pcap")) - tgenInput.append((port, port, "flow2.pcap")) - - _, pps =3D self.tester.traffic_generator_throughput( - tgenInput, delay=3D15) - pps /=3D 1000000.0 - linerate =3D self.wirespeed(self.nic, frame_size, 1) - pct =3D pps * 100 / linerate - scenario =3D self.running_case - mode =3D "vhost user" - data_row =3D [scenario, mode, frame_size, str(pps), str(pct)] - dts.results_table_add_row(data_row) - - dts.results_table_print() + self.send_verify(self.running_case, self.frame_sizes, vlan_id1) # Stop testpmd - print self.vm_dut.send_expect("stop", "testpmd>") + self.vm_dut.send_expect("stop", "testpmd>") time.sleep(1) self.vm_dut.send_expect("quit", "# ") =20 -- 2.1.0