From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 03B99A05D3 for ; Tue, 23 Apr 2019 20:28:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB5971B441; Tue, 23 Apr 2019 20:28:37 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id B5B951B216 for ; Tue, 23 Apr 2019 20:28:35 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 11:28:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="293902109" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 23 Apr 2019 11:28:33 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 23 Apr 2019 11:28:33 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 23 Apr 2019 11:28:32 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.164]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.39]) with mapi id 14.03.0415.000; Wed, 24 Apr 2019 02:28:31 +0800 From: "Tu, Lijuan" To: "Mei, JianweiX" , "dts@dpdk.org" CC: "Mei, JianweiX" Thread-Topic: [dts] [PATCH V1] tests/runtime_vf_queue_number:add testsuite for runtime vf queue number Thread-Index: AQHU+Lp468t4UOB38UG18fJ4+9r6n6ZKER8Q Date: Tue, 23 Apr 2019 18:28:30 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA656E3@SHSMSX101.ccr.corp.intel.com> References: <1555903525-3272-1-git-send-email-jianweix.mei@intel.com> In-Reply-To: <1555903525-3272-1-git-send-email-jianweix.mei@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTU2MWZlYWQtNjliYi00ZWRhLTg3NjEtZDllZWRjZjRhM2M4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiN2JTTTMwNTdGVDdDZXhuR3VhVThHNWVuMFdsSTRZcmxVSG5PTkY3SlVSTExpVG43clFaMWZwbjNzQ094ajlMTSJ9 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 V1] tests/runtime_vf_queue_number:add testsuite for runtime vf queue number 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" No matter the VF queue number or reserved vf queue number should be random,= not a fixed value. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Jianwei Mei > Sent: Sunday, April 21, 2019 8:25 PM > To: dts@dpdk.org > Cc: Mei, JianweiX > Subject: [dts] [PATCH V1] tests/runtime_vf_queue_number:add testsuite for > runtime vf queue number >=20 > add testsuite for runtime vf queue number >=20 > Signed-off-by: Jianwei Mei > --- > tests/TestSuite_runtime_vf_queue_number.py | 507 > +++++++++++++++++++++ > 1 file changed, 507 insertions(+) > create mode 100644 tests/TestSuite_runtime_vf_queue_number.py >=20 > diff --git a/tests/TestSuite_runtime_vf_queue_number.py > b/tests/TestSuite_runtime_vf_queue_number.py > new file mode 100644 > index 0000000..3e03020 > --- /dev/null > +++ b/tests/TestSuite_runtime_vf_queue_number.py > @@ -0,0 +1,507 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2019 Intel Corporation. All rights reserved. [Lijuan] 2010-2019 -> 2019 > +# 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. > + > +''' > + > +import time > +import re > +from qemu_kvm import QEMUKvm > +from test_case import TestCase > +from pmd_output import PmdOutput > + > +VM_CORES_MASK =3D 'all' > + > +class TestRuntimeVfQn(TestCase): > + supported_vf_driver =3D ['pci-stub', 'vfio-pci'] > + 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.src_intf =3D self.tester.get_interface(self.tester.get_loca= l_port(0)) > + self.src_mac =3D self.tester.get_mac(self.tester.get_local_port= (0)) > + self.dst_mac =3D self.dut.get_mac_address(0) > + self.vm0 =3D None > + self.pf_pci =3D self.dut.ports_info[self.dut_ports[0]]['pci'] > + self.host_testpmd =3D PmdOutput(self.dut) > + self.used_dut_port =3D self.dut_ports[0] > + self.vf_mac =3D "00:11:22:33:44:55" > + > + def set_up(self): > + self.dut.kill_all() > + > + def setup_vm_env(self, driver=3D'default'): > + ''' > + setup qemu virtual environment,this is to set up 1pf and 2vfs > environment, the pf can be bond to > + kernel driver or dpdk driver. > + ''' > + self.dut.generate_sriov_vfs_by_port(self.used_dut_port, 2, > driver=3Ddriver) > + self.sriov_vfs_port_0 =3D > + self.dut.ports_info[self.used_dut_port]['vfs_port'] > + > + # set vf assign method and vf driver > + self.vf_driver =3D self.get_suite_cfg()['vf_driver'] > + if self.vf_driver is None: > + self.vf_driver =3D 'pci-stub' > + self.verify(self.vf_driver in self.supported_vf_driver, "Unsppor= ted vf > driver") > + if self.vf_driver =3D=3D 'pci-stub': > + self.vf_assign_method =3D 'pci-assign' > + else: > + self.vf_assign_method =3D 'vfio-pci' > + self.dut.send_expect('modprobe vfio-pci', '#') > + > + try: > + for port in self.sriov_vfs_port_0: > + port.bind_driver(self.vf_driver) > + > + time.sleep(1) > + vf0_prop =3D {'opt_host': self.sriov_vfs_port_0[0].pci} > + vf1_prop =3D {'opt_host': self.sriov_vfs_port_0[1].pci} > + > + # set up VM0 ENV > + self.vm0 =3D QEMUKvm(self.dut, 'vm0', 'vf_queue_number') > + self.vm0.set_vm_device(driver=3Dself.vf_assign_method, **vf0= _prop) > + self.vm_dut_0 =3D self.vm0.start() > + if self.vm_dut_0 is None: > + raise Exception('Set up VM0 ENV failed!') > + except Exception as e: > + print e > + self.destroy_vm_env() > + raise Exception(e) > + > + def destroy_vm_env(self): > + #destroy vm0 > + if getattr(self, 'vm0', None) and self.vm0: > + self.vm0_dut_ports =3D None > + self.vm0.stop() > + self.vm0 =3D None > + > + #destroy host testpmd > + if getattr(self, 'host_testpmd', None): > + self.host_testpmd.execute_cmd('quit', '# ') > + self.host_testpmd =3D None > + > + # reset used port's sriov > + if getattr(self, 'used_dut_port', None): > + self.dut.destroy_sriov_vfs_by_port(self.used_dut_port) > + port =3D self.dut.ports_info[self.used_dut_port]['port'] > + port.bind_driver() > + self.used_dut_port =3D None > + > + # bind used ports with default driver > + for port_id in self.dut_ports: > + port =3D self.dut.ports_info[port_id]['port'] > + port.bind_driver() > + > + def preset_host_testpmd(self, core_mask, eal_param): > + self.host_testpmd.start_testpmd(core_mask, param=3D'', > eal_param=3Deal_param) > + time.sleep(2) > + > + def send_packet(self, vf_mac, itf, integer): > + """ > + Sends packets. > + """ > + self.tester.scapy_foreground() > + time.sleep(2) > + for i in range(integer): > + packet =3D r'sendp([Ether(dst=3D"%s", > src=3Dget_if_hwaddr("%s"))/IP(src=3D"10.0.0.1", dst=3D"192.168.0.%d")], > iface=3D"%s")' % ( > + vf_mac, itf, i + 1, itf) > + self.tester.scapy_append(packet) > + self.tester.scapy_execute() > + time.sleep(2) > + > + def check_packet_queue(self, out): > + """ > + get the queue which packet enter. > + """ > + self.verify("Queue=3D 0" in out and "Queue=3D 1" in out and "Que= ue=3D 2" in > out and "Queue=3D 3" in out > + and "Queue=3D 4" in out and "Queue=3D 5" in out and = "Queue=3D 6" > in out and "Queue=3D 7" in out, > + "there is some queues doesn't work") > + lines =3D out.split("\r\n") > + reta_line =3D {} > + queue_flag =3D 0 > + packet_sumnum =3D 0 > + # collect the hash result and the queue id > + for line in lines: > + line =3D line.strip() > + if queue_flag =3D=3D 1: > + result_scanner =3D r"RX-packets:\s?([0-9]+)" > + scanner =3D re.compile(result_scanner, re.DOTALL) > + m =3D scanner.search(line) > + packet_num =3D m.group(1) > + packet_sumnum =3D packet_sumnum + int(packet_num) > + queue_flag =3D 0 > + elif line.strip().startswith("------- Forward"): > + queue_flag =3D 1 > + elif line.strip().startswith("RX-packets"): > + result_scanner =3D r"RX-packets:\s?([0-9]+)" > + scanner =3D re.compile(result_scanner, re.DOTALL) > + m =3D scanner.search(line) > + packet_rec =3D m.group(1) > + > + self.verify(packet_sumnum =3D=3D int(packet_rec) =3D=3D 254, "Th= ere are > + some packets lost.") > + > + def stop_vm0(self): > + if getattr(self, 'vm0', None) and self.vm0: > + self.vm0_dut_ports =3D None > + self.vm0.stop() > + self.vm0 =3D None > + > + def execute_testpmd_cmd(self, cmds): > + if len(cmds) =3D=3D 0: > + return > + for item in cmds: > + if len(item) =3D=3D 2: > + self.vm0_testpmd.execute_cmd(item[0], int(item[1])) > + else: > + self.vm0_testpmd.execute_cmd(item[0]) > + > + def test_set_valid_vf_qn(self): > + """ > + Test case 1: reserve valid vf queue number > + :return: > + """ > + self.stop_vm0() [Lijuan] move to tear_down() > + self.setup_vm_env(driver=3D'igb_uio') > + host_eal_param =3D '-w %s,queue-num-per-vf=3D4 --file-prefix=3Dt= est1 -- > socket-mem 1024,1024' % self.pf_pci > + self.preset_host_testpmd(VM_CORES_MASK, > + eal_param=3Dhost_eal_param) > + > + gest_eal_param =3D '-w %s --file-prefix=3Dtest2' % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > + self.vm0_testpmd.start_testpmd(VM_CORES_MASK, > eal_param=3Dgest_eal_param, param=3D'') > + time.sleep(1) > + guest_cmds =3D [['stop'], > + ['port stop all'], > + ['port config all txq 4'], > + ['port config all rxq 4'], > + ['port start all']] > + self.execute_testpmd_cmd(guest_cmds) > + outstring =3D self.vm0_testpmd.execute_cmd("start", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("port 0: RX queue number: 4 Tx queue number: 4" in > outstring, "The RX/TX queue number error.") > + time.sleep(10) > + guest_cmds1 =3D [['stop'], > + ['port stop all'], > + ['port config all txq 5'], > + ['port config all rxq 5'], > + ['port start all']] > + self.execute_testpmd_cmd(guest_cmds1) > + outstring1 =3D self.vm0_testpmd.execute_cmd("start", "testpmd> "= , 120) > + time.sleep(2) > + self.verify("port 0: RX queue number: 5 Tx queue number: 5" in > outstring1, "The RX/TX queue number error.") > + time.sleep(2) > + self.vm0_testpmd.execute_cmd('quit', '# ') > + self.dut.send_expect("quit", "# ") > + > + def test_set_invalid_vf_qn(self): > + """ > + Test case 2: reserve invalid VF queue number > + :return: > + """ > + eal_param =3D '-w %s,queue-num-per-vf=3D0 --file-prefix=3Dtest1 = --socket- > mem 1024,1024' % self.pf_pci > + testpmd_out =3D self.host_testpmd.start_testpmd(VM_CORES_MASK, > param=3D'', eal_param=3Deal_param) > + self.verify("it must be power of 2 and equal or less than 16" in > testpmd_out, "there is no 'Wrong VF queue number =3D 0' logs.") > + self.dut.send_expect("quit", "# ") > + > + def test_set_valid_vf_qn_in_testpmd(self): > + """ > + Test case 3: set valid VF queue number in testpmd command-line > options > + :return: > + """ > + self.stop_vm0() > + self.setup_vm_env(driver=3D'igb_uio') > + host_eal_param =3D '-w %s --file-prefix=3Dtest1 --socket-mem 102= 4,1024' % > self.pf_pci > + self.preset_host_testpmd(VM_CORES_MASK, > + eal_param=3Dhost_eal_param) > + > + gest_eal_param =3D '-w %s --file-prefix=3Dtest2' % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > + self.vm0_testpmd.start_testpmd(VM_CORES_MASK, > eal_param=3Dgest_eal_param, param=3D' --rxq=3D3 --txq=3D3') > + time.sleep(1) > + self.vm0_testpmd.execute_cmd("set promisc all off", "testpmd> ") > + self.vm0_testpmd.execute_cmd("set fwd mac", "testpmd> ") > + outstring =3D self.vm0_testpmd.execute_cmd("start", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("port 0: RX queue number: 3 Tx queue number: 3" in > + outstring, "The RX/TX queue number error.") > + > + self.vm0_dut_ports =3D self.vm_dut_0.get_ports('any') > + self.vf_mac =3D self.vm0_testpmd.get_port_mac(self.vm0_dut_ports= [0]) > + self.send_packet(self.vf_mac, self.src_intf, 3) > + outstring1 =3D self.vm0_testpmd.execute_cmd("stop", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("Queue=3D 0" in outstring1 or "Queue=3D 1" in outstr= ing1 or > "Queue=3D 2" in outstring1, "there is some queues doesn't work") > + self.vm0_testpmd.execute_cmd('quit', '# ') > + self.dut.send_expect("quit", "# ") > + > + def test_set_valid_min_vf_qn_in_testpmd(self): > + """ > + Test case 3: set mininum valid VF queue number in testpmd comman= d- > line options > + :return: > + """ > + self.stop_vm0() > + self.setup_vm_env(driver=3D'igb_uio') > + host_eal_param =3D '-w %s --file-prefix=3Dtest1 --socket-mem 102= 4,1024' % > self.pf_pci > + self.preset_host_testpmd(VM_CORES_MASK, > + eal_param=3Dhost_eal_param) > + > + gest_eal_param =3D '-w %s --file-prefix=3Dtest2' % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > + self.vm0_testpmd.start_testpmd(VM_CORES_MASK, > eal_param=3Dgest_eal_param, param=3D' --rxq=3D1 --txq=3D1') > + time.sleep(1) > + self.vm0_testpmd.execute_cmd("set promisc all off", "testpmd> ") > + self.vm0_testpmd.execute_cmd("set fwd mac", "testpmd> ") > + outstring =3D self.vm0_testpmd.execute_cmd("start", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("port 0: RX queue number: 1 Tx queue number: 1" in > outstring, "The RX/TX queue number error.") > + self.vm0_dut_ports =3D self.vm_dut_0.get_ports('any') > + self.vf_mac =3D > + self.vm0_testpmd.get_port_mac(self.vm0_dut_ports[0]) > + > + self.send_packet(self.vf_mac, self.src_intf, 3) > + outstring1 =3D self.vm0_testpmd.execute_cmd("stop", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("RX-packets: 3" in outstring1 and "TX-packets: 3" in > outstring1, "the count of packets is incorrect.") > + self.vm0_testpmd.execute_cmd('quit', '# ') > + self.dut.send_expect("quit", "# ") > + > + def test_set_valid_max_vf_qn_in_testpmd(self): > + """ > + Test case 3: set maximum valid VF queue number in testpmd > command-line options > + :return: > + """ > + self.stop_vm0() > + self.setup_vm_env(driver=3D'igb_uio') > + host_eal_param =3D '-w %s --file-prefix=3Dtest1 --socket-mem 102= 4,1024' % > self.pf_pci > + self.preset_host_testpmd(VM_CORES_MASK, > + eal_param=3Dhost_eal_param) > + > + gest_eal_param =3D '-w %s --file-prefix=3Dtest2' % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > + self.vm0_testpmd.start_testpmd(VM_CORES_MASK, > eal_param=3Dgest_eal_param, param=3D' --rxq=3D16 --txq=3D16') > + time.sleep(10) > + self.vm0_testpmd.execute_cmd("set promisc all off", "testpmd> ") > + self.vm0_testpmd.execute_cmd("set fwd mac", "testpmd> ") > + outstring =3D self.vm0_testpmd.execute_cmd("start", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("port 0: RX queue number: 16 Tx queue number: 16" in > outstring, "The RX/TX queue number error.") > + self.vm0_dut_ports =3D self.vm_dut_0.get_ports('any') > + self.vf_mac =3D > + self.vm0_testpmd.get_port_mac(self.vm0_dut_ports[0]) > + > + self.send_packet(self.vf_mac, self.src_intf, 254) > + outstring1 =3D self.vm0_testpmd.execute_cmd("stop", "testpmd> ",= 120) > + self.check_packet_queue(outstring1) > + self.vm0_testpmd.execute_cmd('quit', '# ') > + self.dut.send_expect("quit", "# ") > + > + def test_set_invalid_vf_qn_in_testpmd(self): > + """ > + Test case 4: set invalid VF queue number in testpmd command-line > options > + :return: > + """ > + self.stop_vm0() > + self.setup_vm_env(driver=3D'igb_uio') > + host_eal_param =3D '-w %s --file-prefix=3Dtest1 --socket-mem 102= 4,1024' % > self.pf_pci > + self.preset_host_testpmd(VM_CORES_MASK, > eal_param=3Dhost_eal_param) > + gest_eal_param =3D '-w %s --file-prefix=3Dtest2' % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > + > + command_0 =3D "./%s/app/testpmd -c %s -n %d %s -- -i %s" \ > + % (self.dut.target, '0xf', self.dut.get_memory_channel= s(), > gest_eal_param, ' --rxq=3D0 --txq=3D0') > + outstring =3D self.vm0_testpmd.execute_cmd(command_0, expected= =3D'# ', > timeout=3D120) > + time.sleep(10) > + self.verify("Either rx or tx queues should be non-zero" in outst= ring, > "The output of testpmd start is different from expect when set invalid VF > queue number 0.") > + time.sleep(2) > + command_17 =3D "./%s/app/testpmd -c %s -n %d %s -- -i %s" \ > + % (self.dut.target, '0xf', self.dut.get_memory_channel= s(), > gest_eal_param, ' --rxq=3D17 --txq=3D17') > + outstring1 =3D self.vm0_testpmd.execute_cmd(command_17, > expected=3D'# ', timeout=3D120) > + time.sleep(10) > + self.verify("rxq 17 invalid - must be >=3D 0 && <=3D 16" in outs= tring1, > + "The output of testpmd start is different from expec= t when set > invalid VF queue number 17.") > + self.dut.send_expect("quit", "# ") > + > + def test_set_valid_vf_qn_with_testpmd_func_cmd(self): > + """ > + Test case 5: set valid VF queue number with testpmd function > command > + :return: > + """ > + self.stop_vm0() > + self.setup_vm_env(driver=3D'igb_uio') > + host_eal_param =3D '-w %s --file-prefix=3Dtest1 --socket-mem 102= 4,1024' % > self.pf_pci > + self.preset_host_testpmd(VM_CORES_MASK, > + eal_param=3Dhost_eal_param) > + > + gest_eal_param =3D '-w %s --file-prefix=3Dtest2' % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > + self.vm0_testpmd.start_testpmd(VM_CORES_MASK, > eal_param=3Dgest_eal_param, param=3D'') > + time.sleep(10) > + guest_cmds =3D [['set promisc all off'], > + ['set fwd mac'], > + ['stop'], > + ['port stop all'], > + ['port config all txq 3'], > + ['port config all rxq 3'], > + ['port start all']] > + self.execute_testpmd_cmd(guest_cmds) > + outstring =3D self.vm0_testpmd.execute_cmd("start", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("port 0: RX queue number: 3 Tx queue number: 3" in > outstring, "The RX/TX queue number error.") > + self.vm0_dut_ports =3D self.vm_dut_0.get_ports('any') > + self.vf_mac =3D > + self.vm0_testpmd.get_port_mac(self.vm0_dut_ports[0]) > + > + self.send_packet(self.vf_mac, self.src_intf, 3) > + outstring1 =3D self.vm0_testpmd.execute_cmd("stop", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("Queue=3D 0" in outstring1 or "Queue=3D 1" in outstr= ing1 or > "Queue=3D 2" in outstring1, > + "there is some queues doesn't work") > + > + self.vm0_testpmd.execute_cmd('quit', '# ') > + self.dut.send_expect("quit", "# ") > + > + def test_set_min_vf_qn_with_testpmd_func_cmd(self): > + """ > + Test case 5: set mininum valid VF queue number with testpmd > function command > + :return: > + """ > + self.stop_vm0() > + self.setup_vm_env(driver=3D'igb_uio') > + host_eal_param =3D '-w %s --file-prefix=3Dtest1 --socket-mem 102= 4,1024' % > self.pf_pci > + self.preset_host_testpmd(VM_CORES_MASK, > + eal_param=3Dhost_eal_param) > + > + gest_eal_param =3D '-w %s --file-prefix=3Dtest2' % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > + self.vm0_testpmd.start_testpmd(VM_CORES_MASK, > eal_param=3Dgest_eal_param, param=3D'') > + time.sleep(10) > + guest_cmds =3D [['set promisc all off'], > + ['set fwd mac'], > + ['stop'], > + ['port stop all'], > + ['port config all txq 1'], > + ['port config all rxq 1'], > + ['port start all']] > + self.execute_testpmd_cmd(guest_cmds) > + outstring =3D self.vm0_testpmd.execute_cmd("start", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("port 0: RX queue number: 1 Tx queue number: 1" in > outstring, "The RX/TX queue number error.") > + self.vm0_dut_ports =3D self.vm_dut_0.get_ports('any') > + self.vf_mac =3D > + self.vm0_testpmd.get_port_mac(self.vm0_dut_ports[0]) > + > + self.send_packet(self.vf_mac, self.src_intf, 3) > + outstring1 =3D self.vm0_testpmd.execute_cmd("stop", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("RX-packets: 3" in outstring1 and "TX-packets: 3" in > outstring1, > + "the count of packets is incorrect.") > + > + self.vm0_testpmd.execute_cmd('quit', '# ') > + self.dut.send_expect("quit", "# ") > + > + def test_set_max_vf_qn_with_testpmd_func_cmd(self): > + """ > + Test case 5: set maximum valid VF queue number with testpmd > function command > + :return: > + """ > + self.stop_vm0() > + self.setup_vm_env(driver=3D'igb_uio') > + host_eal_param =3D '-w %s --file-prefix=3Dtest1 --socket-mem 102= 4,1024' % > self.pf_pci > + self.preset_host_testpmd(VM_CORES_MASK, > + eal_param=3Dhost_eal_param) > + > + gest_eal_param =3D '-w %s --file-prefix=3Dtest2' % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > + self.vm0_testpmd.start_testpmd(VM_CORES_MASK, > eal_param=3Dgest_eal_param, param=3D'') > + time.sleep(10) > + guest_cmds =3D [['set promisc all off'], > + ['set fwd mac'], > + ['stop'], > + ['port stop all'], > + ['port config all txq 16'], > + ['port config all rxq 16'], > + ['port start all']] > + self.execute_testpmd_cmd(guest_cmds) > + outstring =3D self.vm0_testpmd.execute_cmd("start", "testpmd> ",= 120) > + time.sleep(2) > + self.verify("port 0: RX queue number: 16 Tx queue number: 16" in > outstring, "The RX/TX queue number error.") > + self.vm0_dut_ports =3D self.vm_dut_0.get_ports('any') > + self.vf_mac =3D > + self.vm0_testpmd.get_port_mac(self.vm0_dut_ports[0]) > + > + self.send_packet(self.vf_mac, self.src_intf, 254) > + outstring1 =3D self.vm0_testpmd.execute_cmd("stop", "testpmd> ",= 120) > + self.check_packet_queue(outstring1) > + self.vm0_testpmd.execute_cmd('quit', '# ') > + self.dut.send_expect("quit", "# ") > + > + def test_set_invalid_vf_qn_with_testpmd_func_cmd(self): > + """ > + Test case 6: set invalid VF queue number with testpmd function > command > + :return: > + """ > + # There is a bug of this test case, so the function hasn't been > implemented. > + pass > + > + def test_reserve_vf_qn(self): > + """ > + Test case 7: Reserve VF queue number when VF bind to kernel driv= er > + :return: > + """ > + self.stop_vm0() > + self.setup_vm_env(driver=3D'igb_uio') > + host_eal_param =3D '-w %s,queue-num-per-vf=3D2 --file-prefix=3Dt= est1 -- > socket-mem 1024,1024' % self.pf_pci > + self.preset_host_testpmd(VM_CORES_MASK, > + eal_param=3Dhost_eal_param) > + > + gest_eal_param =3D '-w %s --file-prefix=3Dtest2' % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd =3D PmdOutput(self.vm_dut_0) > + self.vm0_testpmd.start_testpmd(VM_CORES_MASK, > eal_param=3Dgest_eal_param, param=3D'') > + time.sleep(1) > + intf =3D self.vm_dut_0.ports_info[0]['intf'] > + if intf !=3D 'N/A' and intf !=3D '': > + self.vm0_testpmd.execute_cmd('quit', '# ') > + command =3D "./usertools/dpdk-devbind.py -b i40evf %s" % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd.execute_cmd(command, expected=3D'# ', > timeout=3D120) > + output =3D self.vm0_testpmd.execute_cmd("ethtool -S %s" % in= tf, > expected=3D'# ', timeout=3D120) > + self.verify("tx-0.packets: 0" in output and "tx-1.packets: 0= " in output, > "VF0 rxq and txq number is not 2.") > + else: > + time.sleep(120) > + self.vm0_testpmd.execute_cmd('quit', '# ') > + command =3D "./usertools/dpdk-devbind.py -b i40evf %s" % > self.vm_dut_0.ports_info[0]['pci'] > + self.vm0_testpmd.execute_cmd(command, expected=3D'# ', > timeout=3D120) > + nic_info =3D self.vm0_testpmd.execute_cmd("./usertools/dpdk- > devbind.py -s | grep %s" % self.vm_dut_0.ports_info[0]['pci'], expected= =3D'# ', > timeout=3D120) > + time.sleep(2) > + inf_str =3D nic_info.split("if=3D")[1] > + inf =3D inf_str.split(" ")[0] > + if "drv" not in inf and inf !=3D "": > + output =3D self.vm0_testpmd.execute_cmd("ethtool -S %s" = % inf, > expected=3D'# ', timeout=3D120) > + else: > + output =3D "" > + self.verify("tx-0.packets: 0" in output and "tx-1.packets: 0= " in output, > "VF0 rxq and txq number is not 2.") > + self.dut.send_expect("quit", "# ") > + > + def tear_down(self): > + pass > + > + def tear_down_all(self): > + self.destroy_vm_env() > + for port_id in self.dut_ports: > + self.dut.destroy_sriov_vfs_by_port(port_id) > + > + self.tester.send_expect("kill -9 $(ps aux | grep -i qemu | grep > + -v grep | awk {'print $2'})", '# ', 5) > -- > 2.17.2