From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id A5EC43777 for ; Tue, 27 Dec 2016 08:59:15 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 26 Dec 2016 23:59:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,415,1477983600"; d="scan'208";a="1076603551" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 26 Dec 2016 23:59:13 -0800 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 26 Dec 2016 23:59:13 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 26 Dec 2016 23:59:13 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by shsmsx102.ccr.corp.intel.com ([169.254.2.88]) with mapi id 14.03.0248.002; Tue, 27 Dec 2016 15:59:09 +0800 From: "Liu, Yong" To: "Xu, GangX" , "dts@dpdk.org" CC: "Xu, GangX" Thread-Topic: [dts] [PATCH V1] add test suite vhost_pmd_xstats Thread-Index: AQHSX+8wnAfthaZEokq6AkDFZqFeOaEbaHig Date: Tue, 27 Dec 2016 07:59:09 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62D323BE@SHSMSX103.ccr.corp.intel.com> References: <1482808414-17166-1-git-send-email-gangx.xu@intel.com> In-Reply-To: <1482808414-17166-1-git-send-email-gangx.xu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTUxMzQ1NDItN2EwYy00ODdlLWE1OTQtYjNmZTcyODMwZjBhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImRWNVFWRXdsY1I4c2szeGx5SFN3NmIrS1UwTERnVXArZlR3aWNFem51ZjQ9In0= x-ctpclassification: CTP_IC 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] add test suite vhost_pmd_xstats 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: Tue, 27 Dec 2016 07:59:16 -0000 Gang, some comments below. Please split test suite and test plan into two p= atches.=20 It will be more easily for review and I just reviewed test plan in your pat= ch. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xu,gang > Sent: Tuesday, December 27, 2016 11:14 AM > To: dts@dpdk.org > Cc: Xu, GangX > Subject: [dts] [PATCH V1] add test suite vhost_pmd_xstats >=20 > Signed-off-by: xu,gang > --- > framework/ssh_pexpect.py | 1 + > test_plans/vhost_pmd_xstats_test_plan.rst | 306 > ++++++++++++++++++++++++++++++ > tests/TestSuite_vhost_pmd_xstats.py | 245 ++++++++++++++++++++++++ > 3 files changed, 552 insertions(+) > create mode 100644 test_plans/vhost_pmd_xstats_test_plan.rst > create mode 100644 tests/TestSuite_vhost_pmd_xstats.py >=20 > diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py > index d5b6616..09095a1 100644 > --- a/framework/ssh_pexpect.py > +++ b/framework/ssh_pexpect.py > @@ -185,6 +185,7 @@ class SSHPexpect(object): > if i =3D=3D 1: > time.sleep(0.5) > p.sendline(password) > + time.sleep(10) I think Lei is working on this issue. Please remove it from your patch. > p.expect("100%", 60) > if i =3D=3D 4: > self.logger.error("SCP TIMEOUT error %d" % i) > diff --git a/test_plans/vhost_pmd_xstats_test_plan.rst > b/test_plans/vhost_pmd_xstats_test_plan.rst Please separate test plan and test suite. It will be more easily for review= . =20 > new file mode 100644 > index 0000000..4415e41 > --- /dev/null > +++ b/test_plans/vhost_pmd_xstats_test_plan.rst > @@ -0,0 +1,306 @@ > +.. Copyright (c) <2016>, Intel Corporation > + All rights reserved. > + > + Redistribution and use in source and binary forms, with or without > + modification, are permitted provided that the following conditions > + are met: > + > + - Redistributions of source code must retain the above copyright > + notice, this list of conditions and the following disclaimer. > + > + - Redistributions in binary form must reproduce the above copyright > + notice, this list of conditions and the following disclaimer in > + the documentation and/or other materials provided with the > + distribution. > + > + - Neither the name of Intel Corporation nor the names of its > + contributors may be used to endorse or promote products derived > + from this software without specific prior written permission. > + > + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED > + OF THE POSSIBILITY OF SUCH DAMAGE. > + > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > +Vhost PMD xstats test plan > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +This test plan will cover the basic vhost pmd xstats case and will be > worked as a regression test plan. In the test plan, we will use vhost as = a > pmd port in testpmd. > + > +Test Case1: Vhsot PMD xstats based on packet size > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + Please keep "=3D" align with case name. Please keep each line in 79 characters, we will generate doc based on test = plan. > +flow: > +TG-->NIC-->>Vhost TX-->Virtio RX-->Virtio TX-->Vhsot RX-->NIC-->TG > + > +1. Launch testpmd by below command, bind one physical port to igb_uio, > then launch the testpmd > + rm -rf vhost-net* > + ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x30 -n 4 --socket-mem > 1024,0 --vdev 'net_vhost0,iface=3Dvhost-net,queues=3D1' -- -i --nb-cores= =3D1 > + testpmd> You can remove target, everyone known how to start testpmd application. > + > + ssh 10.240.176.254 -p 6087 > + SSH login action will be done by automation script, you can just add one co= mment "Login into XXX". > +2. Launch VM1, > + Please give some basic description for the command, like start vm using hug= epage backend memory + one vhost-user netdev (merged buf on, multiqueue on)= . And not need to show precise qemu path, everyone known how to find qemu bin= ary in their own environment. > + taskset -c 6-7 \ > + /root/qemu-versions/qemu-2.5.0/x86_64-softmmu/qemu-system-x86_64 - > name us-vhost-vm1 \ > + -cpu host -enable-kvm -m 2048 -object memory-backend- > file,id=3Dmem,size=3D2048M,mem-path=3D/mnt/huge,share=3Don -numa node,mem= dev=3Dmem - > mem-prealloc \ > + -smp cores=3D2,sockets=3D1 -drive file=3D/home/osimg/ubuntu16.img = \ > + -chardev socket,id=3Dchar0,path=3D./vhost-net \ > + -netdev type=3Dvhost-user,id=3Dmynet1,chardev=3Dchar0,vhostforce,qu= eues=3D1 > \ > + -device virtio-net- > pci,mac=3D52:54:00:00:00:01,netdev=3Dmynet1,mrg_rxbuf=3Doff,mq=3Don \ > + -netdev tap,id=3Dipvm1,ifname=3Dtap3,script=3D/etc/qemu-ifup -devic= e > rtl8139,netdev=3Dipvm1,id=3Dnet0,mac=3D00:00:00:00:10:01 -localtime -vnc = :10 - > daemonize > + > + > +3. On VM1, ensure the same dpdk folder is copied and run testpmd, use > txqflags=3D0xf01 :: > + ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 -- -i -- > txqflags=3D0xf01 You can remove target, everyone known how to start testpmd application. > + testpmd>start > + > +4. On host, testpmd, set ports to the mac forward mode > + > + testpmd>set fwd mac > + testpmd>start tx_first > + > +5. On VM, testpmd, set port to the mac forward mode > + > + testpmd>set fwd mac > + testpmd>start > + > +6. On host run "show port xstats all" at least twice to check the packet= s > number > + > + testpmd>show port xstats all > + rx_q0_size_64_packets: 16861577 > + rx_q0_size_65_to_127_packets: 0 > + rx_q0_size_128_to_255_packets: 0 > + rx_q0_size_256_to_511_packets: 0 > + rx_q0_size_512_to_1023_packets: 0 > + rx_q0_size_1024_to_1522_packets: 0 > + rx_q0_size_1523_to_max_packets: 0 > + > + > +7. Let TG generate different size of packets, send 10000 packets for eac= h > packet sizes(64,128,255, 512, 1024, 1523), check the statistic number is > correct > + > + > + > +Test Case2: Vhsot PMD xstats based on packet types > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Typo issue, should be "Vhost". > + > +Similar as Test Case1, all steps are similar except step6,7: > + > +5. On host run "show port xstats all" at least twice to check the packet= s > type: Should be step 6 and 7. You can just remove the index.=20 > + > + testpmd>show port xstats all > + rx_q0_broadcast_packets: 0 > + rx_q0_multicast_packets: 0 > + rx_q0_ucast_packets: 45484904 > + > + > + > +6. Let TG generate different type of packets, broadcast, multicast, ucas= t, > check the statistic number is correct > + > + > +Test Case3: Performance compare with xstats turn on/off with vector > path(Mergeable on and txflags=3D0xf01) > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Case name is redundancy, you can simplify it like "Performance comparison o= n vector path" > + > +1. Launch testpmd by below command, don't bind NIC to igb_uio, then > launch the testpmd > + rm -rf vhost-net* > + ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x30 -n 4 --socket-mem > 1024,0 --vdev 'eth_vhost0,iface=3Dvhost-net,queues=3D1' -- -i --nb-cores= =3D1 > + testpmd> > + > +2. Launch VM1, mrg_off=3Doff so to enable the mergeable:: > + > + taskset -c 6-7 \ > + /root/qemu-versions/qemu-2.5.0/x86_64-softmmu/qemu-system-x86_64 - > name us-vhost-vm1 \ > + -cpu host -enable-kvm -m 2048 -object memory-backend- > file,id=3Dmem,size=3D2048M,mem-path=3D/mnt/huge,share=3Don -numa node,mem= dev=3Dmem - > mem-prealloc \ > + -smp cores=3D2,sockets=3D1 -drive file=3D/home/osimg/ubuntu16.img = \ > + -chardev socket,id=3Dchar0,path=3D./vhost-net \ > + -netdev type=3Dvhost-user,id=3Dmynet1,chardev=3Dchar0,vhostforce,qu= eues=3D1 > \ > + -device virtio-net- > pci,mac=3D52:54:00:00:00:01,netdev=3Dmynet1,mrg_rxbuf=3Doff,mq=3Don \ > + -netdev tap,id=3Dipvm1,ifname=3Dtap3,script=3D/etc/qemu-ifup -devic= e > rtl8139,netdev=3Dipvm1,id=3Dnet0,mac=3D00:00:00:00:10:01 -localtime -vnc = :10 - > daemonize > + > + > +3. On VM1, ensure the same dpdk folder is copied and run testpmd, use > txqflags=3D0xf01 :: > + ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 -- -i -- > txqflags=3D0xf01 > + testpmd>start > + > +4. On host, testpmd, set ports to the mac forward mode > + > + testpmd>set fwd io retry > + testpmd>start tx_first 8 > + > +5. On VM, testpmd, set port to the mac forward mode > + > + testpmd>start > + > +6. testpmd>show port stats all > + xxxxxxx > + Throughput (since last show) > + RX-pps: xxx > + TX-pps: xxx > + > +7. The performance drop after turn on xstats should under 5% > + > + > +Test Case3: Performance compare with xstats turn on/off when mergeable o= n > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > + > +1. Launch testpmd by below command, don't bind NIC to igb_uio, then > launch the testpmd > + rm -rf vhost-net* > + ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x30 -n 4 --socket-mem > 1024,0 --vdev 'eth_vhost0,iface=3Dvhost-net,queues=3D1' -- -i --nb-cores= =3D1 > + testpmd> > + > +2. Launch VM1, mrg_off=3Doff so to enable the mergeable:: > + > + taskset -c 6-7 \ > + /root/qemu-versions/qemu-2.5.0/x86_64-softmmu/qemu-system-x86_64 - > name us-vhost-vm1 \ > + -cpu host -enable-kvm -m 2048 -object memory-backend- > file,id=3Dmem,size=3D2048M,mem-path=3D/mnt/huge,share=3Don -numa node,mem= dev=3Dmem - > mem-prealloc \ > + -smp cores=3D2,sockets=3D1 -drive file=3D/home/osimg/ubuntu16.img = \ > + -chardev socket,id=3Dchar0,path=3D./vhost-net \ > + -netdev type=3Dvhost-user,id=3Dmynet1,chardev=3Dchar0,vhostforce,qu= eues=3D1 > \ > + -device virtio-net- > pci,mac=3D52:54:00:00:00:01,netdev=3Dmynet1,mrg_rxbuf=3Don,mq=3Don \ > + -netdev tap,id=3Dipvm1,ifname=3Dtap3,script=3D/etc/qemu-ifup -devic= e > rtl8139,netdev=3Dipvm1,id=3Dnet0,mac=3D00:00:00:00:10:01 -localtime -vnc = :10 - > daemonize > + > + > +3. On VM1, ensure the same dpdk folder is copied and run testpmd, use > txqflags=3D0xf01 :: > + ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 -- -i -- > txqflags=3D0xf01 > + testpmd>start > + > +4. On host, testpmd, set ports to the mac forward mode > + > + testpmd>set fwd io retry > + testpmd>start tx_first 8 > + > +5. On VM, testpmd, set port to the mac forward mode > + > + testpmd>start > + > +6. testpmd>show port stats all > + xxxxxxx > + Throughput (since last show) > + RX-pps: xxx > + TX-pps: xxx > + > +7. The performance drop after turn on xstats should under 5% > + > +Test Case5: clear Vhsot PMD xstats > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +flow: > +TG-->NIC-->>Vhost TX-->Virtio RX-->Virtio TX-->Vhsot RX-->NIC-->TG > + > +1. Launch testpmd by below command, bind one physical port to igb_uio, > then launch the testpmd > + rm -rf vhost-net* > + ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x30 -n 4 --socket-mem > 1024,0 --vdev 'eth_vhost0,iface=3Dvhost-net,queues=3D1' -- -i --nb-cores= =3D1 > + testpmd> > + > +2. Launch VM1, mrg_off=3Don so to enable the mergeable:: > + > + taskset -c 6-7 \ > + /root/qemu-versions/qemu-2.5.0/x86_64-softmmu/qemu-system-x86_64 - > name us-vhost-vm1 \ > + -cpu host -enable-kvm -m 2048 -object memory-backend- > file,id=3Dmem,size=3D2048M,mem-path=3D/mnt/huge,share=3Don -numa node,mem= dev=3Dmem - > mem-prealloc \ > + -smp cores=3D2,sockets=3D1 -drive file=3D/home/osimg/ubuntu16.img = \ > + -chardev socket,id=3Dchar0,path=3D./vhost-net \ > + -netdev type=3Dvhost-user,id=3Dmynet1,chardev=3Dchar0,vhostforce,qu= eues=3D1 > \ > + -device virtio-net- > pci,mac=3D52:54:00:00:00:01,netdev=3Dmynet1,mrg_rxbuf=3Don,mq=3Don \ > + -netdev tap,id=3Dipvm1,ifname=3Dtap3,script=3D/etc/qemu-ifup -devic= e > rtl8139,netdev=3Dipvm1,id=3Dnet0,mac=3D00:00:00:00:10:01 -localtime -vnc = :10 - > daemonize > + > + > +3. On VM1, ensure the same dpdk folder is copied and run testpmd, use > txqflags=3D0xf01 :: > + ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 -- -i -- > txqflags=3D0xf01 > + testpmd>start > + > +4. On host, testpmd, set ports to the mac forward mode > + > + testpmd>set fwd mac > + testpmd>start tx_first > + > +5. On VM, testpmd, set port to the mac forward mode > + > + testpmd>set fwd mac > + testpmd>start > + > +6. Let TG generate different size of packets, send 10000 packets for eac= h > packet sizes(64,128,255, 512, 1024, 1523,3000), check the statistic numbe= r > is correct > + > +7. On host run "show port xstats all" at least twice to check the packet= s > number > + > + testpmd>show port xstats all > + rx_q0_size_64_packets: 16861577 > + rx_q0_size_65_to_127_packets: 0 > + rx_q0_size_128_to_255_packets: 0 > + rx_q0_size_256_to_511_packets: 0 > + rx_q0_size_512_to_1023_packets: 0 > + rx_q0_size_1024_to_1522_packets: 0 > + rx_q0_size_1523_to_max_packets: 0 > + > +8. On host run "clear port xstats all" , then all the statistic date > should be 0 > + > + testpmd>clear port xstats all > + testpmd>show port xstats all > + rx_q0_size_64_packets: 0 > + rx_q0_size_65_to_127_packets: 0 > + rx_q0_size_128_to_255_packets: 0 > + rx_q0_size_256_to_511_packets: 0 > + rx_q0_size_512_to_1023_packets: 0 > + rx_q0_size_1024_to_1522_packets: 0 > + rx_q0_size_1523_to_max_packets: 0 > + Clear function should workable on every kinds of statistics. You can add cl= ear function check in test1 and test2, and remove this case. > +Test Case5: Stress test for Vhsot PMD xstats > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Not sure what's the difference between this case and next case, look like b= oth of them are stability test cases. > + > +Similar as Test Case1, all steps are similar except step6,7: > + > +5. Send 64 bytes packet with line speed for 30 minutes > + > +6. On host run "show port xstats all" , check the packet statistic numbe= r > has no big difference with the TG side. > + > + testpmd>show port xstats all > + rx_q0_size_64_packets: 16861577 > + > + > +Test Case6: Long lasting test for Vhsot PMD xstats > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > +1. Launch testpmd by below command, no need bind any physical port to > igb_uio > + rm -rf vhost-net* > + ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x7c -n 4 --socket-mem > 1024 1024 --vdev 'eth_vhost0,iface=3Dvhost-net,queues=3D2' -- -i --nb-cor= es=3D4 > --rxq=3D2 --txq=3D2 --rss-ip > + testpmd>start > + > +2. Launch VM1, set queues=3D2, vectors=3D2xqueues+2, mq=3Don:: > + > + qemu-system-x86_64 -name vm1 -cpu host -enable-kvm \ > + -m 2048 -object memory-backend-file,id=3Dmem,size=3D2048M,mem- > path=3D/mnt/huge,share=3Don -numa node,memdev=3Dmem \ > + -mem-prealloc -smp cores=3D3,sockets=3D1 -drive > file=3D/home/osimg/ubuntu16.img -chardev socket,id=3Dchar0,path=3D./vhost= -net \ > + -netdev type=3Dvhost-user,id=3Dmynet1,chardev=3Dchar0,vhostforce,que= ues=3D2 \ > + -device virtio-net- > pci,mac=3D52:54:00:00:00:01,netdev=3Dmynet1,mrg_rxbuf=3Doff,mq=3Don,vecto= rs=3D6 \ > + -netdev tap,id=3Dipvm1,ifname=3Dtap3,script=3D/etc/qemu-ifup -device > rtl8139,netdev=3Dipvm1,id=3Dnet0,mac=3D00:00:00:00:10:01 \ > + -vnc :10 -daemonize > + > +3. On VM1, ensure the same dpdk folder is copied and run testpmd, use > txqflags=3D0xf01 :: > + ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x7 -n 4 -- -i --rxq=3D2= -- > txq=3D2 --nb-cores=3D2 --txqflags=3D0xf01 --rss-ip > + testpmd>start > + > +4. On host, testpmd, set ports to the mac forward mode > + > + testpmd>set fwd io retry > + testpmd>start tx_first 8 > + > +5. On VM, testpmd, set port to the mac forward mode > + > + testpmd>start > + > +6. Send packets for 30 minutes, check the Xstatsa still can work > correctly > + testpmd>show port xstats all > + > + > + > + > + > + > diff --git a/tests/TestSuite_vhost_pmd_xstats.py > b/tests/TestSuite_vhost_pmd_xstats.py > new file mode 100644 > index 0000000..35909ad > --- /dev/null > +++ b/tests/TestSuite_vhost_pmd_xstats.py > @@ -0,0 +1,245 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without > +# modification, are permitted provided that the following conditions > +# are met: > +# > +# * Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# * Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in > +# the documentation and/or other materials provided with the > +# distribution. > +# * Neither the name of Intel Corporation nor the names of its > +# contributors may be used to endorse or promote products derived > +# from this software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + > +""" > +DPDK Test suite. > + > +vhost pmd xstats test suite. > +""" > +import os > +import dts > +import string > +import re > +import time > +import utils > +import datetime > +from scapy.utils import wrpcap, rdpcap > +from test_case import TestCase > +from exception import VerifyFailure > +from settings import HEADER_SIZE > +from etgen import IxiaPacketGenerator > +from qemu_kvm import QEMUKvm > +from packet import Packet, sniff_packets, load_sniff_packets > + > + > +class TestVhostPmdXstats(TestCase, IxiaPacketGenerator): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports") > + cores =3D self.dut.get_core_list("1S/4C/1T") > + self.coremask =3D utils.create_mask(cores) > + > + self.dmac =3D self.dut.get_mac_address(self.dut_ports[0]) > + self.virtio1_mac =3D "52:54:00:00:00:01" > + > + # build sample app > + out =3D self.dut.build_dpdk_apps("./examples/vhost") > + self.verify("Error" not in out, "compilation error 1") > + self.verify("No such file" not in out, "compilation error 2") > + #stop vhost firewalld.service > + self.dut.send_expect("systemctl stop firewalld.service", "#") > + > + def set_up(self): > + """ > + Run before each test case. > + Launch vhost sample using default params > + """ > + self.dut.send_expect("rm -rf ./vhost.out", "#") > + self.dut.send_expect("rm -rf ./vhost-net*", "#") > + self.dut.send_expect("killall -s INT vhost-switch", "#") > + self.dut.send_expect("killall -s INT qemu-system-x86_64", "#") > + > + def vm_testpmd_start(self): > + """ > + Start testpmd in vm > + """ > + self.vm_testpmd =3D "./x86_64-native-linuxapp-gcc/app/testpmd -c > 0x3 -n 4 -- -i --txqflags=3D0xf01" > + if self.vm_dut is not None: > + self.vm_dut.send_expect(self.vm_testpmd, "testpmd>", 60) > + out =3D self.vm_dut.send_expect("start", "testpmd>") > + > + def vm_tx_first_start(self): > + if self.vm_dut is not None: > + # Start tx_first > + self.vm_dut.send_expect("set fwd mac", "testpmd>") > + self.vm_dut.send_expect("start tx_first", "testpmd>") > + > + def start_onevm(self): > + """ > + Start One VM with one virtio device > + """ > + self.vm_dut =3D None > + self.vm =3D QEMUKvm(self.dut, 'vm0', 'vhost_pmd_xstats') > + vm_params =3D {} > + vm_params['driver'] =3D 'vhost-user' > + vm_params['opt_path'] =3D './vhost-net' > + vm_params['opt_mac'] =3D self.virtio1_mac > + self.vm.set_vm_device(**vm_params) > + try: > + self.vm_dut =3D self.vm.start() > + if self.vm_dut is None: > + raise Exception("Set up VM ENV failed") > + except Exception as e: > + print utils.RED("Failure for %s" % str(e)) > + return True > + > + def scapy_send_packet(self, pktsize, dmac, num=3D1): > + """ > + Send a packet to port > + """ > + txport =3D self.tester.get_local_port(self.dut_ports[0]) > + self.txItf =3D self.tester.get_interface(txport) > + pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dpktsize) > + pkt.config_layer('ether', {'dst': dmac,}) > + pkt.send_pkt(tx_port=3Dself.txItf, count=3Dnum) > + > + def send_verify(self, scope, mun): > + """ > + according the scope to check results > + """ > + out =3D self.dut.send_expect("show port xstats %s" % > self.dut_ports[1], "testpmd>", 60) > + packet =3D re.search("rx_%s_packets:\s*(\d*)" % scope, out) > + sum_packet =3D packet.group(1) > + self.verify(int(sum_packet) >=3D mun, "Insufficient the received > package") > + > + def prepare_start(self): > + """ > + prepare all of the conditions for start > + """ > + self.dut.send_expect("./x86_64-native-linuxapp-gcc/app/testpmd - > c %s -n %s --socket-mem 1024,0 --vdev 'net_vhost0,iface=3Dvhost- > net,queues=3D1' -- -i --nb-cores=3D1" % > (self.coremask,self.dut.get_memory_channels()), "testpmd>", 60) > + self.start_onevm() > + self.vm_testpmd_start() > + self.dut.send_expect("set fwd mac", "testpmd>", 60) > + self.dut.send_expect("start tx_first", "testpmd>", 60) > + self.vm_tx_first_start() > + > + def vhost_pmd_xstats_based(self): > + """ > + Verify receiving and transmitting packets correctly in the Vhsot > PMD xstats > + """ > + self.prepare_start() > + sizes =3D [64,65,128,256,513,1025] > + scope =3D '' > + for pktsize in sizes: > + if pktsize =3D=3D 64: > + scope =3D 'size_64' > + elif 65 <=3D pktsize <=3D 127: > + scope =3D 'size_65_to_127' > + elif 128 <=3D pktsize <=3D 255: > + scope =3D 'size_128_to_255' > + elif 256 <=3D pktsize <=3D 511: > + scope =3D 'size_256_to_511' > + elif 512 <=3D pktsize <=3D 1023: > + scope =3D 'size_512_to_1023' > + elif 1024 <=3D pktsize: > + scope =3D 'size_1024_to_max' > + > + self.scapy_send_packet(pktsize, self.dmac, 100) > + self.send_verify(scope, 100) > + > + def test_vhost_pmd_xstats_based(self): > + """ > + Verify receiving and transmitting packets correctly in the Vhsot > PMD xstats > + """ > + self.vhost_pmd_xstats_based() > + def test_vhost_pmd_xstats_based_types(self): > + """ > + Verify different type of packets receiving and transmitting > packets correctly in the Vhsot PMD xstats > + """ > + self.prepare_start() > + types =3D ['ff:ff:ff:ff:ff:ff','01:00:00:33:00:01'] > + scope =3D '' > + for p in types: > + if p =3D=3D 'ff:ff:ff:ff:ff:ff': > + scope =3D 'broadcast' > + self.dmac =3D 'ff:ff:ff:ff:ff:ff' > + elif p =3D=3D '01:00:00:33:00:01': > + scope =3D 'multicast' > + self.dmac =3D '01:00:00:33:00:01' > + self.scapy_send_packet(64, self.dmac, 100) > + self.send_verify(scope, 100) > + > + def test_clear_vhost_pmd_xstats(self): > + """ > + Verify clear Vhsot PMD xstats > + """ > + self.vhost_pmd_xstats_based() > + self.dut.send_expect("clear port xstats all", "testpmd>", 60) > + out =3D self.dut.send_expect("show port xstats all", "testpmd>",= 60) > + size_packets =3D > ['size_64','size_65_to_127','size_128_to_255','size_256_to_511','size_512= _ > to_1023','size_1024_to_max',] > + for size_packet in size_packets: > + packet =3D re.search("rx_%s_packets:\s*(\d*)" % size_packet, > out) > + sum_packet =3D packet.group(1) > + self.verify(int(sum_packet) >=3D 0, "Insufficient the receiv= ed > package") > + > + def test_longlasting_vhost_pmd_xstats(self): > + """ > + Verify Long lasting test for Vhsot PMD xstats > + Send packets for 30 minutes, check the Xstatsa still can work > correctly > + """ > + self.dut.send_expect("./x86_64-native-linuxapp-gcc/app/testpmd - > c %s -n %s --socket-mem 1024,0 --vdev 'net_vhost0,iface=3Dvhost- > net,queues=3D1' -- -i --nb-cores=3D1" % > (self.coremask,self.dut.get_memory_channels()), "testpmd>", 60) > + self.start_onevm() > + self.vm_testpmd_start() > + self.dut.send_expect("set fwd mac", "testpmd>", 60) > + self.dut.send_expect("start tx_first", "testpmd>", 60) > + if self.vm_dut is not None: > + out =3D self.vm_dut.send_expect("start", "testpmd>") > + date_old =3D datetime.datetime.now() > + date_new =3D date_old + datetime.timedelta(minutes=3D1) > + while(1): > + date_now =3D datetime.datetime.now() > + self.scapy_send_packet(64, self.dmac, 1) > + if date_now >=3D date_new: > + break > + out_0 =3D self.dut.send_expect("show port xstats %s" % > self.dut_ports[0], "testpmd>", 60) > + out_1 =3D self.dut.send_expect("show port xstats %s" % > self.dut_ports[1], "testpmd>", 60) > + rx_packet =3D re.search("rx_size_64_packets:\s*(\d*)" , out_1) > + tx_packet =3D re.search("tx_good_packets:\s*(\d*)" , out_0) > + tx_packets =3D tx_packet.group(1) > + rx_packets =3D rx_packet.group(1) > + self.verify(int(rx_packets) >=3D int(tx_packets), "Insufficient = the > received package") > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.kill_all() > + time.sleep(2) > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > -- > 1.9.3