test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH v2 1/3] conf vf_jumbo: add config file for vf jumboframe suite
@ 2016-02-05 16:01 Yong Liu
  2016-02-05 16:01 ` [dts] [PATCH v2 2/3] test_plan: add vf jumbo frame test plan Yong Liu
  2016-02-05 16:01 ` [dts] [PATCH v2 3/3] tests: add vf jumbo frame suite Yong Liu
  0 siblings, 2 replies; 3+ messages in thread
From: Yong Liu @ 2016-02-05 16:01 UTC (permalink / raw)
  To: dts

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/conf/vf_jumboframe.cfg b/conf/vf_jumboframe.cfg
new file mode 100644
index 0000000..94e68b4
--- /dev/null
+++ b/conf/vf_jumboframe.cfg
@@ -0,0 +1,11 @@
+[vm0]
+cpu =
+    model=host,number=4,cpupin=5 6 7 8;
+disk =
+    file=/storage/vm-image/vm0.img;
+login =
+    user=root,password=tester;
+vnc = 
+    displayNum=1;
+daemon =
+    enable=yes;
-- 
1.9.3

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

* [dts] [PATCH v2 2/3] test_plan: add vf jumbo frame test plan
  2016-02-05 16:01 [dts] [PATCH v2 1/3] conf vf_jumbo: add config file for vf jumboframe suite Yong Liu
@ 2016-02-05 16:01 ` Yong Liu
  2016-02-05 16:01 ` [dts] [PATCH v2 3/3] tests: add vf jumbo frame suite Yong Liu
  1 sibling, 0 replies; 3+ messages in thread
From: Yong Liu @ 2016-02-05 16:01 UTC (permalink / raw)
  To: dts

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/test_plans/vf_jumboframe_test_plan.rst b/test_plans/vf_jumboframe_test_plan.rst
new file mode 100644
index 0000000..68e7e5b
--- /dev/null
+++ b/test_plans/vf_jumboframe_test_plan.rst
@@ -0,0 +1,141 @@
+.. Copyright (c) <2015>, 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.
+
+ 
+
+The support of jumbo frames by Poll Mode Drivers consists in enabling a port
+to receive Jumbo Frames with a configurable maximum packet length that is
+greater than the standard maximum Ethernet frame length (1518 bytes), up to
+a maximum value imposed by the hardware.
+
+
+Prerequisites
+=============
+1. Create VF device from PF devices.
+	./dpdk_nic_bind.py --st
+	0000:87:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
+	0000:87:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
+
+    echo 1 > /sys/bus/pci/devices/0000\:87\:00.0/sriov_numvfs
+	echo 1 > /sys/bus/pci/devices/0000\:87\:00.1/sriov_numvfs
+
+    ./dpdk_nic_bind.py --st
+
+    0000:87:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
+    0000:87:02.0 'XL710/X710 Virtual Function' unused=
+    0000:87:0a.0 'XL710/X710 Virtual Function' unused=
+
+2. Detach VFs from the host, bind them to pci-stub driver,
+
+	/sbin/modprobe pci-stub
+
+	using `lspci -nn|grep -i ethernet` got VF device id, for example "8086 154c",
+
+	echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
+	echo 0000:87:02.0 > /sys/bus/pci/devices/0000:87:02.0/driver/unbind
+	echo 0000:87:02.0 > /sys/bus/pci/drivers/pci-stub/bind
+
+	echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
+	echo 0000:87:0a.0 > /sys/bus/pci/devices/0000:87:0a.0/driver/unbind
+	echo 0000:87:0a.0 > /sys/bus/pci/drivers/pci-stub/bind
+
+3. Passthrough VFs 87:02.0 & 87:02.1 to vm0 and start vm0,
+
+    /usr/bin/qemu-system-x86_64  -name vm0 -enable-kvm \
+	-cpu host -smp 4 -m 2048 -drive file=/home/image/sriov-fc20-1.img -vnc :1 \
+	-device pci-assign,host=87:02.0,id=pt_0 \
+	-device pci-assign,host=87:0a.0,id=pt_1
+
+4. Login vm0 and them bind VF devices to igb_uio driver.
+
+	./tools/dpdk_nic_bind.py --bind=igb_uio 00:04.0 00:05.0
+
+5. Start testpmd, set it in mac forward mode
+	testpmd -c 0x0f-- -i --portmask=0x1 \
+	  --txqflags=0 --max-pkt-len=9000--port-topology=loop
+	testpmd> set fwd mac
+	testpmd> start
+
+Start packet forwarding in the ``testpmd`` application with the ``start``
+command. Then, make the Traffic Generator transmit to the target's port
+packets of lengths (CRC included) 1517, 1518, 8999, and 9000 respectively.
+Check that the same amount of frames and bytes are received back by the
+Traffic Generator from its port connected to the target's port.
+
+Note: 8259x family VF device jumbo frame setting only take effect when
+VF rx mode jumbo frame is enable. VF device jumbo frame size setting shared
+with PF device and testpmd parameter ``max-pkt-len`` has no effect.
+
+Functional Tests of Jumbo Frames
+================================
+
+Testing the support of Jumbo Frames in Poll Mode Drivers consists in
+configuring the maximum packet length with a value greater than 1518, and in
+sending to the test machine packets with the following lengths (CRC included):
+
+#. packet length = 1518 - 1
+
+#. packet length = 1518
+
+#. packet length = 1518 + 1
+
+#. packet length = maximum packet length - 1
+
+#. packet length = maximum packet length
+
+#. packet length = maximum packet length + 1
+
+
+Test Case: Normal frames with no jumbo frame support
+====================================================
+Check that packets of standard lengths are still received with setting
+max-pkt-len.
+
+Test Case: Normal frames with jumbo frame support
+=================================================
+Check that packets of standard lengths are still received when enabling the
+receipt of Jumbo Frames.
+
+Test Case: Jumbo frames with no jumbo frame support
+====================================================
+Check that with jumbo frame support, packet lengths greater than the standard
+maximum frame (1518) can not received.
+
+Test Case: Jumbo frames with jumbo frame support
+================================================
+Check that Jumbo Frames of lengths greater than the standard maximum frame
+(1518) and lower or equal to the maximum frame length can be received.
+
+Test Case: Jumbo frames over jumbo frame support
+================================================
+Check that packets larger than the configured maximum packet length are
+effectively dropped by the hardware.
-- 
1.9.3

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

* [dts] [PATCH v2 3/3] tests: add vf jumbo frame suite
  2016-02-05 16:01 [dts] [PATCH v2 1/3] conf vf_jumbo: add config file for vf jumboframe suite Yong Liu
  2016-02-05 16:01 ` [dts] [PATCH v2 2/3] test_plan: add vf jumbo frame test plan Yong Liu
@ 2016-02-05 16:01 ` Yong Liu
  1 sibling, 0 replies; 3+ messages in thread
From: Yong Liu @ 2016-02-05 16:01 UTC (permalink / raw)
  To: dts

This suite validated VF device jumbo frame feature, more detail
informations can be found in test plan.
By now jumbo frame suite support two virtual devices i40evf and ixgbevf.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/tests/TestSuite_vf_jumboframe.py b/tests/TestSuite_vf_jumboframe.py
new file mode 100644
index 0000000..05de2ce
--- /dev/null
+++ b/tests/TestSuite_vf_jumboframe.py
@@ -0,0 +1,330 @@
+# <COPYRIGHT_TAG>
+
+import re
+import time
+
+import dts
+from qemu_kvm import QEMUKvm
+from test_case import TestCase
+from pmd_output import PmdOutput
+from settings import HEADER_SIZE
+from packet import Packet
+from utils import RED
+
+VM_CORES_MASK = 'all'
+
+ETHER_STANDARD_MTU = 1518
+ETHER_JUMBO_FRAME_MTU = 9000
+
+
+class TestVfJumboFrame(TestCase):
+
+    def set_up_all(self):
+
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
+        self.vm0 = None
+        self.env_done = False
+
+        self.port = self.dut_ports[0]
+        self.vm_port = 0
+        cores = self.dut.get_core_list("1S/1C/1T")
+        self.port_mask = dts.create_mask([self.port])
+        
+        # enable tester mtu
+        tester_port = self.tester.get_local_port(self.port)
+        self.netobj = self.tester.ports_info[tester_port]['port']
+        self.netobj.enable_jumbo(framesize=ETHER_JUMBO_FRAME_MTU + 100)
+
+
+    def set_up(self):
+        self.setup_vm_env()
+
+    def bind_nic_driver(self, ports, driver=""):
+        # modprobe vfio driver
+        if driver == "vfio-pci":
+            for port in ports:
+                netdev = self.dut.ports_info[port]['port']
+                driver = netdev.get_nic_driver()
+                if driver != 'vfio-pci':
+                    netdev.bind_driver(driver='vfio-pci')
+
+        elif driver == "igb_uio":
+            # igb_uio should insmod as default, no need to check
+            for port in ports:
+                netdev = self.dut.ports_info[port]['port']
+                driver = netdev.get_nic_driver()
+                if driver != 'igb_uio':
+                    netdev.bind_driver(driver='igb_uio')
+        else:
+            for port in ports:
+                netdev = self.dut.ports_info[port]['port']
+                driver_now = netdev.get_nic_driver()
+                if driver == "":
+                    driver = netdev.default_driver
+                if driver != driver_now:
+                    netdev.bind_driver(driver=driver)
+
+    def setup_vm_env(self, driver='default'):
+        """
+        Create testing environment with 1VF generated from 1PF
+        """
+        if self.env_done:
+            return
+
+        # bind to default driver
+        self.bind_nic_driver(self.dut_ports[:1], driver="")
+
+        self.used_dut_port = self.dut_ports[0]
+        self.host_intf = self.dut.ports_info[self.used_dut_port]['intf']
+        tester_port = self.tester.get_local_port(self.used_dut_port)
+        self.tester_intf = self.tester.get_interface(tester_port)
+
+        self.dut.generate_sriov_vfs_by_port(
+            self.used_dut_port, 1, driver=driver)
+        self.sriov_vfs_port = self.dut.ports_info[
+            self.used_dut_port]['vfs_port']
+        self.vf_mac = "00:10:00:00:00:00"
+        self.dut.send_expect("ip link set %s vf 0 mac %s" %
+                             (self.host_intf, self.vf_mac), "# ")
+
+        try:
+
+            for port in self.sriov_vfs_port:
+                port.bind_driver('pci-stub')
+
+            time.sleep(1)
+            vf_popt = {'opt_host': self.sriov_vfs_port[0].pci}
+
+            # set up VM ENV
+            self.vm = QEMUKvm(self.dut, 'vm0', 'vf_jumboframe')
+            self.vm.set_vm_device(driver='pci-assign', **vf_popt)
+            self.vm_dut = self.vm.start()
+            if self.vm_dut is None:
+                raise Exception("Set up VM ENV failed!")
+
+            TESTPMD_MAIN = "app/test-pmd/testpmd.c"
+            if self.kdriver == "ixgbe":
+                self.vm_dut.send_expect("sed -i -e 's/.jumbo_frame    = .*$/.jumbo_frame = 1,/g' %s" % TESTPMD_MAIN, "# ")
+                self.vm_dut.build_install_dpdk(self.target)
+
+            self.vm_testpmd = PmdOutput(self.vm_dut)
+
+        except Exception as e:
+            self.destroy_vm_env()
+            raise Exception(e)
+
+        self.env_done = True
+
+    def destroy_vm_env(self):
+        if getattr(self, 'vm', None):
+            self.vm_dut.kill_all()
+            self.vm_testpmd = None
+            self.vm_dut_ports = None
+            # destroy vm0
+            self.vm.stop()
+            self.vm = None
+
+        if getattr(self, 'used_dut_port', None):
+            self.dut.destroy_sriov_vfs_by_port(self.used_dut_port)
+            self.used_dut_port = None
+
+        self.bind_nic_driver(self.dut_ports[:1], driver="igb_uio")
+
+        self.env_done = False
+
+
+    def jumboframes_get_stat(self, portid, rx_tx):
+        """
+        Get packets number from port statistic
+        """
+        stats = self.vm_testpmd.get_pmd_stats(portid)
+        if rx_tx == "rx":
+            return [stats['RX-packets'], stats['RX-errors'], stats['RX-bytes']]
+        elif rx_tx == "tx":
+            return [stats['TX-packets'], stats['TX-errors'], stats['TX-bytes']]
+        else:
+            return None
+
+    def jumboframes_send_packet(self, pktsize, received=True):
+        """
+        Send 1 packet to portid
+        """
+        tx_pkts_ori, _, tx_bytes_ori = [int(_) for _ in self.jumboframes_get_stat(self.vm_port, "tx")]
+        rx_pkts_ori, rx_err_ori, rx_bytes_ori = [int(_) for _ in self.jumboframes_get_stat(self.vm_port, "rx")]
+
+        mac = self.vm_dut.get_mac_address(self.vm_port)
+
+        pkt = Packet(pkt_type='UDP', pkt_len=pktsize)
+        pkt.config_layer('ether', {'dst': mac})
+        pkt.send_pkt(tx_port=self.tester_intf)
+
+        time.sleep(1)
+
+        tx_pkts, _, tx_bytes = [int(_) for _ in self.jumboframes_get_stat(self.port, "tx")]
+        rx_pkts, rx_err, rx_bytes = [int(_) for _ in self.jumboframes_get_stat(self.vm_port, "rx")]
+
+        tx_pkts -= tx_pkts_ori
+        tx_bytes -= tx_bytes_ori
+        rx_pkts -= rx_pkts_ori
+        rx_bytes -= rx_bytes_ori
+        rx_err -= rx_err_ori
+
+        if received:
+            self.verify((rx_pkts == 1) and (tx_pkts == 1), "Packet forward assert error")
+            if self.kdriver == "ixgbe":
+                self.verify((rx_bytes + 4) == pktsize, "Rx packet size should be packet size - 4")
+            else:
+                self.verify(rx_bytes == pktsize, "Tx packet size should be equal to packet size")
+            self.verify((tx_bytes + 4) == pktsize, "Tx packet size should be packet size - 4")
+        else:
+            self.verify(rx_err == 1 or tx_pkts == 0, "Packet drop assert error")
+
+    def test_vf_normal_nojumbo(self):
+        """
+        This case aims to test transmitting normal size packet without jumbo enable
+        """
+        # should enable jumbo on host
+        if self.kdriver == "ixgbe":
+            self.dutobj = self.dut.ports_info[self.port]['port']
+            self.dutobj.enable_jumbo(framesize=ETHER_STANDARD_MTU)
+            time.sleep(2)
+
+        self.vm_testpmd.start_testpmd("Default", "--max-pkt-len=%d --port-topology=loop --txqflags=0x0" % (ETHER_STANDARD_MTU))
+        if self.kdriver == "i40e":
+            # forville vf crc setting alias with host
+            self.vm_testpmd.execute_cmd("port stop all")
+            self.vm_testpmd.execute_cmd("port config all crc-strip on")
+            self.vm_testpmd.execute_cmd("port start all")
+
+        self.vm_testpmd.execute_cmd("set fwd mac")
+        self.vm_testpmd.execute_cmd("start")
+
+        self.jumboframes_send_packet(ETHER_STANDARD_MTU - 1)
+        self.jumboframes_send_packet(ETHER_STANDARD_MTU)
+
+        self.vm_testpmd.execute_cmd("stop")
+        self.vm_testpmd.quit()
+
+    def test_vf_normal_withjumbo(self):
+        """
+        When jumbo frame supported, this case is to verify that the normal size
+        packet forwrding should be support correct.
+        """
+        # should enable jumbo on host
+        if self.kdriver == "ixgbe":
+            self.dutobj = self.dut.ports_info[self.port]['port']
+            self.dutobj.enable_jumbo(framesize=ETHER_JUMBO_FRAME_MTU)
+            time.sleep(2)
+
+        self.vm_testpmd.start_testpmd("Default", "--max-pkt-len=%s --port-topology=loop --txqflags=0x0" % (ETHER_JUMBO_FRAME_MTU))
+        if self.kdriver == "i40e":
+            # forville vf crc setting alias with host
+            self.vm_testpmd.execute_cmd("port stop all")
+            self.vm_testpmd.execute_cmd("port config all crc-strip on")
+            self.vm_testpmd.execute_cmd("port start all")
+
+        self.vm_testpmd.execute_cmd("set fwd mac")
+        self.vm_testpmd.execute_cmd("start")
+
+        self.jumboframes_send_packet(ETHER_STANDARD_MTU - 1)
+        self.jumboframes_send_packet(ETHER_STANDARD_MTU)
+
+        self.vm_testpmd.execute_cmd("stop")
+        self.vm_testpmd.quit()
+
+    def test_vf_jumbo_nojumbo(self):
+        """
+        This case aims to test transmitting jumbo frame packet on testpmd without
+        jumbo frame support.
+        """
+        # should enable jumbo on host
+        if self.kdriver == "ixgbe":
+            self.dutobj = self.dut.ports_info[self.port]['port']
+            self.dutobj.enable_jumbo(framesize=ETHER_STANDARD_MTU)
+            time.sleep(2)
+
+        self.vm_testpmd.start_testpmd("Default", "--port-topology=loop --txqflags=0x0")
+        if self.kdriver == "i40e":
+            # forville vf crc setting alias with host
+            self.vm_testpmd.execute_cmd("port stop all")
+            self.vm_testpmd.execute_cmd("port config all crc-strip on")
+            self.vm_testpmd.execute_cmd("port start all")
+
+        self.vm_testpmd.execute_cmd("set fwd mac")
+        self.vm_testpmd.execute_cmd("start")
+
+        self.jumboframes_send_packet(ETHER_STANDARD_MTU + 1, False)
+
+        self.vm_testpmd.execute_cmd("stop")
+        self.vm_testpmd.quit()
+
+    def test_vf_jumbo_withjumbo(self):
+        """
+        When jumbo frame supported, this case is to verify that jumbo frame
+        packet can be forwarded correct.
+        """
+        # should enable jumbo on host
+        if self.kdriver == "ixgbe":
+            self.dutobj = self.dut.ports_info[self.port]['port']
+            self.dutobj.enable_jumbo(framesize=ETHER_JUMBO_FRAME_MTU)
+            time.sleep(2)
+
+        self.vm_testpmd.start_testpmd("Default", "--max-pkt-len=%s --port-topology=loop --txqflags=0x0" % (ETHER_JUMBO_FRAME_MTU))
+        if self.kdriver == "i40e":
+            # forville vf crc setting alias with host
+            self.vm_testpmd.execute_cmd("port stop all")
+            self.vm_testpmd.execute_cmd("port config all crc-strip on")
+            self.vm_testpmd.execute_cmd("port start all")
+
+        self.vm_testpmd.execute_cmd("set fwd mac")
+        self.vm_testpmd.execute_cmd("start")
+
+        self.jumboframes_send_packet(ETHER_STANDARD_MTU + 1)
+        self.jumboframes_send_packet(ETHER_JUMBO_FRAME_MTU - 1)
+        self.jumboframes_send_packet(ETHER_JUMBO_FRAME_MTU)
+
+        self.vm_testpmd.execute_cmd("stop")
+        self.vm_testpmd.quit()
+
+    def test_vf_jumbo_overjumbo(self):
+        """
+        When the jubmo frame MTU set as 9000, this case is to verify that the
+        packet which the length bigger than MTU can not be forwarded.
+        """
+        # should enable jumbo on host
+        if self.kdriver == "ixgbe":
+            self.dutobj = self.dut.ports_info[self.port]['port']
+            self.dutobj.enable_jumbo(framesize=ETHER_JUMBO_FRAME_MTU)
+            time.sleep(2)
+
+        self.vm_testpmd.start_testpmd("Default", "--max-pkt-len=%s --port-topology=loop --txqflags=0x0" % (ETHER_JUMBO_FRAME_MTU))
+        if self.kdriver == "i40e":
+            # forville vf crc setting alias with host
+            self.vm_testpmd.execute_cmd("port stop all")
+            self.vm_testpmd.execute_cmd("port config all crc-strip on")
+            self.vm_testpmd.execute_cmd("port start all")
+
+        self.vm_testpmd.execute_cmd("set fwd mac")
+        self.vm_testpmd.execute_cmd("start")
+
+        self.jumboframes_send_packet(ETHER_JUMBO_FRAME_MTU + 1, False)
+
+        self.vm_testpmd.execute_cmd("stop")
+        self.vm_testpmd.quit()
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.vm_dut.kill_all()
+        pass
+
+    def tear_down_all(self):
+        """
+        When the case of this test suite finished, the enviroment should
+        clear up.
+        """
+        self.destroy_vm_env()
+        self.netobj.enable_jumbo(framesize=ETHER_STANDARD_MTU)
+
-- 
1.9.3

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

end of thread, other threads:[~2016-02-05 16:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-05 16:01 [dts] [PATCH v2 1/3] conf vf_jumbo: add config file for vf jumboframe suite Yong Liu
2016-02-05 16:01 ` [dts] [PATCH v2 2/3] test_plan: add vf jumbo frame test plan Yong Liu
2016-02-05 16:01 ` [dts] [PATCH v2 3/3] tests: add vf jumbo frame suite Yong Liu

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).