* [dts] [PATCH v3 1/4] conf vf_jumbo: add config file for vf jumboframe suite @ 2016-02-11 3:39 Yong Liu 2016-02-11 3:39 ` [dts] [PATCH v3 2/4] test_plan: add vf jumbo frame test plan Yong Liu ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: Yong Liu @ 2016-02-11 3:39 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] 12+ messages in thread
* [dts] [PATCH v3 2/4] test_plan: add vf jumbo frame test plan 2016-02-11 3:39 [dts] [PATCH v3 1/4] conf vf_jumbo: add config file for vf jumboframe suite Yong Liu @ 2016-02-11 3:39 ` Yong Liu 2016-02-11 3:39 ` [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module Yong Liu 2016-02-11 3:39 ` [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite Yong Liu 2 siblings, 0 replies; 12+ messages in thread From: Yong Liu @ 2016-02-11 3:39 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) <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. + + + +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] 12+ messages in thread
* [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module 2016-02-11 3:39 [dts] [PATCH v3 1/4] conf vf_jumbo: add config file for vf jumboframe suite Yong Liu 2016-02-11 3:39 ` [dts] [PATCH v3 2/4] test_plan: add vf jumbo frame test plan Yong Liu @ 2016-02-11 3:39 ` Yong Liu 2016-02-15 1:57 ` Xu, HuilongX 2016-02-11 3:39 ` [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite Yong Liu 2 siblings, 1 reply; 12+ messages in thread From: Yong Liu @ 2016-02-11 3:39 UTC (permalink / raw) To: dts Signed-off-by: Marvin Liu <yong.liu@intel.com> diff --git a/nics/net_device.py b/nics/net_device.py index 9d9e1ac..73750f5 100644 --- a/nics/net_device.py +++ b/nics/net_device.py @@ -38,10 +38,13 @@ import time import settings from crb import Crb -from settings import TIMEOUT +from settings import TIMEOUT, HEADER_SIZE +from utils import RED NICS_LIST = [] # global list for save nic objects +MIN_MTU = 68 + class NetDevice(object): @@ -770,7 +773,22 @@ class NetDevice(object): """ nic_pci_num = ':'.join(['0000', bus_id, devfun_id]) cmd = "echo %s > /sys/bus/pci/devices/0000\:%s\:%s/driver/unbind" - self.send_expect(cmd % (nic_pci_num, bus_id, devfun_id), "# ") + self.__send_expect(cmd % (nic_pci_num, bus_id, devfun_id), "# ") + + def _cal_mtu(self, framesize): + return framesize - HEADER_SIZE['eth'] + + def enable_jumbo(self, framesize=0): + if self.intf_name == "N/A": + print RED("Enable jumbo must based on kernel interface!!!") + return + if framesize < MIN_MTU: + print RED("Enable jumbo must over %d !!!" % MIN_MTU) + return + + mtu = self._cal_mtu(framesize) + cmd = "ifconfig %s mtu %d" + self.__send_expect(cmd % (self.intf_name, mtu), "# ") def get_pci_id(crb, bus_id, devfun_id): -- 1.9.3 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module 2016-02-11 3:39 ` [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module Yong Liu @ 2016-02-15 1:57 ` Xu, HuilongX 2016-02-15 2:30 ` Liu, Yong 0 siblings, 1 reply; 12+ messages in thread From: Xu, HuilongX @ 2016-02-15 1:57 UTC (permalink / raw) To: Liu, Yong, dts Hi yong, Some comments as below? > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu > Sent: Thursday, February 11, 2016 11:39 AM > To: dts@dpdk.org > Subject: [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device > module > > Signed-off-by: Marvin Liu <yong.liu@intel.com> > > diff --git a/nics/net_device.py b/nics/net_device.py > index 9d9e1ac..73750f5 100644 > --- a/nics/net_device.py > +++ b/nics/net_device.py > @@ -38,10 +38,13 @@ import time > > import settings > from crb import Crb > -from settings import TIMEOUT > +from settings import TIMEOUT, HEADER_SIZE > +from utils import RED > > NICS_LIST = [] # global list for save nic objects > All NIC min MTU is 68, maybe 1G and 10G NIC is 64? > +MIN_MTU = 68 > + > > class NetDevice(object): > > @@ -770,7 +773,22 @@ class NetDevice(object): > """ > nic_pci_num = ':'.join(['0000', bus_id, devfun_id]) > cmd = "echo %s > /sys/bus/pci/devices/0000\:%s\:%s/driver/unbind" > - self.send_expect(cmd % (nic_pci_num, bus_id, devfun_id), "# ") > + self.__send_expect(cmd % (nic_pci_num, bus_id, devfun_id), "# ") > + > + def _cal_mtu(self, framesize): > + return framesize - HEADER_SIZE['eth'] > + > + def enable_jumbo(self, framesize=0): > + if self.intf_name == "N/A": > + print RED("Enable jumbo must based on kernel interface!!!") > + return > + if framesize < MIN_MTU: > + print RED("Enable jumbo must over %d !!!" % MIN_MTU) > + return > + > + mtu = self._cal_mtu(framesize) > + cmd = "ifconfig %s mtu %d" > + self.__send_expect(cmd % (self.intf_name, mtu), "# ") > > > def get_pci_id(crb, bus_id, devfun_id): > -- > 1.9.3 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module 2016-02-15 1:57 ` Xu, HuilongX @ 2016-02-15 2:30 ` Liu, Yong 0 siblings, 0 replies; 12+ messages in thread From: Liu, Yong @ 2016-02-15 2:30 UTC (permalink / raw) To: Xu, HuilongX, dts Huilong, MTU is not equal to Ethernet packet size, minimum MTU should be 60 + 8 byte (min fragment size). More details please reference to https://tools.ietf.org/html/rfc791. > -----Original Message----- > From: Xu, HuilongX > Sent: Monday, February 15, 2016 9:58 AM > To: Liu, Yong; dts@dpdk.org > Subject: RE: [dts] [PATCH v3 3/4] nics: support jumbo setting in > net_device module > > Hi yong, > Some comments as below? > > > -----Original Message----- > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu > > Sent: Thursday, February 11, 2016 11:39 AM > > To: dts@dpdk.org > > Subject: [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device > > module > > > > Signed-off-by: Marvin Liu <yong.liu@intel.com> > > > > diff --git a/nics/net_device.py b/nics/net_device.py > > index 9d9e1ac..73750f5 100644 > > --- a/nics/net_device.py > > +++ b/nics/net_device.py > > @@ -38,10 +38,13 @@ import time > > > > import settings > > from crb import Crb > > -from settings import TIMEOUT > > +from settings import TIMEOUT, HEADER_SIZE > > +from utils import RED > > > > NICS_LIST = [] # global list for save nic objects > > > All NIC min MTU is 68, maybe 1G and 10G NIC is 64? > > +MIN_MTU = 68 > > + > > > > class NetDevice(object): > > > > @@ -770,7 +773,22 @@ class NetDevice(object): > > """ > > nic_pci_num = ':'.join(['0000', bus_id, devfun_id]) > > cmd = "echo %s > > /sys/bus/pci/devices/0000\:%s\:%s/driver/unbind" > > - self.send_expect(cmd % (nic_pci_num, bus_id, devfun_id), "# ") > > + self.__send_expect(cmd % (nic_pci_num, bus_id, devfun_id), "# ") > > + > > + def _cal_mtu(self, framesize): > > + return framesize - HEADER_SIZE['eth'] > > + > > + def enable_jumbo(self, framesize=0): > > + if self.intf_name == "N/A": > > + print RED("Enable jumbo must based on kernel interface!!!") > > + return > > + if framesize < MIN_MTU: > > + print RED("Enable jumbo must over %d !!!" % MIN_MTU) > > + return > > + > > + mtu = self._cal_mtu(framesize) > > + cmd = "ifconfig %s mtu %d" > > + self.__send_expect(cmd % (self.intf_name, mtu), "# ") > > > > > > def get_pci_id(crb, bus_id, devfun_id): > > -- > > 1.9.3 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite 2016-02-11 3:39 [dts] [PATCH v3 1/4] conf vf_jumbo: add config file for vf jumboframe suite Yong Liu 2016-02-11 3:39 ` [dts] [PATCH v3 2/4] test_plan: add vf jumbo frame test plan Yong Liu 2016-02-11 3:39 ` [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module Yong Liu @ 2016-02-11 3:39 ` Yong Liu 2016-02-15 2:20 ` Xu, HuilongX 2 siblings, 1 reply; 12+ messages in thread From: Yong Liu @ 2016-02-11 3:39 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] 12+ messages in thread
* Re: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite 2016-02-11 3:39 ` [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite Yong Liu @ 2016-02-15 2:20 ` Xu, HuilongX 2016-02-15 2:34 ` Liu, Yong 0 siblings, 1 reply; 12+ messages in thread From: Xu, HuilongX @ 2016-02-15 2:20 UTC (permalink / raw) To: Liu, Yong, dts Hi yong, Some simple comments as below. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu > Sent: Thursday, February 11, 2016 11:39 AM > To: dts@dpdk.org > Subject: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > 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" When driver is dpdk, Host Nic can't used this command set VF mac. > + 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'] I think in this case, host NIC MTU need bigger ETHER_JUMBO_FRAME_MTU, because when we send a bigger ETHER_JUMBO_FRAME_MTU packet to VF, if PF MTU not large enough, PF will loss. > + 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] 12+ messages in thread
* Re: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite 2016-02-15 2:20 ` Xu, HuilongX @ 2016-02-15 2:34 ` Liu, Yong 2016-02-15 3:16 ` Xu, HuilongX 0 siblings, 1 reply; 12+ messages in thread From: Liu, Yong @ 2016-02-15 2:34 UTC (permalink / raw) To: Xu, HuilongX, dts Explain that this case is based on kernel based PF + dpdk based VF. All VF function cases will based on kernel PF by now. > -----Original Message----- > From: Xu, HuilongX > Sent: Monday, February 15, 2016 10:20 AM > To: Liu, Yong; dts@dpdk.org > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > Hi yong, > Some simple comments as below. > > -----Original Message----- > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu > > Sent: Thursday, February 11, 2016 11:39 AM > > To: dts@dpdk.org > > Subject: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > 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" > When driver is dpdk, Host Nic can't used this command set VF mac. All VF cases focus on kernel based PF, so we can assume this can work on VF jumbo frame case. > > + 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'] > I think in this case, host NIC MTU need bigger ETHER_JUMBO_FRAME_MTU, > because when we send a bigger ETHER_JUMBO_FRAME_MTU packet to VF, if PF > MTU not large enough, > PF will loss. > > + 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] 12+ messages in thread
* Re: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite 2016-02-15 2:34 ` Liu, Yong @ 2016-02-15 3:16 ` Xu, HuilongX 2016-02-15 5:52 ` Liu, Yong 0 siblings, 1 reply; 12+ messages in thread From: Xu, HuilongX @ 2016-02-15 3:16 UTC (permalink / raw) To: Liu, Yong, dts Hi yong, I have a comments in case test_vf_jumbo_overjumbo, could you config? Thanks a lot > -----Original Message----- > From: Liu, Yong > Sent: Monday, February 15, 2016 10:34 AM > To: Xu, HuilongX; dts@dpdk.org > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > Explain that this case is based on kernel based PF + dpdk based VF. All VF > function cases will based on kernel PF by now. > > > -----Original Message----- > > From: Xu, HuilongX > > Sent: Monday, February 15, 2016 10:20 AM > > To: Liu, Yong; dts@dpdk.org > > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > Hi yong, > > Some simple comments as below. > > > -----Original Message----- > > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu > > > Sent: Thursday, February 11, 2016 11:39 AM > > > To: dts@dpdk.org > > > Subject: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > > > 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" > > When driver is dpdk, Host Nic can't used this command set VF mac. > > All VF cases focus on kernel based PF, so we can assume this can work on > VF jumbo frame case. > > > > + 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'] > > I think in this case, host NIC MTU need bigger ETHER_JUMBO_FRAME_MTU, > > because when we send a bigger ETHER_JUMBO_FRAME_MTU packet to VF, if PF > > MTU not large enough, > > PF will loss. > > > + 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] 12+ messages in thread
* Re: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite 2016-02-15 3:16 ` Xu, HuilongX @ 2016-02-15 5:52 ` Liu, Yong 2016-02-15 6:39 ` Xu, HuilongX 0 siblings, 1 reply; 12+ messages in thread From: Liu, Yong @ 2016-02-15 5:52 UTC (permalink / raw) To: Xu, HuilongX, dts Huilong, For 82599EB nic, VF and PF max packet frame size setting should be the same. Change PF mtu should also have effect on VF devices. More details can be found ixgbe PF driver function "ixgbe_set_vf_lpe". > -----Original Message----- > From: Xu, HuilongX > Sent: Monday, February 15, 2016 11:17 AM > To: Liu, Yong; dts@dpdk.org > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > Hi yong, > I have a comments in case test_vf_jumbo_overjumbo, could you config? > Thanks a lot > > > -----Original Message----- > > From: Liu, Yong > > Sent: Monday, February 15, 2016 10:34 AM > > To: Xu, HuilongX; dts@dpdk.org > > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > Explain that this case is based on kernel based PF + dpdk based VF. All > VF > > function cases will based on kernel PF by now. > > > > > -----Original Message----- > > > From: Xu, HuilongX > > > Sent: Monday, February 15, 2016 10:20 AM > > > To: Liu, Yong; dts@dpdk.org > > > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > > > Hi yong, > > > Some simple comments as below. > > > > -----Original Message----- > > > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu > > > > Sent: Thursday, February 11, 2016 11:39 AM > > > > To: dts@dpdk.org > > > > Subject: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > > > > > 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" > > > When driver is dpdk, Host Nic can't used this command set VF mac. > > > > All VF cases focus on kernel based PF, so we can assume this can work on > > VF jumbo frame case. > > > > > > + 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'] > > > I think in this case, host NIC MTU need bigger ETHER_JUMBO_FRAME_MTU, > > > because when we send a bigger ETHER_JUMBO_FRAME_MTU packet to VF, if > PF > > > MTU not large enough, > > > PF will loss. > > > > + > 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] 12+ messages in thread
* Re: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite 2016-02-15 5:52 ` Liu, Yong @ 2016-02-15 6:39 ` Xu, HuilongX 2016-02-15 7:05 ` Liu, Yong 0 siblings, 1 reply; 12+ messages in thread From: Xu, HuilongX @ 2016-02-15 6:39 UTC (permalink / raw) To: Liu, Yong, dts Hi yong, I check dpdk code, you are right, dpdk PF and VF driver used a same register for config mtu on 82599 Nic. For your patch, I not have any comments But I have a new issue, When I set different mtu on PF and vf, which value will valid, the last one? i will test it when I free. Thanks a lot > -----Original Message----- > From: Liu, Yong > Sent: Monday, February 15, 2016 1:53 PM > To: Xu, HuilongX; dts@dpdk.org > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > Huilong, > For 82599EB nic, VF and PF max packet frame size setting should be the > same. Change PF mtu should also have effect on VF devices. > More details can be found ixgbe PF driver function "ixgbe_set_vf_lpe". > > > -----Original Message----- > > From: Xu, HuilongX > > Sent: Monday, February 15, 2016 11:17 AM > > To: Liu, Yong; dts@dpdk.org > > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > Hi yong, > > I have a comments in case test_vf_jumbo_overjumbo, could you config? > > Thanks a lot > > > > > -----Original Message----- > > > From: Liu, Yong > > > Sent: Monday, February 15, 2016 10:34 AM > > > To: Xu, HuilongX; dts@dpdk.org > > > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > > > Explain that this case is based on kernel based PF + dpdk based VF. > All > > VF > > > function cases will based on kernel PF by now. > > > > > > > -----Original Message----- > > > > From: Xu, HuilongX > > > > Sent: Monday, February 15, 2016 10:20 AM > > > > To: Liu, Yong; dts@dpdk.org > > > > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > > > > > Hi yong, > > > > Some simple comments as below. > > > > > -----Original Message----- > > > > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu > > > > > Sent: Thursday, February 11, 2016 11:39 AM > > > > > To: dts@dpdk.org > > > > > Subject: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > > > > > > > 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" > > > > When driver is dpdk, Host Nic can't used this command set VF mac. > > > > > > All VF cases focus on kernel based PF, so we can assume this can work > on > > > VF jumbo frame case. > > > > > > > > + 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'] > > > > I think in this case, host NIC MTU need bigger ETHER_JUMBO_FRAME_MTU, > > > > because when we send a bigger ETHER_JUMBO_FRAME_MTU packet to VF, if > > PF > > > > MTU not large enough, > > > > PF will loss. > > > > > + > > 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] 12+ messages in thread
* Re: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite 2016-02-15 6:39 ` Xu, HuilongX @ 2016-02-15 7:05 ` Liu, Yong 0 siblings, 0 replies; 12+ messages in thread From: Liu, Yong @ 2016-02-15 7:05 UTC (permalink / raw) To: Xu, HuilongX, dts As comments in driver, PF and VF share same jumbo frame size. When VF jumbo size over PF jumbo frame size, will update the value. If VF jumbo size smaller than PF, nothing will be changed. > -----Original Message----- > From: Xu, HuilongX > Sent: Monday, February 15, 2016 2:39 PM > To: Liu, Yong; dts@dpdk.org > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > Hi yong, > I check dpdk code, you are right, dpdk PF and VF driver used a same > register for config mtu on 82599 Nic. For your patch, I not have any > comments > > But I have a new issue, > When I set different mtu on PF and vf, which value will valid, the last > one? i will test it when I free. > > Thanks a lot > > -----Original Message----- > > From: Liu, Yong > > Sent: Monday, February 15, 2016 1:53 PM > > To: Xu, HuilongX; dts@dpdk.org > > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > Huilong, > > For 82599EB nic, VF and PF max packet frame size setting should be the > > same. Change PF mtu should also have effect on VF devices. > > More details can be found ixgbe PF driver function "ixgbe_set_vf_lpe". > > > > > -----Original Message----- > > > From: Xu, HuilongX > > > Sent: Monday, February 15, 2016 11:17 AM > > > To: Liu, Yong; dts@dpdk.org > > > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > > > Hi yong, > > > I have a comments in case test_vf_jumbo_overjumbo, could you config? > > > Thanks a lot > > > > > > > -----Original Message----- > > > > From: Liu, Yong > > > > Sent: Monday, February 15, 2016 10:34 AM > > > > To: Xu, HuilongX; dts@dpdk.org > > > > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > > > > > Explain that this case is based on kernel based PF + dpdk based VF. > > All > > > VF > > > > function cases will based on kernel PF by now. > > > > > > > > > -----Original Message----- > > > > > From: Xu, HuilongX > > > > > Sent: Monday, February 15, 2016 10:20 AM > > > > > To: Liu, Yong; dts@dpdk.org > > > > > Subject: RE: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > > > > > > > Hi yong, > > > > > Some simple comments as below. > > > > > > -----Original Message----- > > > > > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yong Liu > > > > > > Sent: Thursday, February 11, 2016 11:39 AM > > > > > > To: dts@dpdk.org > > > > > > Subject: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite > > > > > > > > > > > > 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" > > > > > When driver is dpdk, Host Nic can't used this command set VF mac. > > > > > > > > All VF cases focus on kernel based PF, so we can assume this can > work > > on > > > > VF jumbo frame case. > > > > > > > > > > + 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'] > > > > > I think in this case, host NIC MTU need bigger > ETHER_JUMBO_FRAME_MTU, > > > > > because when we send a bigger ETHER_JUMBO_FRAME_MTU packet to VF, > if > > > PF > > > > > MTU not large enough, > > > > > PF will loss. > > > > > > + > > > 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] 12+ messages in thread
end of thread, other threads:[~2016-02-15 7:05 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-02-11 3:39 [dts] [PATCH v3 1/4] conf vf_jumbo: add config file for vf jumboframe suite Yong Liu 2016-02-11 3:39 ` [dts] [PATCH v3 2/4] test_plan: add vf jumbo frame test plan Yong Liu 2016-02-11 3:39 ` [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module Yong Liu 2016-02-15 1:57 ` Xu, HuilongX 2016-02-15 2:30 ` Liu, Yong 2016-02-11 3:39 ` [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite Yong Liu 2016-02-15 2:20 ` Xu, HuilongX 2016-02-15 2:34 ` Liu, Yong 2016-02-15 3:16 ` Xu, HuilongX 2016-02-15 5:52 ` Liu, Yong 2016-02-15 6:39 ` Xu, HuilongX 2016-02-15 7:05 ` Liu, Yong
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).