From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 1324E5F2A for ; Wed, 14 Mar 2018 08:11:31 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2018 00:11:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,469,1515484800"; d="scan'208";a="25553607" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga006.jf.intel.com with ESMTP; 14 Mar 2018 00:11:30 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 14 Mar 2018 00:11:30 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 14 Mar 2018 00:11:29 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.235]) by shsmsx102.ccr.corp.intel.com ([169.254.2.80]) with mapi id 14.03.0319.002; Wed, 14 Mar 2018 15:11:27 +0800 From: "Peng, Yuan" To: "Liu, Yong" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH] tests: add TestSuite_runtime_queue_number.py Thread-Index: AQHTuckhP7NS712FmkKiz3PKfiAdIKPPU4hA Date: Wed, 14 Mar 2018 07:11:27 +0000 Message-ID: <67D543A150B29E4CAAE53918F64EDAEA374AB182@SHSMSX103.ccr.corp.intel.com> References: <1520234224-69326-1-git-send-email-yuan.peng@intel.com> <86228AFD5BCD8E4EBFD2B90117B5E81E62FBEAA1@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <86228AFD5BCD8E4EBFD2B90117B5E81E62FBEAA1@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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_runtime_queue_number.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: Wed, 14 Mar 2018 07:11:32 -0000 Hi Marvin, I have updated the patch according to your comments. Please help to review it again. Thank you very much! Yuan. -----Original Message----- From: Liu, Yong=20 Sent: Monday, March 12, 2018 2:13 PM To: Peng, Yuan ; dts@dpdk.org Cc: Peng, Yuan Subject: RE: [dts] [PATCH] tests: add TestSuite_runtime_queue_number.py Yuan, Some comments are inline. Thanks, Marvin > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Peng Yuan > Sent: Monday, March 05, 2018 3:17 PM > To: dts@dpdk.org > Cc: Peng, Yuan > Subject: [dts] [PATCH] tests: add TestSuite_runtime_queue_number.py >=20 > Set the VF max queue number when running the DPDK APP instead of compilin= g. >=20 > Signed-off-by: Peng Yuan >=20 > diff --git a/tests/TestSuite_runtime_queue_number.py > b/tests/TestSuite_runtime_queue_number.py > new file mode 100644 > index 0000000..11931d1 > --- /dev/null > +++ b/tests/TestSuite_runtime_queue_number.py > @@ -0,0 +1,257 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2017 Intel Corporation. All rights reserved. > +# All rights reserved. Should be "2010-2018".=20 > +# > +# Redistribution and use in source and binary forms, with or without=20 > +# modification, are permitted provided that the following conditions=20 > +# 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=20 > +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #=20 > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR=20 > +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE=20 > +COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,=20 > +INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES=20 > +(INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR=20 > +SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION)=20 > +HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT,=20 > +STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE)=20 > +ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF= THE POSSIBILITY OF SUCH DAMAGE. > + > +""" > +DPDK Test suite. > + > +Set the VF max queue number when running the DPDK APP instead of > compiling. > + > +""" > + > +import utils > +import time > +import re > + > +from test_case import TestCase > +from settings import HEADER_SIZE > +from pmd_output import PmdOutput > +from settings import DRIVERS > + > +from project_dpdk import DPDKdut > +from dut import Dut These two modules are useless in the suite, please remove them. > +from packet import Packet > + > + > +class TestRuntime_Queue_Number(TestCase): > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + Run time Queue Number Prerequistites > + """ > + self.verify(self.nic in ["fortville_eagle", "fortville_spirit", > + "fortville_spirit_single", > "fortpark_TLV"], "NIC Unsupported: " + str(self.nic)) > + If this suite only valuable for Fortville NIC, I suggest to add this inform= ation in test_case_supportlist.json.=20 > + # Based on h/w type, choose how many ports to use > + self.dut_ports =3D self.dut.get_ports(self.nic) > + # Verify that enough ports are available > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > + > + localPort =3D self.tester.get_local_port(self.dut_ports[0]) > + self.tester_intf =3D self.tester.get_interface(localPort) > + self.tester_mac =3D self.tester.get_mac(localPort) > + self.pf_interface =3D self.dut.ports_info[self.dut_ports[0]]['in= tf'] > + self.pf_mac =3D self.dut.get_mac_address(0) > + self.pf_pci =3D self.dut.ports_info[self.dut_ports[0]]['pci'] > + self.pmdout =3D PmdOutput(self.dut) > + self.cores =3D "1S/4C/1T" > + > + self.session_secondary =3D self.dut.new_session() > + self.session_third =3D self.dut.new_session() > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + self.dut.kill_all() Kill action should be in tear_down function. If previous suite has incorrec= t behavior, we should know that.=20 > + > + def setup_env(self, vfs_num): > + """ > + This is to set up vf environment. > + The pf is bound to dpdk driver. > + """ > + # create two vfs Typo here, should be "assigned number of VFs".=20 > + self.dut.generate_sriov_vfs_by_port(self.dut_ports[0],=20 > + vfs_num, > self.drivername) > + self.sriov_vfs_port =3D > self.dut.ports_info[self.dut_ports[0]]['vfs_port'] > + > + try: > + for port in self.sriov_vfs_port: > + port.bind_driver(driver=3D"vfio-pci") "vfio-pci" may not insmoded on host. You can make sure that by call functio= n "self.dut.setup_modules_linux()".=20 > + except Exception as e: > + self.destroy_env() > + raise Exception(e) > + > + def destroy_env(self): > + """ > + This is to stop testpmd and destroy vf environment. > + """ > + self.session_third.send_expect("quit", "# ") > + time.sleep(2) > + self.session_secondary.send_expect("quit", "# ") > + time.sleep(2) > + self.dut.send_expect("quit", "# ") > + time.sleep(2) > + self.dut.destroy_sriov_vfs_by_port(self.dut_ports[0]) > + > + def verify_result(self, outstring, max_rxqn, max_txqn, cur_rxqn, > cur_txqn): > + """ > + verify the packet to the expected queue or be dropped > + """ > + self.verify("Max possible RX queues: %d" % max_rxqn in=20 > + outstring, > "the vf RX max queue number is not set successfully") > + self.verify("Max possible TX queues: %d" % max_txqn in=20 > + outstring, > "the vf TX max queue number is not set successfully") > + self.verify("Current number of RX queues: %d" % cur_rxqn in > outstring, "the vf RX queue number is not set successfully") > + self.verify("Current number of TX queues: %d" % cur_txqn in > outstring, "the vf TX queue number is not set successfully") > + > + def test_set_valid_vf_max_qn(self): > + """ > + try to set all the valid queue number of VF > + """ > + self.setup_env(2) > + max_qn =3D (1, 2, 4, 8, 16) > + # set all the valid queue number per VF > + for i in max_qn: > + # start testpmd on pf > + self.pmdout.start_testpmd("%s" % self.cores, eal_param=3D"- > w %s,queue-num-per-vf=3D%d --file-prefix=3Dtest1 --socket-mem 1024,1024" = %=20 > (self.pf_pci, i)) > + # start testpmd on vf0 > + self.session_secondary.send_expect("./%s/app/testpmd -c=20 > + 0xf0 > -n 4 -w %s --file-prefix=3Dtest2 --socket-mem 1024,1024 -- -i --rxq=3D%d= =20 > -- txq=3D%d" % (self.target, self.sriov_vfs_port[0].pci, i, i),=20 > "testpmd>", 120) > + outstring =3D self.session_secondary.send_expect("show port > info all", "testpmd> ", 120) > + self.verify_result(outstring, max_rxqn=3Di, max_txqn=3Di, > cur_rxqn=3Di, cur_txqn=3Di) > + self.session_secondary.send_expect("quit", "# ") > + time.sleep(2) > + self.dut.send_expect("quit", "# ") > + time.sleep(2) > + > + def test_set_invalid_vf_max_qn(self): > + """ > + try to set several invalid queue number of VF > + """ > + self.setup_env(2) > + max_qn =3D (0, 6, 17, 32) > + # set several invalid queue number per vf > + for i in max_qn: > + # start testpmd on pf > + out =3D self.pmdout.start_testpmd("%s" % self.cores, > eal_param=3D"-w %s,queue-num-per-vf=3D%d --file-prefix=3Dtest1 --socket-m= em=20 > 1024,1024" % (self.pf_pci, i)) > + self.verify("i40e_pf_parse_vf_queue_number_handler():=20 > + Wrong > VF queue number =3D %d, it must be power of 2 and equal or less than 16=20 > !, Now it is kept the value =3D 4" % i in out, "the setting of invalid=20 > vf max queue number failed.") Check message is too long here, and this kind of error message will keep ch= anging between releases. You can use simplified string like "Wrong VF queue number =3D 6" to check t= his error.=20 > + # start testpmd on vf0 > + self.session_secondary.send_expect("./%s/app/testpmd -c=20 > + 0xf0 > -n 4 -w %s --file-prefix=3Dtest2 --socket-mem 1024,1024 -- -i" %=20 > (self.target, self.sriov_vfs_port[0].pci), "testpmd>", 120) > + outstring =3D self.session_secondary.send_expect("show port > info all", "testpmd> ", 120) > + self.verify_result(outstring, max_rxqn=3D4, max_txqn=3D4, > cur_rxqn=3D1, cur_txqn=3D1) > + self.session_secondary.send_expect("quit", "# ") > + time.sleep(2) > + self.dut.send_expect("quit", "# ") > + time.sleep(2) > + > + def test_set_vf_qn(self): > + """ > + set vf queue number with testpmd eal parameters. > + """ > + self.setup_env(2) > + self.pmdout.start_testpmd("%s" % self.cores, eal_param=3D"- > w %s,queue-num-per-vf=3D8 --file-prefix=3Dtest1 --socket-mem 1024,1024" % > self.pf_pci) > + self.session_secondary.send_expect("./%s/app/testpmd -c 0xf0=20 > + -n 4 > -w %s --file-prefix=3Dtest2 --socket-mem 1024,1024 -- -i --rxq=3D9=20 > --txq=3D9" % (self.target, self.sriov_vfs_port[0].pci), "# ", 120) > + self.session_secondary.send_expect("./%s/app/testpmd -c 0xf0=20 > + -n 4 > -w %s --file-prefix=3Dtest2 --socket-mem 1024,1024 -- -i --rxq=3D3=20 > --txq=3D3" % (self.target, self.sriov_vfs_port[0].pci), "testpmd>", 120) > + outstring =3D self.session_secondary.send_expect("show port=20 > + info > all", "testpmd> ", 120) > + self.verify_result(outstring, max_rxqn=3D8, max_txqn=3D8,=20 > + cur_rxqn=3D3, > cur_txqn=3D3) > + > + def test_set_vf_qn_in_testpmd(self): > + """ > + set vf queue number with testpmd command. > + """ > + self.setup_env(2) > + self.pmdout.start_testpmd("%s" % self.cores, eal_param=3D"- > w %s,queue-num-per-vf=3D8 --file-prefix=3Dtest1 --socket-mem 1024,1024" % > self.pf_pci) > + self.session_secondary.send_expect("./%s/app/testpmd -c 0xf0=20 > + -n 4 > -w %s --file-prefix=3Dtest2 --socket-mem 1024,1024 -- -i" %=20 > (self.target, self.sriov_vfs_port[0].pci), "testpmd>", 120) > + outstring =3D self.session_secondary.send_expect("show port=20 > + info > all", "testpmd> ", 120) > + self.verify_result(outstring, max_rxqn=3D8, max_txqn=3D8,=20 > + cur_rxqn=3D1, > cur_txqn=3D1) > + self.session_secondary.send_expect("port stop all", "testpmd> ") > + self.session_secondary.send_expect("port config all rxq 8", > "testpmd> ") > + self.session_secondary.send_expect("port config all txq 8", > "testpmd> ") > + self.session_secondary.send_expect("port start all", "testpmd> "= ) > + outstring =3D self.session_secondary.send_expect("show port=20 > + info > all", "testpmd> ", 120) > + self.verify_result(outstring, max_rxqn=3D8, max_txqn=3D8,=20 > + cur_rxqn=3D8, > cur_txqn=3D8) > + self.session_secondary.send_expect("port stop all", "testpmd> ") > + self.session_secondary.send_expect("port config all rxq 9", > "Fail") > + self.session_secondary.send_expect("port config all txq 9", > "Fail") > + self.session_secondary.send_expect("port start all", "testpmd> "= ) > + outstring =3D self.session_secondary.send_expect("show port=20 > + info > all", "testpmd> ", 120)=09 > + self.verify_result(outstring, max_rxqn=3D8, max_txqn=3D8,=20 > + cur_rxqn=3D8, > cur_txqn=3D8) > + > + def test_set_32vfs_1pf(self): > + """ > + set max queue number when setting 32 VFs on 1 PF port. > + """ > + self.setup_env(32) > + # failed to set VF max queue num to 16. > + out =3D self.pmdout.start_testpmd("%s" % self.cores,=20 > + eal_param=3D"- > w %s,queue-num-per-vf=3D16 --file-prefix=3Dtest1 --socket-mem 1024,1024" = % > self.pf_pci) > + self.verify("Failed to allocate 577 queues, which exceeds the > hardware maximum 384" in out, "the queue num exceeds the hardware=20 > maximum > 384") The number 577 may be changed as default reserved queue value may be change= d. Suggest to user simple check string.=20 > + self.dut.send_expect("quit", "# ") > + # succeed in setting VF max queue num to 8 > + self.pmdout.start_testpmd("%s" % self.cores, eal_param=3D"- > w %s,queue-num-per-vf=3D8 --file-prefix=3Dtest1 --socket-mem 1024,1024" % > self.pf_pci) > + # start testpmd on vf0 > + self.session_secondary.send_expect("./%s/app/testpmd -c 0xf0=20 > + -n 4 > -w %s --file-prefix=3Dtest2 --socket-mem 1024,1024 -- -i --rxq=3D%d=20 > --txq=3D%d" % (self.target, self.sriov_vfs_port[0].pci, 8, 8),=20 > "testpmd>", 120) > + # start testpmd on vf31 > + self.session_third.send_expect("./%s/app/testpmd -c 0xf00 -n=20 > + 4 - > w %s --file-prefix=3Dtest3 --socket-mem 1024,1024 -- -i" % (self.target,= =20 > self.sriov_vfs_port[31].pci), "testpmd>", 120) > + # check the max queue number and current queue number > + outstring =3D self.session_secondary.send_expect("show port=20 > + info > all", "testpmd> ", 120) > + self.verify_result(outstring, max_rxqn=3D8, max_txqn=3D8,=20 > + cur_rxqn=3D8, > cur_txqn=3D8) > + outstring =3D self.session_third.send_expect("show port info=20 > + all", > "testpmd> ", 120) > + self.verify_result(outstring, max_rxqn=3D8, max_txqn=3D8,=20 > + cur_rxqn=3D1, > cur_txqn=3D1) > + > + def test_vf_bound_to_kerneldriver(self): > + """ > + set vf queue number when vf bound to kernel driver. > + """ > + self.setup_env(1) > + # bind vf to kernel driver > + for port in self.sriov_vfs_port: > + port.bind_driver(driver=3D"i40evf") > + # set vf max queue number to 8 > + self.pmdout.start_testpmd("%s" % self.cores, eal_param=3D"- > w %s,queue-num-per-vf=3D8 --file-prefix=3Dtest1 --socket-mem 1024,1024" % > self.pf_pci) > + # get the vf interface > + out =3D self.session_secondary.send_expect("./usertools/dpdk- > devbind.py -s", "# ") > + lines =3D out.split("\r\n") > + for line in lines: > + line =3D line.strip() > + if len(line) !=3D 0 and > line.startswith(self.sriov_vfs_port[0].pci): > + for item in line.split(): > + item =3D item.strip() > + if(item.startswith("if")): > + name, vf_intf =3D item.split("=3D", 1) Do not need to call tool in dpdk source folder, you can method get_interfac= e_name in NIC object to retrieve interface name. > + # list all the vf rx/tx queues > + outstring =3D self.session_secondary.send_expect("ethtool -S=20 > + %s" % > vf_intf, "# ", 120) > + self.verify("rx-7.packets" in outstring, "the vf RX max queue > number is not set successfully") > + self.verify("tx-7.packets" in outstring, "the vf TX max queue > number is not set successfully") > + self.dut.send_expect("quit", "# ") > + for port in self.sriov_vfs_port: > + port.bind_driver(driver=3D"vfio-pci") > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.destroy_env() > + self.dut.kill_all() > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + self.dut.kill_all() > + self.dut.close_session(self.session_secondary) > + self.dut.close_session(self.session_third) > -- > 2.5.0