From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 77F485938 for ; Mon, 15 Feb 2016 03:20:05 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP; 14 Feb 2016 18:20:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,448,1449561600"; d="scan'208";a="912411000" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 14 Feb 2016 18:20:04 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 14 Feb 2016 18:20:03 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.249]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.209]) with mapi id 14.03.0248.002; Mon, 15 Feb 2016 10:20:01 +0800 From: "Xu, HuilongX" To: "Liu, Yong" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite Thread-Index: AQHRZH3mpR33NrYgG0yyWEuZ3xxNWZ8sYJ7w Date: Mon, 15 Feb 2016 02:20:00 +0000 Message-ID: References: <1455161950-21059-1-git-send-email-yong.liu@intel.com> <1455161950-21059-4-git-send-email-yong.liu@intel.com> In-Reply-To: <1455161950-21059-4-git-send-email-yong.liu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-cr-hashedpuzzle: A60l BIw4 BJHb Bftg CNVr EGzo EP5I EaSE FN4f Fv9n HDnP HJs9 IGfQ JB5f J08p Kjx8; 1; ZAB0AHMAQABkAHAAZABrAC4AbwByAGcA; Sosha1_v1; 7; {9A5FD923-265E-45CA-A9E2-B93CE1AFE853}; aAB1AGkAbABvAG4AZwB4AC4AeAB1AEAAaQBuAHQAZQBsAC4AYwBvAG0A; Mon, 15 Feb 2016 02:19:59 GMT; UgBFADoAIABbAGQAdABzAF0AIABbAFAAQQBUAEMASAAgAHYAMwAgADQALwA0AF0AIAB0AGUAcwB0AHMAOgAgAGEAZABkACAAdgBmACAAagB1AG0AYgBvACAAZgByAGEAbQBlACAAcwB1AGkAdABlAA== x-cr-puzzleid: {9A5FD923-265E-45CA-A9E2-B93CE1AFE853} x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2016 02:20:06 -0000 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 >=20 > 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. >=20 > Signed-off-by: Marvin Liu >=20 > 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 @@ > +# > + > +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 =3D 'all' > + > +ETHER_STANDARD_MTU =3D 1518 > +ETHER_JUMBO_FRAME_MTU =3D 9000 > + > + > +class TestVfJumboFrame(TestCase): > + > + def set_up_all(self): > + > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > + self.vm0 =3D None > + self.env_done =3D False > + > + self.port =3D self.dut_ports[0] > + self.vm_port =3D 0 > + cores =3D self.dut.get_core_list("1S/1C/1T") > + self.port_mask =3D dts.create_mask([self.port]) > + > + # enable tester mtu > + tester_port =3D self.tester.get_local_port(self.port) > + self.netobj =3D self.tester.ports_info[tester_port]['port'] > + self.netobj.enable_jumbo(framesize=3DETHER_JUMBO_FRAME_MTU + 100= ) > + > + > + def set_up(self): > + self.setup_vm_env() > + > + def bind_nic_driver(self, ports, driver=3D""): > + # modprobe vfio driver > + if driver =3D=3D "vfio-pci": > + for port in ports: > + netdev =3D self.dut.ports_info[port]['port'] > + driver =3D netdev.get_nic_driver() > + if driver !=3D 'vfio-pci': > + netdev.bind_driver(driver=3D'vfio-pci') > + > + elif driver =3D=3D "igb_uio": > + # igb_uio should insmod as default, no need to check > + for port in ports: > + netdev =3D self.dut.ports_info[port]['port'] > + driver =3D netdev.get_nic_driver() > + if driver !=3D 'igb_uio': > + netdev.bind_driver(driver=3D'igb_uio') > + else: > + for port in ports: > + netdev =3D self.dut.ports_info[port]['port'] > + driver_now =3D netdev.get_nic_driver() > + if driver =3D=3D "": > + driver =3D netdev.default_driver > + if driver !=3D driver_now: > + netdev.bind_driver(driver=3Ddriver) > + > + def setup_vm_env(self, driver=3D'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=3D"") > + > + self.used_dut_port =3D self.dut_ports[0] > + self.host_intf =3D self.dut.ports_info[self.used_dut_port]['intf= '] > + tester_port =3D self.tester.get_local_port(self.used_dut_port) > + self.tester_intf =3D self.tester.get_interface(tester_port) > + > + self.dut.generate_sriov_vfs_by_port( > + self.used_dut_port, 1, driver=3Ddriver) > + self.sriov_vfs_port =3D self.dut.ports_info[ > + self.used_dut_port]['vfs_port'] > + self.vf_mac =3D "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 =3D {'opt_host': self.sriov_vfs_port[0].pci} > + > + # set up VM ENV > + self.vm =3D QEMUKvm(self.dut, 'vm0', 'vf_jumboframe') > + self.vm.set_vm_device(driver=3D'pci-assign', **vf_popt) > + self.vm_dut =3D self.vm.start() > + if self.vm_dut is None: > + raise Exception("Set up VM ENV failed!") > + > + TESTPMD_MAIN =3D "app/test-pmd/testpmd.c" > + if self.kdriver =3D=3D "ixgbe": > + self.vm_dut.send_expect("sed -i -e 's/.jumbo_frame > =3D .*$/.jumbo_frame =3D 1,/g' %s" % TESTPMD_MAIN, "# ") > + self.vm_dut.build_install_dpdk(self.target) > + > + self.vm_testpmd =3D PmdOutput(self.vm_dut) > + > + except Exception as e: > + self.destroy_vm_env() > + raise Exception(e) > + > + self.env_done =3D True > + > + def destroy_vm_env(self): > + if getattr(self, 'vm', None): > + self.vm_dut.kill_all() > + self.vm_testpmd =3D None > + self.vm_dut_ports =3D None > + # destroy vm0 > + self.vm.stop() > + self.vm =3D None > + > + if getattr(self, 'used_dut_port', None): > + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port) > + self.used_dut_port =3D None > + > + self.bind_nic_driver(self.dut_ports[:1], driver=3D"igb_uio") > + > + self.env_done =3D False > + > + > + def jumboframes_get_stat(self, portid, rx_tx): > + """ > + Get packets number from port statistic > + """ > + stats =3D self.vm_testpmd.get_pmd_stats(portid) > + if rx_tx =3D=3D "rx": > + return [stats['RX-packets'], stats['RX-errors'], stats['RX- > bytes']] > + elif rx_tx =3D=3D "tx": > + return [stats['TX-packets'], stats['TX-errors'], stats['TX- > bytes']] > + else: > + return None > + > + def jumboframes_send_packet(self, pktsize, received=3DTrue): > + """ > + Send 1 packet to portid > + """ > + tx_pkts_ori, _, tx_bytes_ori =3D [int(_) for _ in > self.jumboframes_get_stat(self.vm_port, "tx")] > + rx_pkts_ori, rx_err_ori, rx_bytes_ori =3D [int(_) for _ in > self.jumboframes_get_stat(self.vm_port, "rx")] > + > + mac =3D self.vm_dut.get_mac_address(self.vm_port) > + > + pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dpktsize) > + pkt.config_layer('ether', {'dst': mac}) > + pkt.send_pkt(tx_port=3Dself.tester_intf) > + > + time.sleep(1) > + > + tx_pkts, _, tx_bytes =3D [int(_) for _ in > self.jumboframes_get_stat(self.port, "tx")] > + rx_pkts, rx_err, rx_bytes =3D [int(_) for _ in > self.jumboframes_get_stat(self.vm_port, "rx")] > + > + tx_pkts -=3D tx_pkts_ori > + tx_bytes -=3D tx_bytes_ori > + rx_pkts -=3D rx_pkts_ori > + rx_bytes -=3D rx_bytes_ori > + rx_err -=3D rx_err_ori > + > + if received: > + self.verify((rx_pkts =3D=3D 1) and (tx_pkts =3D=3D 1), "Pack= et > forward assert error") > + if self.kdriver =3D=3D "ixgbe": > + self.verify((rx_bytes + 4) =3D=3D pktsize, "Rx packet si= ze > should be packet size - 4") > + else: > + self.verify(rx_bytes =3D=3D pktsize, "Tx packet size sho= uld > be equal to packet size") > + self.verify((tx_bytes + 4) =3D=3D pktsize, "Tx packet size s= hould > be packet size - 4") > + else: > + self.verify(rx_err =3D=3D 1 or tx_pkts =3D=3D 0, "Packet dro= p 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 =3D=3D "ixgbe": > + self.dutobj =3D self.dut.ports_info[self.port]['port'] > + self.dutobj.enable_jumbo(framesize=3DETHER_STANDARD_MTU) > + time.sleep(2) > + > + self.vm_testpmd.start_testpmd("Default", "--max-pkt-len=3D%d -- > port-topology=3Dloop --txqflags=3D0x0" % (ETHER_STANDARD_MTU)) > + if self.kdriver =3D=3D "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 =3D=3D "ixgbe": > + self.dutobj =3D self.dut.ports_info[self.port]['port'] > + self.dutobj.enable_jumbo(framesize=3DETHER_JUMBO_FRAME_MTU) > + time.sleep(2) > + > + self.vm_testpmd.start_testpmd("Default", "--max-pkt-len=3D%s -- > port-topology=3Dloop --txqflags=3D0x0" % (ETHER_JUMBO_FRAME_MTU)) > + if self.kdriver =3D=3D "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 testpm= d > without > + jumbo frame support. > + """ > + # should enable jumbo on host > + if self.kdriver =3D=3D "ixgbe": > + self.dutobj =3D self.dut.ports_info[self.port]['port'] > + self.dutobj.enable_jumbo(framesize=3DETHER_STANDARD_MTU) > + time.sleep(2) > + > + self.vm_testpmd.start_testpmd("Default", "--port-topology=3Dloop= -- > txqflags=3D0x0") > + if self.kdriver =3D=3D "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 =3D=3D "ixgbe": > + self.dutobj =3D self.dut.ports_info[self.port]['port'] > + self.dutobj.enable_jumbo(framesize=3DETHER_JUMBO_FRAME_MTU) > + time.sleep(2) > + > + self.vm_testpmd.start_testpmd("Default", "--max-pkt-len=3D%s -- > port-topology=3Dloop --txqflags=3D0x0" % (ETHER_JUMBO_FRAME_MTU)) > + if self.kdriver =3D=3D "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 tha= t > the > + packet which the length bigger than MTU can not be forwarded. > + """ > + # should enable jumbo on host > + if self.kdriver =3D=3D "ixgbe": > + self.dutobj =3D self.dut.ports_info[self.port]['port'] I think in this case, host NIC MTU need bigger ETHER_JUMBO_FRAME_MTU, becau= se when we send a bigger ETHER_JUMBO_FRAME_MTU packet to VF, if PF MTU not = large enough, PF will loss.=20 > + self.dutobj.enable_jumbo(framesize=3DETHER_JUMBO_FRAME_MTU) > + time.sleep(2) > + > + self.vm_testpmd.start_testpmd("Default", "--max-pkt-len=3D%s -- > port-topology=3Dloop --txqflags=3D0x0" % (ETHER_JUMBO_FRAME_MTU)) > + if self.kdriver =3D=3D "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=3DETHER_STANDARD_MTU) > + > -- > 1.9.3