From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id A618D1B36E for ; Tue, 30 Jan 2018 04:31:57 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2018 19:31:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,433,1511856000"; d="scan'208";a="13942295" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga007.fm.intel.com with ESMTP; 29 Jan 2018 19:31:56 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 29 Jan 2018 19:31:55 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 29 Jan 2018 19:31:55 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.145]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.192]) with mapi id 14.03.0319.002; Tue, 30 Jan 2018 11:31:53 +0800 From: "Liu, Yong" To: "Peng, Yuan" , "dts@dpdk.org" CC: "Peng, Yuan" Thread-Topic: [dts] [PATCH] tests: add TestSuite_ixgbe_vf_get_extra_queue_information.py Thread-Index: AQHTgHzu8ZAttg+uPUWDiDwXULJtsaOL8nOw Date: Tue, 30 Jan 2018 03:31:53 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62F7BEFE@SHSMSX103.ccr.corp.intel.com> References: <1514535264-91656-1-git-send-email-yuan.peng@intel.com> In-Reply-To: <1514535264-91656-1-git-send-email-yuan.peng@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWVhYTI5YTUtMjExNC00ZGRhLWEzMDgtZWE2MTk5NmRlYzIxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiI3Uld4MzlLVFVrM2VyUE5RYkdsNEdsUEZ2YkRZRE82dit4dk1FWHhXcXgwVnY2YTRHZWJ2K2wxSmZsckVcL004WSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action 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] tests: add TestSuite_ixgbe_vf_get_extra_queue_information.py 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: Tue, 30 Jan 2018 03:31:58 -0000 Yuan, sorry for late response. My comments are inline. Thanks, Marvin > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Peng Yuan > Sent: Friday, December 29, 2017 4:14 PM > To: dts@dpdk.org > Cc: Peng, Yuan > Subject: [dts] [PATCH] tests: add > TestSuite_ixgbe_vf_get_extra_queue_information.py >=20 > Signed-off-by: Peng Yuan >=20 > diff --git a/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py > b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py > new file mode 100644 > index 0000000..5ddeb29 > --- /dev/null > +++ b/tests/TestSuite_ixgbe_vf_get_extra_queue_information.py > @@ -0,0 +1,309 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2017 Intel Corporation. All rights reserved. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without > +# modification, are permitted provided that the following conditions > +# are met: > +# > +# * Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# * Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in > +# the documentation and/or other materials provided with the > +# distribution. > +# * Neither the name of Intel Corporation nor the names of its > +# contributors may be used to endorse or promote products derived > +# from this software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + > + > +""" > +DPDK Test suite. > +Test VF kernel > +""" > + > +import utils > +import time > +import datetime > +import re > +import random > +import threading > +from test_case import TestCase > +from qemu_kvm import QEMUKvm > +from pmd_output import PmdOutput > +from packet import Packet > +import random > +from utils import GREEN, RED > + > + > +class TestVfKernel(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.dut.send_expect("service network-manager stop", "#", 60) Yuan, please do not do this kind of command in the suite. This should be gu= aranteed by the one who owned test machine. > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > + self.cores =3D self.dut.get_core_list("1S/4C/1T") > + self.coremask =3D utils.create_mask(self.cores) > + > + self.dmac =3D self.dut.get_mac_address(self.dut_ports[0]) > + txport =3D self.tester.get_local_port(self.dut_ports[0]) > + self.tester_intf =3D self.tester.get_interface(txport) > + self.tester_mac =3D self.tester.get_mac(txport) > + > + self.intf =3D self.dut.ports_info[self.dut_ports[0]]['intf'] > + self.pci =3D > self.dut.ports_info[self.dut_ports[0]]['pci'].split(':') I think pci address should keep domain in. Why split it? > + > + self.src_logo =3D '12:34:56:78:90:10' > + self.setup_vm_env() > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + self.start_pf_vf() > + self.verify(self.check_pf_vf_link_status( > + self.vm0_dut, self.vm0_intf0), "vf link down") > + > + pass > + > + def setup_vm_env(self): > + """ > + 1pf -> 1vf , vf->vm0 > + """ > + self.used_dut_port =3D self.dut_ports[0] > + self.dut.generate_sriov_vfs_by_port( > + self.used_dut_port, 1, driver=3D'igb_uio') > + self.sriov_vfs_port =3D self.dut.ports_info[ > + self.used_dut_port]['vfs_port'] > + for port in self.sriov_vfs_port: > + port.bind_driver('pci-stub') > + time.sleep(1) > + > + self.dut_testpmd =3D PmdOutput(self.dut) > + self.dut.send_expect("./%s/app/testpmd -c 1f -n 4 -- -i --rxq=3D= 4 - > -txq=3D4 --nb-cores=3D4" % self.target, "testpmd> ", 120) > + # dpdk-2208 > + # since there is no forward engine on DPDK PF to forward or drop > packet in packet pool, > + # so finally the pool will be full, then no more packet will be > + # received by VF > + self.dut_testpmd.execute_cmd("start") > + > + vf0_prop_1 =3D {'opt_host': self.sriov_vfs_port[0].pci} > + > + self.vm0 =3D QEMUKvm(self.dut, 'vm0', 'vf_kernel') > + self.vm0.set_vm_device(driver=3D'pci-assign', **vf0_prop_1) > + try: > + self.vm0_dut =3D self.vm0.start() > + if self.vm0_dut is None: > + raise Exception("Set up VM ENV failed") > + else: > + self.verify(self.vm0_dut.ports_info[0][ > + 'intf'] !=3D 'N/A', "Not interface") Kernel driver is must for this suite? If not, please remove this check. > + except Exception as e: > + self.destroy_vm_env() > + raise Exception(e) > + > + self.vm0_testpmd =3D PmdOutput(self.vm0_dut) > + > + self.vm0_intf0 =3D self.vm0_dut.ports_info[0]['intf'] > + self.vm0_dut.restore_interfaces_linux() > + > + # stop NetworkManager, this if for centos7 > + # you may change it when the os no support > + self.vm0_dut.send_expect("systemctl stop NetworkManager", "# ", > 60) Execution owner should do this one time setting. Please remove it from test= suite. One comment is enough for reminder.=20 > + > + self.dut_testpmd.quit() > + > + def destroy_vm_env(self): > + """ > + destroy vm environment > + """ > + if getattr(self, 'vm0', None): > + self.vm0_dut.kill_all() > + self.vm0_dut_ports =3D None > + # destroy vm0 > + self.vm0.stop() > + self.vm0 =3D None > + self.dut.virt_exit() > + > + if getattr(self, 'used_dut_port', None) is not None: > + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port) > + port =3D self.dut.ports_info[self.used_dut_port]['port'] > + self.used_dut_port =3D None > + > + def start_pf_vf(self): > + """ > + know issue DPDK-2208. dpdk-2849 > + """ > + self.dut.send_expect("./%s/app/testpmd -c 1f -n 4 -- -i --rxq=3D= 4 - > -txq=3D4 --nb-cores=3D4" % self.target, "testpmd> ", 120) > + self.dut_testpmd.execute_cmd('set fwd rxonly') > + self.dut_testpmd.execute_cmd('set verbose 1') > + self.dut_testpmd.execute_cmd("start") > + time.sleep(10) > + self.vm0_dut.send_expect("rmmod %svf" % self.kdriver, "#") > + self.vm0_dut.send_expect("modprobe %svf" % self.kdriver, "#") > + > + def check_pf_vf_link_status(self, session, intf): > + """ > + sometimes pf/vf will up abnormal, retry 5 times > + """ > + for i in range(5): > + # down-up get new mac form pf. > + # because dpdk pf will give an random mac when dpdk pf > restart. > + session.send_expect("ifconfig %s down" % intf, "#") > + out =3D session.send_expect("ifconfig %s up" % intf, "#") > + # SIOCSIFFLAGS: Network is down > + # i think the pf link abnormal > + if "Network is down" in out: > + print GREEN(out) > + print GREEN("Try again") > + self.dut_testpmd.quit() > + self.vm0_dut.restore_interfaces_linux() > + self.start_pf_vf() > + else: > + out =3D session.send_expect("ethtool %s" % intf, "#") > + if "Link detected: yes" in out: > + return True > + time.sleep(1) > + return False > + > + def send_packet_UP(self, mac, pkt_lens=3D64, num=3D1, prio=3D0): > + """ > + send different User Priority packets. > + """ > + pkt =3D Packet(pkt_type=3D'VLAN_UDP', pkt_len=3Dpkt_lens) > + pkt.config_layer('ether', {'dst': mac, 'src': self.tester_mac}) > + pkt.config_layer('vlan', {'vlan': 0, 'prio': prio}) > + pkt.send_pkt(tx_port=3Dself.tester_intf, count=3Dnum) > + > + def send_packet(self, mac, pkt_type, pkt_lens=3D64, num=3D100): > + """ > + send packets with different PCtype. > + """ > + if (pkt_type =3D=3D "udp"): > + pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dpkt_lens) > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + pkt.config_layer('ipv4', {'src': '192.168.0.1', 'dst': > '192.168.0.2'}) > + pkt.config_layer('udp', {'src': 22, 'dst': 23}) > + pkt.send_pkt(tx_port=3Dself.tester_intf, count=3Dnum) > + elif (pkt_type =3D=3D "ipv4"): > + pkt =3D Packet(pkt_type=3D'IP_RAW', pkt_len=3Dpkt_lens) > + pkt.config_layer('ether', {'dst': mac, 'src': > self.tester_mac}) > + pkt.send_pkt(tx_port=3Dself.tester_intf, count=3Dnum) > + > + def verify_result(self, prio, pkt_num): > + """ > + verify if the packets with different User Priority > + enter to the expected TC queue. > + """ > + out =3D self.vm0_dut.send_expect( > + "ethtool -S %s |grep rx_.*packets" % self.vm0_intf0, "#") > + rx_queue_packet =3D re.findall("rx_.*packets:\s*(\d*)", out) > + self.verify(int(rx_queue_packet[prio + 1]) =3D=3D pkt_num, > + "the packet didn't enter expected queue.") > + > + def test_DCB_TC4(self): > + """ > + DPDK PF, kernel VF, enable DCB mode with TC=3D4 > + """ > + self.dut_testpmd.execute_cmd("stop") > + self.dut_testpmd.execute_cmd("port stop 0") > + self.dut_testpmd.execute_cmd("port config 0 dcb vt on 4 pfc off"= ) > + self.dut_testpmd.execute_cmd("port start 0") > + time.sleep(10) > + self.vm0_dut.send_expect("rmmod %svf" % self.kdriver, "#") > + self.vm0_dut.send_expect("modprobe %svf" % self.kdriver, "#") > + self.verify(self.check_pf_vf_link_status( > + self.vm0_dut, self.vm0_intf0), "vf link down") > + # get the vf's mac address after vf reset. > + vf_out =3D self.vm0_dut.send_expect("ifconfig %s" % self.vm0_int= f0, > "#") > + vf_mac =3D re.findall("ether\s(\S*)\s*", vf_out) > + # verify the rx_queue number equals to TC number. > + out =3D self.vm0_dut.send_expect( > + "ethtool -S %s" % self.vm0_intf0, "#") > + rx_queue_num =3D re.findall("rx_.*misses:\s*(\d*)", out) > + self.verify(len(rx_queue_num) =3D=3D 4, "the queues count error"= ) > + # verify the packet with prio 0-3 enter to queue 0-3 > + # verify the packet with prio 4-7 enter to queue 0 > + self.send_packet_UP(mac=3Dvf_mac[0], prio=3D0) > + self.verify_result(prio=3D0, pkt_num=3D1) > + self.send_packet_UP(mac=3Dvf_mac[0], prio=3D1) > + self.verify_result(prio=3D1, pkt_num=3D1) > + self.send_packet_UP(mac=3Dvf_mac[0], prio=3D2) > + self.verify_result(prio=3D2, pkt_num=3D1) > + self.send_packet_UP(mac=3Dvf_mac[0], prio=3D3) > + self.verify_result(prio=3D3, pkt_num=3D1) > + self.send_packet_UP(mac=3Dvf_mac[0], prio=3D4) > + self.verify_result(prio=3D0, pkt_num=3D2) > + self.send_packet_UP(mac=3Dvf_mac[0], prio=3D5) > + self.verify_result(prio=3D0, pkt_num=3D3) > + self.send_packet_UP(mac=3Dvf_mac[0], prio=3D6) > + self.verify_result(prio=3D0, pkt_num=3D4) > + self.send_packet_UP(mac=3Dvf_mac[0], prio=3D7) > + self.verify_result(prio=3D0, pkt_num=3D5) > + > + def test_disable_DCB(self): > + """ > + DPDK PF, kernel VF, disable DCB mode > + """ > + self.dut_testpmd.execute_cmd("set vf vlan insert 0 0 1") > + # verify the rx_queue number is the default number. > + out =3D self.vm0_dut.send_expect( > + "ethtool -S %s" % self.vm0_intf0, "#") > + rx_queue_num =3D re.findall("rx_.*misses:\s*(\d*)", out) > + self.verify(len(rx_queue_num) =3D=3D 2, "the queues count error"= ) > + # get the vf's mac address after vf reset. > + vf_out =3D self.vm0_dut.send_expect("ifconfig %s" % self.vm0_int= f0, > "#") > + vf_mac =3D re.findall("ether\s(\S*)\s*", vf_out) > + # verify different packet enter different queues with RSS. > + self.send_packet(mac=3Dvf_mac[0], pkt_type=3D"ipv4") > + out =3D self.vm0_dut.send_expect( > + "ethtool -S %s |grep rx_.*packets" % self.vm0_intf0, "#") > + rx_queue_packet =3D re.findall("rx_.*packets:\s*(\d*)", out) > + self.verify(int(rx_queue_packet[1]) =3D=3D 100, > + "the packet didn't enter expected queue.") > + self.verify(int(rx_queue_packet[2]) =3D=3D 0, > + "the packet didn't enter expected queue.") > + self.send_packet(mac=3Dvf_mac[0], pkt_type=3D"udp") > + out =3D self.vm0_dut.send_expect( > + "ethtool -S %s |grep rx_.*packets" % self.vm0_intf0, "#") > + rx_queue_packet =3D re.findall("rx_.*packets:\s*(\d*)", out) > + self.verify(int(rx_queue_packet[2]) =3D=3D 100, > + "the packet didn't enter expected queue.") > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.vm0_testpmd.quit() > + self.vm0_dut.restore_interfaces_linux() > + self.dut_testpmd.quit() > + > + # Sometime test failed ,we still need clear ip. > + self.vm0_dut.send_expect( > + "ifconfig %s 0.0.0.0" % self.vm0_intf0, "#") > + self.tester.send_expect("ifconfig %s 0.0.0.0" % > + self.tester_intf, "#") > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.destroy_vm_env() > + self.dut.kill_all() > + time.sleep(2) > -- > 2.5.0