From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 65A167E6A for ; Mon, 15 Feb 2016 03:34:20 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 14 Feb 2016 18:34:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,448,1449561600"; d="scan'208";a="47818223" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga004.fm.intel.com with ESMTP; 14 Feb 2016 18:34:20 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 14 Feb 2016 18:34:19 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 14 Feb 2016 18:34:18 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.218]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.196]) with mapi id 14.03.0248.002; Mon, 15 Feb 2016 10:34:16 +0800 From: "Liu, Yong" To: "Xu, HuilongX" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite Thread-Index: AQHRZ5dfagLCbtx4bUCUDVo88vwP4p8sYrIw Date: Mon, 15 Feb 2016 02:34:16 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E144E1C91@SHSMSX103.ccr.corp.intel.com> References: <1455161950-21059-1-git-send-email-yong.liu@intel.com> <1455161950-21059-4-git-send-email-yong.liu@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDE2MjJiNmYtMzQyNi00YmMwLTlmZWYtZmIxZDg2NzAxMzY2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjQuMTAuMTkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiY1lvY0ZCK0FGbktIQmxKb3UyT2NKNVhsQUJOTUtQQUVINXFrR1dLZzdyND0ifQ== x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH 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:34:21 -0000 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 >=20 > 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 > > > > 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 + 1= 00) > > + > > + > > + 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]['in= tf'] > > + 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. 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 =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), "Pa= cket > > forward assert error") > > + if self.kdriver =3D=3D "ixgbe": > > + self.verify((rx_bytes + 4) =3D=3D pktsize, "Rx packet = size > > should be packet size - 4") > > + else: > > + self.verify(rx_bytes =3D=3D pktsize, "Tx packet size s= hould > > be equal to packet size") > > + self.verify((tx_bytes + 4) =3D=3D pktsize, "Tx packet size > should > > be packet size - 4") > > + else: > > + self.verify(rx_err =3D=3D 1 or tx_pkts =3D=3D 0, "Packet d= rop > 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 > testpmd > > 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=3Dlo= op > -- > > 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 > that > > 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, > 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=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