test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [DTS][Patch V3 2/2] Add test plan for avf
@ 2018-08-24  3:04 Wang Fei
  2018-08-24  3:04 ` [dts] [DTS][Patch V3 1/2] Add test suite " Wang Fei
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Fei @ 2018-08-24  3:04 UTC (permalink / raw)
  To: dts; +Cc: lijuan.tu

Signed-off-by: Wang Fei <feix.y.wang@intel.com>
---
 test_plans/avf_test_plan.rst | 505 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 505 insertions(+)
 create mode 100644 test_plans/avf_test_plan.rst

diff --git a/test_plans/avf_test_plan.rst b/test_plans/avf_test_plan.rst
new file mode 100644
index 0000000..843ea70
--- /dev/null
+++ b/test_plans/avf_test_plan.rst
@@ -0,0 +1,505 @@
+# 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.
+
+
+==============
+AVF test plan
+==============
+
+Description
+===========
+Adaptive Virtual Function(AVF) is aimed to provide a common VF for VM 
+which means just need one unified VF driver so you don't have to reload
+different VF driver when you upgrade the PF NIC.
+One of the advantages is you don't have to do any modification for code or
+hardware for a existing VM image running on the new NIC
+
+
+
+Hardwares:
+----------
+I40E driver NIC (Fortville XXV710, Fortville XL710, Fortville X710)
+
+
+Prerequisites
+=============
+1.Modify DPDK source code to enable AVF function for I40E NIC::
+
+    sed -i -e '/AVF_DEV_ID_ADAPTIVE_VF/s/0x1889/0x154c/g' drivers/net/avf/base/avf_devids.h
+    sed -i -e '/I40E_DEV_ID_VF/s/0x154C/0x164C/g'  drivers/net/i40e/base/i40e_devids.h
+
+    make install RTE_SDK=`pwd` T=x86_64-native-linuxapp-gcc
+
+2. Configure PF and VF::
+
+    modprobe uio;
+    insmod x86_64-native-linuxapp-gcc/kmod/igb_uio.ko;
+
+    ./usertools/dpdk-devbind.py --bind=igb_uio 05:00.0 07:00.0;
+
+    echo 1 > /sys/bus/pci/devices/0000\:05\:00.0/max_vfs;
+    echo 1 > /sys/bus/pci/devices/0000\:07\:00.0/max_vfs;
+
+    ./usertools/dpdk-devbind.py --bind=vfio-pci 05:02.0 07:02.0
+    or
+    (./usertools/dpdk-devbind.py --bind=igb_uio 05:02.0 07:02.0)
+
+3. Set PF ports up and congiure VF ports' mac::
+
+    ./x86_64-native-linuxapp-gcc/app/testpmd -l 1-5 -n 4 --socket-mem=1024,1024 --file-prefix=pf -w 05:00.0 -w 07:00.0 -- -i
+
+    testpmd>set vf mac addr 0 0 00:12:34:56:78:01
+    testpmd>set vf mac addr 1 0 00:12:34:56:78:02
+
+4. Start up VF ports::
+    ./x86_64-native-linuxapp-gcc/app/testpmd -l 6-10 -n 4 --master-lcore=6  --socket-mem=1024,1024 --file-prefix=vf \
+                                             -w 05:02.0 -w 07:02.0 -- -i --txq=4 --rxq=4  --nb-cores=4 
+
+Detail test plan about each features
+====================================
+
+
+Test case: VF basic RX/TX ::
+
+ testpmd>start
+
+send fixed number of  random packets from traffic generator, verify the packets can be received 
+by one VF and can be forward to another VF correctly.
+
+ 
+
+VF mac filter
+===============
+
+Test Case: unicast test:: 
+
+    testpmd>set promisc all off
+    testpmd>set allmulti all off
+    testpmd>start
+
+    testpmd>mac_addr set 0 00:12:34:56:78:03 [not work]
+
+    disable promisc mode, verify VF packet rx/tx can work fine with the specific mac addr.
+
+Test Case: multicast test::
+
+    testpmd>set promisc all off
+    testpmd>set allmulti all off
+    testpmd>start
+
+    Send packet with multicast MAC 01:80:C2:00:00:08, and check VF can not receive the packet.
+
+    testpmd>set allmulti all on
+
+    Send packet with multicast MAC 01:80:C2:00:00:08, and check VF can receive the packet.
+
+Test Case: broadcast test::
+
+    testpmd>set promisc all off
+    testpmd>start
+
+    Send packets with broadcast address ff:ff:ff:ff:ff:ff, and check VF can receive the packet
+
+Test Case: promiscuous mode::
+
+    testpmd>set promisc all on
+    testpmd>start
+
+    Send packet that different with vf mac, check packets can be received.
+
+Test Case: mac spoof on::
+     (N/A now)
+
+
+
+VF VLAN feature (vlan filter only work with promisc mode off)
+--------------------------------------------------------------
+
+Test Case: vlan filter ::
+
+    testpmd>port stop all
+    testpmd>set promisc all off   
+    testpmd>vlan set filter off 0
+    testpmd>vlan set filter off 1
+    testpmd>vlan set strip off 0
+    testpmd>vlan set strip off 1
+
+    testpmd>vlan set filter on 0
+    testpmd>set fwd mac
+    testpmd>port start all
+    testpmd>start
+
+    packet with vlan can not be received, packet without vlan packet can be received.
+
+Test Case: rx_vlan ::
+
+    setup rx vlan like the follow command, verify packet with
+    vlan_id can receive by VF, and packet with other vlan_id can not be received by VF 
+    (execept vlan 0).
+
+    testpmd> rx_vlan add <vlan_id> <vf_index>
+
+    testpmd>port stop all
+    testpmd>set promisc all off   
+    testpmd>vlan set filter off 0
+    testpmd>vlan set filter off 1
+    testpmd>vlan set strip off 0
+    testpmd>vlan set strip off 1
+
+    testpmd>vlan set filter on 0
+    testpmd>rx_vlan add 20 0
+    testpmd>set fwd mac
+    testpmd>port start all
+    testpmd>start
+
+Test Case: tx_vlan ::
+
+    setup VF vlan like the follow command, verify packet
+    that out from VF contain the vlan tag.
+
+    testpmd> tx_vlan <vf_index> <vlan_id>
+
+    testpmd>port stop all
+    testpmd>set promisc all on
+    testpmd>set fwd mac
+    testpmd>vlan set filter off 0
+    testpmd>vlan set filter off 1
+    testpmd>vlan set strip off 0
+    testpmd>vlan set strip off 1
+    testpmd>tx_vlan set 1 20
+    testpmd>port start all
+    testpmd>start
+
+Test Case: vlan strip ::
+
+    setup strip on, vlan promisc on, verify vlan_id
+    was stripped by VF when it forward the packet to other vf port. 
+
+    testpmd> vlan set strip on <vf_index>
+
+    testpmd>port stop all
+    testpmd>set promisc all on
+    testpmd>set fwd mac
+    testpmd>vlan set filter off 0
+    testpmd>vlan set filter off 1
+    testpmd>vlan set strip off 0
+    testpmd>vlan set strip off 1
+    testpmd>vlan set strip on 0
+    testpmd>port start all
+    testpmd>start
+
+Test Case: vlan promisc mode ::
+
+    testpmd>port stop all
+    testpmd>vlan set filter off 0
+    testpmd>vlan set filter off 1
+    testpmd>vlan set strip off 0
+    testpmd>vlan set strip off 1
+
+    testpmd>set promisc all on
+    testpmd>set fwd mac
+    testpmd>port start all
+    testpmd>start
+
+send packet with vlan or without vlan, both can be received and forwarded.
+
+Test Case: vlan spoof on ::
+
+    (N/A)
+
+
+VF jumboframe
+----------------
+
+Ensure Tester's ports support sending jumboframe::
+    ifconfig 'tester interface' mtu 9000
+
+
+Test Case: Check that no jumbo frame support ::
+
+    Launch testpmd for VF ports without enabling jumboframe option 
+
+        ./x86_64-native-linuxapp-gcc/app/testpmd -l 6-10 -n 4 --master-lcore=6 --socket-mem=1024,1024 --file-prefix=vf \
+                                       -w 05:02.0 -w 07:02.0 -- -i --txq=4 --rxq=4  --nb-cores=4
+
+        testpmd>set fwd mac
+        testpmd>start
+
+packet less than the standard maximum frame (1518) can be received.
+packet more than the standard maximum frame (1518) can not be received.
+
+Test Case: Check that with Jumbo Frames support::
+
+    Launch testpmd for VF ports with jumboframe option
+        ./x86_64-native-linuxapp-gcc/app/testpmd -l 6-10 -n 4 --master-lcore=6 --socket-mem=1024,1024 --file-prefix=vf \
+                      -w 05:02.0 -w 07:02.0 -- -i --txq=4 --rxq=4  --nb-cores=4 --max-pkt-len=3000 --tx-offloads=0x8000
+
+    testpmd>set fwd mac
+    testpmd>start
+
+packet lengths greater than the standard maximum frame (1518) and \
+lower or equal to the maximum frame length can be received.
+Check that packets larger than the configured maximum packet length are
+dropped by the hardware.
+
+Note the following was expected!
+packet size > 9001,  not forward , but RX-packets: counter increased (issue ??????)
+
+ VF RSS
+---------
+Start command like below:
+./x86_64-native-linuxapp-gcc/app/testpmd -l 6-10 -n 4 --master-lcore=6 --socket-mem=1024,1024 --file-prefix=vf \
+-w 05:02.0 -w 07:02.0 -- -i --txq=4 --rxq=4  --nb-cores=4 --txqflags=0
+
+Test Case: test redirection Table Config ::
+  config hash reta table, send different flow type packet to VF port, 
+  check packet received by different queue.
+
+  testpmd>port config 0 rss reta (0,0)
+  testpmd>port config 0 rss reta (1,1)
+  testpmd>port config 0 rss reta (2,2)
+  testpmd>port config 0 rss reta (3,3)
+  testpmd>port config 0 rss reta (60,0)
+  testpmd>port config 0 rss reta (61,1)
+  testpmd>port config 0 rss reta (62,2)
+  testpmd>port config 0 rss reta (63,3)
+
+  testpmd> port config all rss (all|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none)
+
+
+VF offload (checksum and tso)
+--------------------------------
+
+Test Case: enable HW checksum offload ::
+
+ Send packets with incorrect checksum to vf port, verify that the packets
+ can be received by VF port and checksum error reported, 
+ the packets forwarded by VF port have the correct checksum value.
+
+  ./x86_64-native-linuxapp-gcc/app/testpmd -l 6-10 -n 4 --master-lcore=6 --socket-mem=1024,1024 --file-prefix=vf \
+  -w 05:02.0 -w 07:02.0 -- -i --txq=4 --rxq=4  --nb-cores=4
+
+    testpmd>port stop all
+
+    testpmd>csum set ip hw 0
+    testpmd>csum set udp hw 0
+    testpmd>csum set tcp hw 0
+    testpmd>csum set sctp hw 0
+
+    testpmd>csum set ip hw 1
+    testpmd>csum set udp hw 1
+    testpmd>csum set tcp hw 1
+    testpmd>csum set sctp hw 1
+
+    testpmd>set fwd csum
+    testpmd>set verbose 1
+
+    testpmd>port start all
+    testpmd>start
+
+Test Case: SW checksum, disable HW checksum offload ::
+
+ Send packets with incorrect checksum to vf port, verify that the packets
+ can be received by VF port and checksum error reported, the packets 
+ forwarded by VF port have the correct checksum value.
+
+  ./x86_64-native-linuxapp-gcc/app/testpmd -l 6-10 -n 4 --master-lcore=6 --socket-mem=1024,1024 --file-prefix=vf \
+   -w 05:02.0 -w 07:02.0 -- -i --txq=4 --rxq=4  --nb-cores=4
+
+    testpmd>port stop all
+    testpmd>csum set ip sw 0
+    testpmd>csum set udp sw 0
+    testpmd>csum set tcp sw 0
+    testpmd>csum set sctp sw 0
+
+    testpmd>csum set ip sw 1
+    testpmd>csum set udp sw 1
+    testpmd>csum set tcp sw 1
+    testpmd>csum set sctp sw 1
+
+    testpmd>set fwd csum
+    testpmd>set verbose 1
+    testpmd>port start all
+    testpmd>start
+
+Test Case: tso ::
+
+ enable tso on VF port, verify tcp packets that send out by 
+ VF port was splitted according to tso size.  [no implemented yet]
+
+    testpmd>port stop all
+    testpmd>set verbose 1
+    testpmd>csum set ip hw 0
+    testpmd>csum set udp hw 0
+    testpmd>csum set tcp hw 0
+    testpmd>csum set sctp hw 0
+
+    testpmd>csum set ip hw 1
+    testpmd>csum set udp hw 1
+    testpmd>csum set tcp hw 1
+    testpmd>csum set sctp hw 1
+
+    testpmd>tso set 800 1
+    testpmd>set fwd csum
+    testpmd>port start all
+    testpmd>start
+
+Test Case: tunnel tso ::
+
+ enable tunnel tso on VF port, verify tcp packets that send out by 
+ VF port was splitted according to tso size. [not implemented yet]
+
+    testpmd>port stop all
+    testpmd>set verbose 1
+    testpmd>csum set ip hw 0
+    testpmd>csum set udp hw 0
+    testpmd>csum set tcp hw 0
+    testpmd>csum set sctp hw 0
+    testpmd>csum set outer-ip hw 0
+    testpmd>csum parse_tunnel on 0
+
+    testpmd>csum set ip hw 1
+    testpmd>csum set udp hw 1
+    testpmd>csum set tcp hw 1
+    testpmd>csum set sctp hw 1
+    testpmd>csum set outer-ip hw 1
+    testpmd>csum parse_tunnel on 1
+
+    testpmd>tunnel_tso set 800 1
+    testpmd>set fwd csum
+    testpmd>port start all
+    testpmd>start
+
+ Rx interrupt
+---------------
+
+Test case: rx interrupt ::
+
+ 1). build l3fwd-power
+   make -C examples/l3fwd-power RTE_SDK=`pwd` T=x86_64-native-linuxapp-gcc
+
+ 2). build two VFs with igb_uio  [fail]
+   modprobe uio;
+   insmod x86_64-native-linuxapp-gcc/kmod/igb_uio.ko;
+   ./usertools/dpdk-devbind.py --bind=igb_uio 05:02.0 07:02.0
+
+   if in VM, enable vfio noiommu
+
+   modprobe -r vfio_iommu_type1
+   modprobe -r vfio
+   modprobe  vfio enable_unsafe_noiommu_mode=1
+   cat /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
+   modprobe vfio-pci
+
+ 3). start l3fwd power with one queue per port.
+  ./examples/l3fwd-power/build/l3fwd-power -l 6,7 -n 4 -w 05:02.0 -w 07:02.0 -- \
+  -p 0x3 --config '(0,0,6),(1,0,7)'
+
+Send one packet to VF0 and VF1, check that thread on core6 and core7 waked up::
+
+L3FWD_POWER: lcore 6 is waked up from rx interrupt on port 0 queue 0
+L3FWD_POWER: lcore 7 is waked up from rx interrupt on port 0 queue 0
+
+Check the packet has been normally forwarded.
+
+After the packet forwarded, thread on core6 and core 7 will return to sleep::
+
+L3FWD_POWER: lcore 6 sleeps until interrupt triggers
+L3FWD_POWER: lcore 7 sleeps until interrupt triggers
+
+Send packet flows to VF0 and VF1, check that thread on core1 and core2 will
+keep up awake.
+
+
+ VF veb
+---------
+
+Test Case: veb performance ::
+
+ create 2 VFs from 1 PF, start testpmd with 2VFs individually, verify throughput.
+
+ 1). create 2 VFs from 1 PF, and start PF
+
+        echo 2 > /sys/bus/pci/devices/0000\:05\:00.0/max_vfs;
+        ./usertools/dpdk-devbind.py --bind=vfio-pci 05:02.0 05:02.1
+
+        ./x86_64-native-linuxapp-gcc/app/testpmd -l 1,2 -n 4 --socket-mem=1024,1024 --file-prefix=pf \
+          -w 05:00.0 -- -i
+            testpmd>set vf mac addr 0 0 00:12:34:56:78:01
+            testpmd>set vf mac addr 0 1 00:12:34:56:78:02
+
+  2). start testpmd with 2VFs individually
+        ./x86_64-native-linuxapp-gcc/app/testpmd -l 3-5 -n 4 --master-lcore=3 --socket-mem=1024,1024 --file-prefix=vf1 \
+        -w 05:02.0 -- -i --txq=2 --rxq=2 --rxd=512 --txd=512 --nb-cores=2 --rss-ip --eth-peer=0,00:12:34:56:78:02
+
+            testpmd>set promisc all off
+            testpmd>set fwd mac
+            testpmd>start
+
+        ./x86_64-native-linuxapp-gcc/app/testpmd -l 6-8 -n 4 --master-lcore=6 --socket-mem=1024,1024 --file-prefix=vf2 \
+         -w 05:02.1 -- -i --txq=2 --rxq=2 --rxd=512 --txd=512 --nb-cores=2 --rss-ip
+
+            testpmd>set promisc all off
+            testpmd>set fwd mac
+            testpmd>start
+
+  3). send traffic and verify throughput
+
+
+VF performance
+-----------------
+
+Test Case: vector vf performance::
+
+ 1). config vector=y in config/common_base, and rebuild dpdk
+
+ 2). start testpmd for PF
+     ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x6 -n 4 --socket-mem=1024,1024 --file-prefix=pf \
+       -w 05:00.0 -w 07:00.0 -- -i
+
+       testpmd>set vf mac addr 0 0 00:12:34:56:78:01
+       testpmd>set vf mac addr 1 0 00:12:34:56:78:02
+
+ 3). start testpmd for VF
+    ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x0f8 -n 4 --master-lcore=3 --socket-mem=1024,1024 --file-prefix=vf \
+        -w 05:02.0 -w 07:02.0 -- -i --txq=2 --rxq=2 --rxd=512 --txd=512 --nb-cores=4 --rss-ip
+
+     testpmd>set promisc all off
+     testpmd>set fwd mac
+     testpmd>start
+
+ 4). send traffic and vefify throughput
+
+Test Csse: scalar/bulk vf performance::
+
+ 1). change CONFIG_RTE_LIBRTE_AVF_INC_VECTOR=n in config/common_base, and rebuild dpdk
+ 2). repeat test steps 2-4 in above test case: vector vf performance.
+
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [dts] [DTS][Patch V3 1/2] Add test suite for avf
  2018-08-24  3:04 [dts] [DTS][Patch V3 2/2] Add test plan for avf Wang Fei
@ 2018-08-24  3:04 ` Wang Fei
  0 siblings, 0 replies; 2+ messages in thread
From: Wang Fei @ 2018-08-24  3:04 UTC (permalink / raw)
  To: dts; +Cc: lijuan.tu

Signed-off-by: Wang Fei <feix.y.wang@intel.com>
---
 tests/TestSuite_avf.py | 924 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 924 insertions(+)
 create mode 100644 tests/TestSuite_avf.py

diff --git a/tests/TestSuite_avf.py b/tests/TestSuite_avf.py
new file mode 100644
index 0000000..f0eb6bf
--- /dev/null
+++ b/tests/TestSuite_avf.py
@@ -0,0 +1,924 @@
+import utils
+
+from test_case import TestCase
+from etgen import IxiaPacketGenerator
+from packet import *
+#Packet, sniff_packets, load_sniff_packets
+
+from settings import HEADER_SIZE
+from pmd_output import PmdOutput
+
+class TestAVF(TestCase, IxiaPacketGenerator):
+
+
+    def set_up_all(self):
+
+        self.tester.extend_external_packet_generator(TestAVF, self)
+
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >=2, "Insufficent DUT Ports")
+        self.socket = self.dut.get_numa_id(self.dut_ports[0])
+        self.cores = self.dut.get_core_list("1S/10C/1T", self.socket)
+
+        # config for AVF setting
+        self.dut.send_expect("sed -i -e '/AVF_DEV_ID_ADAPTIVE_VF/s/0x1889/0x154c/g' drivers/net/avf/base/avf_devids.h", "# ")
+        self.dut.send_expect("sed -i -e '/I40E_DEV_ID_VF/s/0x154C/0x164C/g'  drivers/net/i40e/base/i40e_devids.h", "# ")
+
+        self.dut.build_install_dpdk(self.target)
+
+        self.vf_mac0 = "00:12:34:56:78:01"
+        self.vf_mac1 = "00:12:34:56:78:02"
+
+        self.frame_sizes = [64, 128, 256, 512]
+
+        # flags to indicate if 2pf2vf or 1pf2vf environment is setup ready            
+        self.env_2pf2vf_done = False
+        self.env_1pf2vf_done = False
+
+        self.testpmd_2pf2vf_done = False
+
+    def set_up(self):
+        pass
+
+    def set_2pf2vf_env(self):
+        '''
+        create 2 vf ports from 2 dpdk driver pf ports
+        '''
+        self.pf_pci0 = self.dut.ports_info[0]['pci']
+        self.pf_pci1 = self.dut.ports_info[1]['pci']
+
+        self.tx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))
+        self.rx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[1]))
+
+        # bind 2 pf ports to kernel driver first  
+        self.dut.ports_info[0]['port'].bind_driver("default")
+        self.dut.ports_info[1]['port'].bind_driver("default")
+
+        #reinstall igb_uio driver and bind to the 2 pf ports
+        try:
+            self.dut.send_expect("rmmod igb_uio", "# ", 60)
+            self.dut.send_expect("insmod %s/kmod/igb_uio.ko" % self.target, "# ", 60)
+        except Exception as e:
+            raise Exception(e)
+
+        self.dut.ports_info[0]['port'].bind_driver("igb_uio")
+        self.dut.ports_info[1]['port'].bind_driver("igb_uio")
+
+        #create 2 vf from igb_uio driver
+        self.dut.generate_sriov_vfs_by_port(self.dut_ports[0], 1, "igb_uio") 
+        self.dut.generate_sriov_vfs_by_port(self.dut_ports[1], 1, "igb_uio")
+
+        self.vf0_port = self.dut.ports_info[0]['vfs_port']
+        self.vf1_port = self.dut.ports_info[1]['vfs_port']
+        self.vf0_port_pci = self.dut.ports_info[0]['sriov_vfs_pci'][0]
+        self.vf1_port_pci = self.dut.ports_info[1]['sriov_vfs_pci'][0]
+
+        #bind vf ports to igb_uio driver
+        self.vf0_port[0].bind_driver("igb_uio")
+        self.vf1_port[0].bind_driver("igb_uio")
+
+        #config the command line for vf
+        cores_2vf = self.cores[5:]
+        core_mask_2vf = utils.create_mask(cores_2vf)
+        self.cmdline_2vf = "./dpdk/{}/app/testpmd -c {} -n 4 --master-lcore={} --socket-mem=1024,1024 --file-prefix=vf replacement -- -i --txq=4 --rxq=4 --nb-cores=4".format(\
+            self.dut.target, core_mask_2vf, cores_2vf[0])
+
+        #start testpmd for pf
+        pf0_pci = self.dut.ports_info[0]['pci']
+        pf1_pci = self.dut.ports_info[1]['pci']
+        eal_param_2pf = "--socket-mem=1024,1024 --file-prefix=pf -w {} -w {}".format(self.pf_pci0, self.pf_pci1)
+        cores_2pf = self.cores[0:5]
+        self.testpmd_2pf = PmdOutput(self.dut)
+        out = self.testpmd_2pf.start_testpmd(cores_2pf, eal_param=eal_param_2pf, socket=self.socket)
+        print out
+
+        # set vf mac 
+        self.testpmd_2pf.execute_cmd("set vf mac addr 0 0 %s" % self.vf_mac0)
+        self.testpmd_2pf.execute_cmd("set vf mac addr 1 0 %s" % self.vf_mac1)
+        
+        self.env_2pf2vf_done = True
+
+    def set_1pf2vf_env(self):
+        '''
+        create 2 vf ports from 1 dpdk driver pf port
+        '''
+        self.pf_pci0 = self.dut.ports_info[0]['pci']
+
+        self.tx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))
+        self.rx_interface = self.tx_interface
+
+        # bind pf port to kernel driver first  
+        self.dut.ports_info[0]['port'].bind_driver("default")
+
+        #reinstall igb_uio driver and bind to the pf port
+        try:
+            self.dut.send_expect("rmmod igb_uio", "# ",60)
+            self.dut.send_expect("insmod %s/kmod/igb_uio.ko" % self.target, "# ",60)
+        except Exception as e:
+            raise Exception(e)
+
+        self.dut.ports_info[0]['port'].bind_driver("igb_uio")
+
+        #create 2 vf from igb_uio driver
+        self.dut.generate_sriov_vfs_by_port(self.dut_ports[0], 2, "igb_uio") 
+
+        self.vf_port = self.dut.ports_info[0]['vfs_port']
+        self.vf0_port_pci = self.dut.ports_info[0]['sriov_vfs_pci'][0]
+        self.vf1_port_pci = self.dut.ports_info[0]['sriov_vfs_pci'][1]
+
+        #bind vf ports to igb_uio driver
+        self.vf_port[0].bind_driver("igb_uio")
+        self.vf_port[1].bind_driver("igb_uio")
+
+        #config the command line for vf0
+        cores_for_vf0 = self.cores[2:5]
+        core_mask_for_vf0 = utils.create_mask(cores_for_vf0)
+        self.cmdline_for_vf0 = "./dpdk/{}/app/testpmd -c {} -n 4 --master-lcore={} --socket-mem=1024,1024 --file-prefix=vf0 -w {} -- -i --txq=2 --rxq=2 \
+              --txd=512 --rxd=512 --nb-cores=2 --rss-ip --eth-peer=0,00:12:34:56:78:02".format(self.dut.target, core_mask_for_vf0, cores_for_vf0[0], self.vf0_port_pci)
+
+        #config the command line for vf0
+        cores_for_vf1 = self.cores[5:8]
+        core_mask_for_vf1 = utils.create_mask(cores_for_vf1)
+        self.cmdline_for_vf1 = "./dpdk/{}/app/testpmd -c {} -n 4 --master-lcore={} --socket-mem=1024,1024 --file-prefix=vf1 -w {} -- -i --txq=2 --rxq=2 \
+              --txd=512 --rxd=512 --rss-ip --nb-cores=2".format(self.dut.target, core_mask_for_vf1, cores_for_vf1[0], self.vf1_port_pci) 
+
+        #start testpmd for pf
+        pf0_pci = self.dut.ports_info[0]['pci']
+        eal_param_1pf = "--socket-mem=1024,1024 --file-prefix=pf -w {}".format(self.pf_pci0)
+        cores_1pf = self.cores[0:2]
+        self.testpmd_1pf = PmdOutput(self.dut)
+        out = self.testpmd_1pf.start_testpmd(cores_1pf, eal_param=eal_param_1pf, socket=self.socket)
+        print out
+
+        # set vf MACs 
+        self.testpmd_1pf.execute_cmd("set vf mac addr 0 0 %s" % self.vf_mac0)
+        self.testpmd_1pf.execute_cmd("set vf mac addr 0 1 %s" % self.vf_mac1)
+
+        self.env_1pf2vf_done = True
+
+    def check_env_2pf2vf(self):
+        '''
+        check if enviroment for 2pf 2vf is ready
+        '''
+        if self.env_1pf2vf_done == True:
+            self.destory_1pf2vf()
+
+        if self.env_2pf2vf_done == True:
+            pass
+        else:
+            self.set_2pf2vf_env()
+
+    def check_env_1pf2vf(self):
+        '''
+        check if enviroment for 1pf 2vf is ready
+        '''
+        if self.env_2pf2vf_done == True:
+            self.destory_2pf2vf()
+
+        if self.env_1pf2vf_done == True:
+            pass
+        else:
+            self.set_1pf2vf_env()
+
+    def send_check_packet(self, pktType='UDP', dstMac='', pktLength=64, pktCount=10, VID=100):
+        '''
+        send configed packets and check received packet number
+        '''
+        self.logger.info("sending %s packets" % pktCount)
+
+        payload = pktLength - HEADER_SIZE['eth'] - HEADER_SIZE['ip'] - HEADER_SIZE['udp']
+        pkt = Packet(pkt_type=pktType)
+        pkt.config_layer('ether', {'dst': dstMac})
+        if pktType == "VLAN_UDP":
+            pkt.config_layer('vlan', {'vlan': VID})
+            #4 bype header size for vlan overhead
+            payload = payload - 4
+        pkt.config_layer('ipv4', {'dst': '2.1.1.1'})
+        pkt.config_layer('raw', {'payload': ['58'] * payload})
+        inst = sniff_packets(self.rx_interface, timeout=5)
+        pkt.send_pkt(tx_port=self.tx_interface, count=pktCount)
+        pkts = load_sniff_packets(inst)
+
+        self.logger.info("received %d packets" % len(pkts))
+
+        return (len(pkts), pkts)
+
+    def destroy_2pf2vf(self):
+        try:
+            getattr(self, "vf0_port", None)
+            self.dut.destroy_sriov_vfs_by_port(self.dut_ports[0])
+            getattr(self, "vf1_port", None)
+            self.dut.destroy_sriov_vfs_by_port(self.dut_ports[1])
+        except Exception as e:
+            self.logger.info(e)
+
+        self.env_2pf2vf_done = False
+
+    def destroy_1pf2vf(self):
+        try:
+            getattr(self, "vf_port[0]", None) or getattr(self, "vf_port[1]", None) 
+            self.dut.destroy_sriov_vfs_by_port(self.dut_ports[0])
+        except Exception as e:
+            self.logger.info(e)
+
+        self.env_1pf2vf_done = False
+
+    def destroy_vf(self):
+        self.destroy_2pf2vf()
+        self.destroy_1pf2vf()
+
+    def test_a_basic_rxtx(self):
+        self.check_env_2pf2vf()
+
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+        self.logger.info("Sending 10 packets")
+        self.dut.send_expect("set promisc all on", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        pkt = Packet(pkt_type='UDP')
+        pkt.config_layer('ether', {'dst': self.vf_mac0})
+        inst = sniff_packets(self.rx_interface, timeout=5)
+        pkt.send_pkt(tx_port=self.tx_interface, count=10)
+        pkts = load_sniff_packets(inst)
+        print len(pkts)
+        self.dut.send_expect("quit", "# ", alt_session=True)
+        self.verify(len(pkts) == 10, "Packets Receive Error")
+
+    def test_b_unicast(self):
+        self.check_env_2pf2vf()
+
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+        self.dut.send_expect("set promisc all off", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set allmulti all off", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        self.logger.info("Testing Unicast Packets")
+        self.logger.info("Sending 10 packets with vf0 mac")
+        pkt = Packet(pkt_type='UDP')
+        pkt.config_layer('ether', {'dst': self.vf_mac0})
+        inst = sniff_packets(self.rx_interface, timeout=5)
+        pkt.send_pkt(tx_port=self.tx_interface, count=10)
+        pkts = load_sniff_packets(inst)
+        self.logger.info("Recieved %d packets" % len(pkts))
+        try:
+            self.verify(len(pkts) == 10, "Not Expected Packet Number")
+        except:
+            pass
+
+        self.logger.info("Sending 10 packets with other mac")
+        pkt = Packet(pkt_type='UDP')
+        pkt.config_layer('ether', {'dst': "11:22:33:44:55:66"})
+        inst = sniff_packets(self.rx_interface, timeout=5)
+        pkt.send_pkt(tx_port=self.tx_interface, count=10)
+        pkts = load_sniff_packets(inst)
+        self.logger.info("Recieved %d packets" % len(pkts))
+        try:
+            self.verify(len(pkts) == 0, "Not Expected Packet Number")
+        except Exception as e:
+            rasie (e)
+        finally:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+    def test_c_multicast(self):
+        self.check_env_2pf2vf()
+
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+        # test multicast packets 
+        self.logger.info("Testing Multicast packets")
+        self.dut.send_expect("set promisc all off", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set allmulti all on", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        #send 10 multicast packets, and forward 10 packets
+        self.logger.info("Sending 10 multicast packets")
+        pkt = Packet(pkt_type='UDP')
+        pkt.config_layer('ether', {'dst': "01:80:C2:00:00:08"})
+        inst = sniff_packets(self.rx_interface, timeout=5)
+        pkt.send_pkt(tx_port=self.tx_interface, count=10)
+        pkts = load_sniff_packets(inst)
+        self.logger.info("Recieved %d packets" % len(pkts))
+        try:
+            self.verify(len(pkts) == 10, "Not Expected Packet Number")
+        except:
+            pass
+
+        # disable multicase
+        self.dut.send_expect("stop", "testpmd>", alt_session=True)
+        self.dut.send_expect("set allmulti all off", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        self.logger.info("Sending 10 multicast packets")
+        pkt = Packet(pkt_type='UDP', pktLength=100)
+        pkt.config_layer('ether', {'dst': "01:80:C2:00:00:08"})
+        inst = sniff_packets(self.rx_interface, timeout=5)
+        pkt.send_pkt(tx_port=self.tx_interface, count=10)
+        pkts = load_sniff_packets(inst)
+        self.logger.info("Recieved %d packets" % len(pkts))
+        print len(pkts)
+        try:
+            self.verify(len(pkts) == 0, "Not Expected Packet Number")
+        except Exception as e:
+            raise (e)
+        finally:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+    def test_d_broadcast(self):
+        self.check_env_2pf2vf()
+
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+
+        self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        # quit testpmd for vf first to ensure normal packet receiving, not sure why??
+        self.dut.send_expect('quit', "# ", alt_session=True)
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+
+        self.dut.send_expect("set promisc all off", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        # test broadcast packets
+        self.logger.info("Testing Broadcast packet")
+        self.logger.info("Sending 10 broadcast packets")
+
+        pkt = Packet(pkt_type='UDP')
+        pkt.config_layer('ether', {'dst': "ff:ff:ff:ff:ff:ff"})
+        inst = sniff_packets(self.rx_interface, timeout=5)
+        pkt.send_pkt(tx_port=self.tx_interface, count=10)
+        pkts = load_sniff_packets(inst)
+        self.logger.info("Recieved %d packets" % len(pkts))
+        print len(pkts)
+        try:
+            self.verify(len(pkts) == 10, "Not Expected Packet Number")
+        except Exception as e:
+            raise (e)
+        finally:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+    def test_e_vf_vlan_filter(self):
+        self.check_env_2pf2vf()
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+
+        self.dut.send_expect("port stop all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set promisc all off", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set filter off 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set filter off 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip off 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip off 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set filter on 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("port start all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        #send 10 vlan tagged packets,and cat't forward the packets
+        rec_packets, _ = self.send_check_packet(pktType="VLAN_UDP", dstMac=self.vf_mac0, pktLength=100, VID=200)
+        self.verify(rec_packets == 0, "Not Expected Packets")
+
+        #send 10 untagged packets,and forward the packets
+        rec_packets, _ = self.send_check_packet(pktType="UDP", dstMac=self.vf_mac0, pktLength=100)
+        try:
+            self.verify(rec_packets == 10, "Not Expected Packets")
+        except Exception as e:
+            rasie (e)
+        finally:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+    def test_f_vf_rx_vlan(self):
+        self.check_env_2pf2vf()
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+
+        self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        # quit testpmd for vf to ensure normal forwarding, not sure why??
+        self.dut.send_expect('quit', "# ", alt_session=True)
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+
+        out = self.dut.send_expect("port stop all", "testpmd> ", alt_session=True)
+        print out
+        out = self.dut.send_expect("set promisc all off", "testpmd> ", alt_session=True)
+        print out
+        out = self.dut.send_expect("vlan set filter off 0", "testpmd> ", alt_session=True)
+        print out 
+        self.dut.send_expect("vlan set filter off 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip off 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip off 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set filter on 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("rx_vlan add 20 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set fwd mac", "testpmd> ", alt_session=True)
+        out = self.dut.send_expect("port start all", "testpmd> ", alt_session=True)
+        print out
+        out = self.dut.send_expect("start", "testpmd> ", alt_session=True)
+        print out
+
+        try:
+            #send 10 vid20 tagged packets,and can forward the packets
+            try:
+                rec_packets, _ = self.send_check_packet(pktType="VLAN_UDP", dstMac=self.vf_mac0, pktLength=100, VID=20)
+                self.verify(rec_packets == 10, "Not Expected Packets")
+            except Exception as e:
+                raise (e)
+
+            #send 10 vid200 tagged packets,and can't forward the packets
+            try:
+                rec_packets, _ = self.send_check_packet(pktType="VLAN_UDP", dstMac=self.vf_mac0, pktLength=100, VID=200)
+                self.verify(rec_packets == 0, "Not Expected Packets")
+            except Exception as e:
+                raise (e)
+
+            #send 10 vid0 tagged packets,and can forward the packets
+            try:
+                rec_packets, _ = self.send_check_packet(pktType="VLAN_UDP", dstMac=self.vf_mac0, pktLength=100, VID=0)
+                self.verify(rec_packets == 10, "Not Expected Packets")
+            except Exception as e:
+                raise (e)
+        except Exception as e:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+            raise (e)
+        else:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+
+    def test_g_vf_tx_vlan(self):
+        self.check_env_2pf2vf()
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+
+        self.dut.send_expect("port stop all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set promisc all on", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set fwd mac", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set filter off 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set filter off 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip off 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip off 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("tx_vlan set 1 20", "testpmd> ", alt_session=True)
+        self.dut.send_expect("port start all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        #send 10 untagged packets,and check 10 tagged packets received
+        rec_packets, packets = self.send_check_packet(pktType="UDP", dstMac=self.vf_mac0, pktLength=64)
+
+        try:
+            self.verify(rec_packets == 10, "Not Expected Packets")
+        except Exception as e:
+            raise (e)
+        finally:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+        payload = strip_pktload(packets[0], "L2")
+        print(payload)
+
+    def test_h_vlan_strip(self):
+        self.check_env_2pf2vf()
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+
+        self.dut.send_expect("port stop all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set promisc all on", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set fwd mac", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set filter off 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set filter off 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip off 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip off 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip on 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("port start all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        #send 10 tagged packets,and check 10 untagged packets received
+        rec_packets, packets = self.send_check_packet(pktType="UDP", dstMac=self.vf_mac0, pktLength=64, VID=100)
+
+        try:
+            self.verify(rec_packets == 10, "Not Expected Packets")
+        except Exception as e:
+            raise (e)
+        finally:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+        payload = strip_pktload(packets[0], "L2")
+        print(payload)
+
+    def test_i_vlan_promisc(self):
+        self.check_env_2pf2vf()
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+
+        self.dut.send_expect("port stop all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set promisc all on", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set fwd mac", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set filter off 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set filter off 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip off 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("vlan set strip off 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("port start all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        #send 10 tagged packets,and check 10 tagged packets received
+        rec_packets, packets = self.send_check_packet(pktType="UDP", dstMac=self.vf_mac0, pktLength=64, VID=100)
+        try:
+            self.verify(rec_packets == 10, "Not Expected Packets")
+        except Exception as e:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+            raise (e)
+
+        #send 10 untagged packets,and check 10 untagged packets received
+        rec_packets, packets = self.send_check_packet(pktType="UDP", dstMac=self.vf_mac0, pktLength=64)
+        try:
+            self.verify(rec_packets == 10, "Not Expected Packets")
+        except Exception as e:
+            raise (e)
+        finally:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+
+    def test_j_vf_no_jumbo(self):
+        self.check_env_2pf2vf()
+
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+
+        self.dut.send_expect("set fwd mac", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        # set tester port mtu
+        self.tester.send_expect("ifconfig %s mtu %d" % (self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])), 9000), "# ")
+        self.tester.send_expect("ifconfig %s mtu %d" % (self.tester.get_interface(self.tester.get_local_port(self.dut_ports[1])), 9000), "# ")
+
+        #send 10 1518 size  packets,and check 10 packets received
+        rec_packets, _ = self.send_check_packet(pktType="UDP", dstMac=self.vf_mac0, pktLength=1518)
+        try:
+            self.verify(rec_packets == 10, "Not Expected Packets")
+        except Exception as e:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+            raise (e)
+
+        #send 10 1519 size  packets,and check 0 packets received
+        rec_packets, _ = self.send_check_packet(pktType="UDP", dstMac=self.vf_mac0, pktLength=1519)
+        try:
+            self.verify(rec_packets == 0, "Not Expected Packets")
+        except Exception as e:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+            raise (e)
+        finally:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+    def test_k_vf_normal_jumbo(self):
+
+        self.check_env_2pf2vf()
+
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        commandline += " --max-pkt-len=3000 --tx-offloads=0x8000"
+        #commandline += " --max-pkt-len=3000"
+        print commandline
+
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+
+        self.dut.send_expect("set fwd mac", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        # set tester port mtu
+        self.tester.send_expect("ifconfig %s mtu %d" % (self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])), 9000), "# ")
+        self.tester.send_expect("ifconfig %s mtu %d" % (self.tester.get_interface(self.tester.get_local_port(self.dut_ports[1])), 9000), "# ")
+
+        #send 10 1518 size  packets,and check 10 packets received
+        rec_packets, _ = self.send_check_packet(pktType="UDP", dstMac=self.vf_mac0, pktLength=1518)
+        try:
+            self.verify(rec_packets == 10, "Not Expected Packets")
+        except Exception as e:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+            raise (e)
+
+        #send 10 1519 size  packets,and check 0 packets received
+        rec_packets, _ = self.send_check_packet(pktType="UDP", dstMac=self.vf_mac0, pktLength=1519)
+        try:
+            self.verify(rec_packets == 10, "Not Expected Packets")
+        except Exception as e:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+            raise (e)
+        finally:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+    def validate_checksum_packet(self):
+        checksum_error_packets = {'IP/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' % self.vf_mac0,
+                      'IP/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46)' % self.vf_mac0,
+		      'IP/SCTP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/SCTP(chksum=0xf)/("X"*48)' % self.vf_mac0,
+                      'IPv6/UDP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' % self.vf_mac0,
+                      'IPv6/TCP': 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' % self.vf_mac0}
+
+        normal_packets = {'IP/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.1")/UDP()/("X"*46)' % self.vf_mac0,
+                'IP/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.1")/TCP()/("X"*46)' % self.vf_mac0,
+                'IP/SCTP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.1")/SCTP()/("X"*48)' % self.vf_mac0,
+                'IPv6/UDP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="::1")/UDP()/("X"*46)' % self.vf_mac0,
+                'IPv6/TCP': 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="::1")/TCP()/("X"*46)' % self.vf_mac0}
+
+        normal_checksum_values = {}
+        checksum_pattern = re.compile("chksum.*=.*(0x[0-9a-z]+)")
+        self.tester.send_expect("scapy", ">>> ")
+        for packet in normal_packets:
+            self.tester.send_expect("p = %s" % normal_packets[packet], ">>>")
+            out = self.tester.send_expect("p.show2()", ">>>")
+            chksums = checksum_pattern.findall(out)
+            if chksums:
+                normal_checksum_values[packet] = chksums
+        self.tester.send_expect("exit()", "#")
+        for index in normal_checksum_values:
+            self.logger.info("Good checksum value for %s Packet is: %s" % (index, normal_checksum_values[index]))
+
+        # sends checksum error packets and check if the checksum fields were corrected
+        corrected_checksum_values = {}
+        for packet in checksum_error_packets:
+            inst = sniff_packets(self.rx_interface, timeout=5)
+            self.tester.scapy_foreground()
+            self.tester.scapy_append('sendp([%s], iface="%s")' % (checksum_error_packets[packet], self.tx_interface))
+            self.tester.scapy_execute()
+            rec_pkt = load_sniff_packets(inst)
+            # collect checksum values for received packet
+            chksum = rec_pkt[0].pktgen.pkt.sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum%").split(";")
+            chksum = list(set(chksum))
+            chksum.remove("??")
+            corrected_checksum_values[packet] = chksum
+
+        for packet in corrected_checksum_values:
+            self.logger.info("Corrected checksum value for %s Packet is: %s" % (packet, corrected_checksum_values[packet]))
+
+        # check if the corrected checksum vaules are same with the normal packets checksum values
+        for packet in normal_packets:
+            #set_trace()
+            corrected_checksum_values[packet].sort()
+            normal_checksum_values[packet].sort()
+            self.verify(corrected_checksum_values[packet] == normal_checksum_values[packet], \
+                         "Unxpected Checksum Error For Packet %s" % packet)
+
+    def test_l_vf_checksum_sw(self):
+        self.check_env_2pf2vf()
+
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+
+        self.dut.send_expect("port stop all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set ip sw 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set udp sw 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set tcp sw 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set sctp sw 0", "testpmd> ", alt_session=True)
+
+        self.dut.send_expect("csum set ip sw 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set udp sw 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set tcp sw 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set sctp sw 1", "testpmd> ", alt_session=True)
+
+        self.dut.send_expect("set fwd csum", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set verbose 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("port start all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        try:
+            self.validate_checksum_packet()
+        except Exception as e:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+            raise Exception(e)
+        else:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+    def test_m_vf_checksum_hw(self):
+        self.check_env_2pf2vf()
+
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        print commandline
+
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+
+        self.dut.send_expect("port stop all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set ip hw 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set udp hw 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set tcp hw 0", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set sctp hw 0", "testpmd> ", alt_session=True)
+
+        self.dut.send_expect("csum set ip hw 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set udp hw 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set tcp hw 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("csum set sctp hw 1", "testpmd> ", alt_session=True)
+
+        self.dut.send_expect("set fwd csum", "testpmd> ", alt_session=True)
+        self.dut.send_expect("set verbose 1", "testpmd> ", alt_session=True)
+        self.dut.send_expect("port start all", "testpmd> ", alt_session=True)
+        self.dut.send_expect("start", "testpmd> ", alt_session=True)
+
+        try:
+            self.validate_checksum_packet()
+        except Exception as e:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+            raise Exception(e)
+        else:
+            self.dut.send_expect("quit", "# ", alt_session=True)
+
+    def test_n_rx_interrupt(self):
+
+        self.check_env_2pf2vf()
+        self.dut.send_expect("modprobe vfio-pci", "", alt_session=True)
+
+        app_to_make = "make -C dpdk/examples/l3fwd-power RTE_SDK=/root/dpdk T=%s" % self.target
+        out = self.dut.send_expect(app_to_make, "# ", alt_session=True)
+        print out
+
+        self.vf0_port[0].bind_driver("vfio-pci")
+        self.vf1_port[0].bind_driver("vfio-pci")
+
+        vf_pci_writelist = " -w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        interrupt_app_cmd = "./dpdk/examples/l3fwd-power/build/l3fwd-power -l %s,%s -n 4" % (self.cores[5], self.cores[6])
+        interrupt_app_cmd += vf_pci_writelist
+        interrupt_app_cmd += " -- -p 0x3 --config '(0,0,%s),(1,0,%s)'" % (self.cores[5], self.cores[6])
+        print interrupt_app_cmd 
+        out = self.dut.send_expect(interrupt_app_cmd, "", alt_session=True)
+        print out
+
+        rec_packets, _  = self.send_check_packet(dstMac=self.vf_mac0, pktCount=10)
+        try:
+            self.verify(rec_packets==10, "Packets Receive Error")
+        except Exception as e:
+            self.dut.send_expect("^c", "# ", alt_session=True)
+            raise (e)
+        #self.dut.send_expect("^c", "# ", alt_session=True)
+
+    def test_perf_veb_performance(self):
+        self.check_env_1pf2vf()
+
+        print self.cmdline_for_vf0 
+        out = self.dut.send_expect(self.cmdline_for_vf0, "testpmd> ", alt_session=True)
+        print out
+        out = self.dut.send_expect("set promisc all on", "testpmd> ", alt_session=True)
+        print out
+        out = self.dut.send_expect("set fwd mac", "testpmd> ", alt_session=True)
+        print out
+        out = self.dut.send_expect("start", "testpmd> ", alt_session=True)
+        print out
+
+        self.vf1_session = self.dut.create_session(name='vf1')
+        self.vf1_session.send_expect(self.cmdline_for_vf1, "testpmd> ")
+        self.vf1_session.send_expect("set promisc all on", "testpmd> ")
+        self.vf1_session.send_expect("set fwd mac", "testpmd> ")
+        self.vf1_session.send_expect("start", "testpmd> ")
+
+        perf_test_pass = self.perf_test(veb=True)
+        
+        self.dut.send_expect("quit", "# ", alt_session=True)
+        self.vf1_session.send_expect("quit", "# ")
+        self.dut.destroy_session("vf1")
+
+        self.verify(perf_test_pass == 0, "Traffic Blocked")
+        
+    def test_perf_vector_vf_performance(self):
+        self.check_env_2pf2vf()
+
+        out = self.dut.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_AVF_INC_VECTOR=.*$/CONFIG_RTE_LIBRTE_AVF_INC_VECTOR=y/g'  config/common_base", "# ")
+        print out
+        out = self.dut.send_expect("rm -fr %s" % self.target, "# ", alt_session=True)
+        print out
+        out = self.dut.send_expect("make -j install T=%s" % self.target, "# ", alt_session=True)
+        print out
+
+        self.vf_performance()
+
+    def test_perf_scalar_vf_performance(self):
+        
+        out = self.dut.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_AVF_INC_VECTOR=.*$/CONFIG_RTE_LIBRTE_AVF_INC_VECTOR=n/g'  config/common_base", "# ") 
+        print out
+        out = self.dut.send_expect("rm -fr %s" % self.target, "# ", alt_session=True)
+        print out
+        set_trace()
+        out = self.dut.send_expect("make -j install T=%s" % self.target, "# ", alt_session=True)
+        print out
+
+        self.check_env_2pf2vf()
+        self.vf_performance()
+
+    def vf_performance(self):
+
+        #self.check_env_2pf2vf()
+
+        vf_pci_writelist = "-w {} -w {}".format(self.vf0_port_pci, self.vf1_port_pci)
+        commandline = self.cmdline_2vf.replace("replacement", vf_pci_writelist)
+        commandline += " --txd=512 --rxd=512 --rss-ip"
+        print commandline
+        out = self.dut.send_expect(commandline, "testpmd> ", alt_session=True)
+        print out
+        out = self.dut.send_expect("set promisc all on", "testpmd> ", alt_session=True)
+        print out
+        out = self.dut.send_expect("set fwd mac", "testpmd> ", alt_session=True)
+        print out
+        out = self.dut.send_expect("start", "testpmd> ", alt_session=True)
+        print out
+        perf_test_pass = self.perf_test()
+
+        self.dut.send_expect("quit", "# ", alt_session=True)
+        self.verify(perf_test_pass == 0, "Traffic Blocked")
+
+    def perf_test(self, veb=False):
+
+        tgen_input = []
+        if veb:
+            tgen_input.append((self.tester.get_local_port(self.dut_ports[0]),
+                           self.tester.get_local_port(self.dut_ports[0]),
+                           "test1.pcap"))
+        else:
+            tgen_input.append((self.tester.get_local_port(self.dut_ports[0]),
+                           self.tester.get_local_port(self.dut_ports[1]),
+                           "test1.pcap"))
+            tgen_input.append((self.tester.get_local_port(self.dut_ports[1]),
+                               self.tester.get_local_port(self.dut_ports[0]),
+                               "test2.pcap"))
+        test_cycle = {}
+        test_cycle['Mpps'] = {}
+        test_cycle["pct"] = {}
+
+        for frame_size in self.frame_sizes:
+            self.logger.info("Running with frame size %d " % frame_size)
+
+            wirespeed = self.wirespeed(self.nic, frame_size, 2)
+            header_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + HEADER_SIZE['tcp']
+            payload_size = frame_size - header_size
+            self.tester.scapy_append(
+                    'wrpcap("test1.pcap", [Ether(dst=%s)/IP(src="1.2.3.4",dst="2.1.1.1")/TCP()/("X"*%d)])' % (self.vf_mac0, payload_size))
+            self.tester.scapy_execute()
+            self.tester.scapy_append(
+                    'wrpcap("test2.pcap", [Ether(dst=%s)/IP(src="1.2.3.4",dst="1.1.1.1")/TCP()/("X"*%d)])' % (self.vf_mac1, payload_size))
+            self.tester.scapy_execute()
+
+            _, pps = self.tester.traffic_generator_throughput(tgen_input, rate_percent=100, delay=60)
+
+            pps /= 1000000.0
+            # check if traffic was blocked
+            if pps == 0:
+                return -1
+            pct = pps * 100 / wirespeed
+            test_cycle['Mpps'][frame_size] = float('%.3f' % pps)
+            test_cycle['pct'][frame_size] = float('%.3f' % pct)
+
+        # print test result
+        table_header = ['frame_size', 'Mpps', 'Line Rate']
+        self.result_table_create(table_header)
+        for frame_size in self.frame_sizes:
+            table_row = [frame_size]
+            table_row.append(test_cycle['Mpps'][frame_size])
+            table_row.append(test_cycle['pct'][frame_size])
+            self.result_table_add(table_row)
+        self.result_table_print()
+
+        return 0
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        # quit testpmd for PF ports
+        self.dut.send_expect("quit", "# ")
+
+        self.destroy_vf()
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.dut.send_expect("sed -i -e '/AVF_DEV_ID_ADAPTIVE_VF/s/0x154c/0x1889/g' drivers/net/avf/base/avf_devids.h", "# ")
+        self.dut.send_expect("sed -i -e '/I40E_DEV_ID_VF/s/0x164C/0x154C/g' drivers/net/i40e/base/i40e_devids.h", "# ")
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-24  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-24  3:04 [dts] [DTS][Patch V3 2/2] Add test plan for avf Wang Fei
2018-08-24  3:04 ` [dts] [DTS][Patch V3 1/2] Add test suite " Wang Fei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).