From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9337AA00E6 for ; Thu, 8 Aug 2019 07:49:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 86CCD2082; Thu, 8 Aug 2019 07:49:43 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 7EB27271 for ; Thu, 8 Aug 2019 07:49:41 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2019 22:49:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,360,1559545200"; d="scan'208";a="193080127" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga001.fm.intel.com with ESMTP; 07 Aug 2019 22:49:40 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 7 Aug 2019 22:49:40 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 7 Aug 2019 22:49:39 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.80]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.62]) with mapi id 14.03.0439.000; Thu, 8 Aug 2019 13:49:37 +0800 From: "Tu, Lijuan" To: "Zhao, MeijuanX" , "dts@dpdk.org" CC: "Peng, Yuan" , "Zhao, MeijuanX" Thread-Topic: [dts] [PATCH V2] tests/add new test suite qos api Thread-Index: AQHVTaqbVDM5YyLTYUiyUYkMmzBufKbwvq4w Date: Thu, 8 Aug 2019 05:49:37 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BAFF66F@SHSMSX101.ccr.corp.intel.com> References: <20190808133200.7088-1-meijuanx.zhao@intel.com> In-Reply-To: <20190808133200.7088-1-meijuanx.zhao@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.2.0.6 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGFhMGZmZGItMDM0My00NGVhLThlOTAtNWY2MmZlZmQ5ODgwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaExmMWNNeTZsbTNcL3krQklCNHl6aGZKWGpyUDJGY2poVW52YVU1MVJpZytsZVNQMG9EY2x3aDk4NGFUZlRIWjgifQ== 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 V2] tests/add new test suite qos api 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" > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhaomeijuan > Sent: Thursday, August 8, 2019 9:32 PM > To: dts@dpdk.org > Cc: Peng, Yuan ; Zhao, MeijuanX > > Subject: [dts] [PATCH V2] tests/add new test suite qos api >=20 > change code structure [Lijuan] this is not align with your script. >=20 > Signed-off-by: zhaomeijuan > --- > tests/TestSuite_qos_api.py | 264 > +++++++++++++++++++++++++++++++++++++ > 1 file changed, 264 insertions(+) > create mode 100644 tests/TestSuite_qos_api.py >=20 > diff --git a/tests/TestSuite_qos_api.py b/tests/TestSuite_qos_api.py new = file > mode 100644 index 0000000..32ebd21 > --- /dev/null > +++ b/tests/TestSuite_qos_api.py > @@ -0,0 +1,264 @@ > +# BSD LICENSE > +# > +# Copyright(c) <2019> 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 QOS API in DPDK. > +""" > + > +import utils > +import string > +import re > +import time > +import os > +from pktgen import PacketGeneratorHelper from test_case import TestCase > +from pmd_output import PmdOutput > + > + > +class TestQosApi(TestCase): > + > + def set_up_all(self): > + """ > + ip_fragmentation Prerequisites > + """ > + > + # Based on h/w type, choose how many ports to use > + ports =3D self.dut.get_ports() > + self.dut_ports =3D self.dut.get_ports(self.nic) > + > + # Verify that enough ports are available > + self.verify(len(ports) >=3D 2, "Insufficient ports for testing") > + > + self.ports_socket =3D self.dut.get_numa_id(ports[0]) > + # each flow to 200Mbps > + self.bps =3D 200000000 > + self.bps_rate =3D [0, 0.1] > + self.eal_param =3D ' --master-lcore=3D1' > + # Verify that enough threads are available > + cores =3D self.dut.get_core_list("1S/1C/1T") > + self.verify(cores is not None, "Insufficient cores for speed tes= ting") > + global P0, P1 > + P0 =3D ports[0] > + P1 =3D ports[1] > + > + self.txItf =3D self.tester.get_interface(self.tester.get_local_p= ort(P0)) > + self.rxItf =3D self.tester.get_interface(self.tester.get_local_p= ort(P1)) > + self.dmac =3D self.dut.get_mac_address(P0) > + self.host_testpmd =3D PmdOutput(self.dut) > + > + # get dts output path > + if self.logger.log_path.startswith(os.sep): > + self.output_path =3D self.logger.log_path > + else: > + cur_path =3D os.path.dirname( > + os.path.dirname(os.path.realpath(__file_= _))) > + self.output_path =3D os.sep.join([cur_path, self.logger.log_= path]) > + # create an instance to set stream field setting > + self.pktgen_helper =3D PacketGeneratorHelper() > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + > + def add_root_non_leaf_node(self): > + self.dut.send_expect('add port tm nonleaf node 1 1000000 -1 0 1 > + 0 -1 1 0 0', 'testpmd> ') > + > + def add_private_shaper(self, n): > + for i in range(n): > + self.dut.send_expect('add port tm node shaper profile 1 %s > + 0 0 25000000 0 0' % str(i + 1), 'testpmd> ') > + > + def add_private_shaper_ixgbe(self, n): > + for i in range(n): > + self.dut.send_expect('add port tm node shaper profile 1 %s > + 0 0 25000000 0 0' % i, 'testpmd> ') > + > + def add_tc_node(self, n): > + for i in range(n): > + self.dut.send_expect('add port tm nonleaf node 1 %s 1000000 > + 0 1 1 1 1 0 0' % (900000 + i), 'testpmd> ') > + > + def add_tc_node_ixgbe(self, n): > + for i in range(n): > + self.dut.send_expect('add port tm nonleaf node 1 %s 1000000 > + 0 1 1 -1 1 0 0' % (900000 + i), 'testpmd> ') > + > + def set_dcb(self, n): > + """ > + set DCB > + """ > + self.dut.send_expect('port stop all', 'testpmd> ') > + self.dut.send_expect('port config 0 dcb vt off %s pfc off' % n, = 'testpmd> > ') > + self.dut.send_expect('port config 1 dcb vt off %s pfc off' % n, = 'testpmd> > ') > + self.dut.send_expect('port start all', 'testpmd> ') > + > + def scapy_send_packet_verify(self, n): > + self.tester.scapy_foreground() > + dmac =3D self.dut.get_mac_address(P0) > + queues_4tc =3D [0, 32, 64, 96] > + queues_8tc =3D [0, 16, 32, 48, 64, 80, 96, 112] > + print dmac > + for i in range(n): > + pkt =3D "Ether(dst=3D'%s', > src=3D'00:02:00:00:00:01')/Dot1Q(prio=3D%s)/IP()/Raw('x'*20)" % (dmac, i) > + self.tester.scapy_append('sendp([%s], iface=3D"%s")' % (pkt,= self.txItf)) > + self.tester.scapy_execute() > + time.sleep(2) > + out =3D self.dut.get_session_output() > + if self.kdriver =3D=3D 'i40e': > + self.verify('queue %s' % i in out and dmac.upper() in ou= t, 'wrong > queue receive packet') > + else: > + if n =3D=3D 4: > + self.verify('queue %s' % queues_4tc[i] in out and dm= ac.upper() > in out, 'wrong queue receive packet') > + else: > + self.verify('queue %s' % queues_8tc[i] in out and > + dmac.upper() in out, 'wrong queue receive packet') > + > + def queue_map_test(self, n): > + self.set_dcb(n) > + self.dut.send_expect('port start all', 'testpmd> ') > + self.dut.send_expect('set fwd rxonly', 'testpmd> ') > + self.dut.send_expect('set verbose 1', 'testpmd> ') > + self.dut.send_expect('start', 'testpmd> ') > + self.scapy_send_packet_verify(n) > + > + def shaping_tc_test_i40e(self, n): > + self.set_dcb(n) > + self.add_root_non_leaf_node() > + self.add_private_shaper(n) > + self.add_tc_node(n) > + self.add_queue_leaf_node(n) > + self.dut.send_expect('port tm hierarchy commit 1 no', 'testpmd> = ') > + self.dut.send_expect('start', 'testpmd> ') > + self.perf_test(n) > + > + def test_dcb_4tc_queue_map_i40e(self): > + self.verify(self.kdriver in ["i40e"], "NIC Unsupported: " + str(= self.nic)) > + self.host_testpmd.start_testpmd("1S/5C/1T", " --nb-cores=3D4 --t= xq=3D4 -- > rxq=3D4 --rss-ip ", eal_param=3Dself.eal_param) > + self.queue_map_test(4) > + > + def test_dcb_8tc_queue_map_i40e(self): > + self.verify(self.kdriver in ["i40e"], "NIC Unsupported: " + str(= self.nic)) > + self.host_testpmd.start_testpmd("1S/9C/1T", " --nb-cores=3D8 --t= xq=3D8 -- > rxq=3D8 --rss-ip ", eal_param=3Dself.eal_param) > + self.queue_map_test(8) > + > + def test_perf_shaping_for_port_i40e(self): > + self.verify(self.kdriver in ["i40e"], "NIC Unsupported: " + str(= self.nic)) > + eal_param =3D ' --master-lcore=3D1' > + self.host_testpmd.start_testpmd("1S/5C/1T", " --nb-cores=3D4 --t= xq=3D4 -- > rxq=3D4 --rss-ip ", eal_param=3Dself.eal_param) > + self.dut.send_expect('port stop 1', 'testpmd> ') > + self.dut.send_expect('add port tm node shaper profile 1 0 0 0 > 25000000 0 0', 'testpmd> ') > + self.dut.send_expect('add port tm nonleaf node 1 1000000 -1 0 1 = 0 0 1 > 0 0', 'testpmd> ') > + self.dut.send_expect('port tm hierarchy commit 1 no', 'testpmd> = ') > + self.dut.send_expect('port start 1', 'testpmd> ') > + self.dut.send_expect('start', 'testpmd> ') > + self.perf_test(4) > + > + def test_perf_shaping_1port_4tc_i40e(self): > + self.verify(self.kdriver in ["i40e"], "NIC Unsupported: " + str(= self.nic)) > + self.host_testpmd.start_testpmd("1S/5C/1T", " --nb-cores=3D4 --t= xq=3D4 -- > rxq=3D4 --rss-ip ", eal_param=3Dself.eal_param) > + self.shaping_tc_test_i40e(4) > + > + def test_perf_shaping_1port_8tc_i40e(self): > + self.verify(self.kdriver in ["i40e"], "NIC Unsupported: " + str(= self.nic)) > + self.host_testpmd.start_testpmd("1S/9C/1T", " --nb-cores=3D8 --t= xq=3D8 -- > rxq=3D8 --rss-ip ", eal_param=3Dself.eal_param) > + self.shaping_tc_test_i40e(8) > + > + def test_dcb_4tc_queue_map_ixgbe(self): > + self.verify(self.kdriver in ["ixgbe"], "NIC Unsupported: " + str= (self.nic)) > + self.host_testpmd.start_testpmd("1S/5C/1T", " --nb-cores=3D4 --t= xq=3D4 -- > rxq=3D4 --disable-rss ", eal_param=3Dself.eal_param) > + self.queue_map_test(4) > + > + def test_dcb_8tc_queue_map_ixgbe(self): > + self.verify(self.kdriver in ["ixgbe"], "NIC Unsupported: " + str= (self.nic)) > + self.host_testpmd.start_testpmd("1S/9C/1T", " --nb-cores=3D8 --t= xq=3D8 -- > rxq=3D8 --disable-rss ", eal_param=3Dself.eal_param) > + self.queue_map_test(8) > + > + def test_perf_shaping_1port_4tc_ixgbe(self): > + self.verify(self.kdriver in ["ixgbe"], "NIC Unsupported: " + str= (self.nic)) > + self.host_testpmd.start_testpmd("1S/5C/1T", " --nb-cores=3D4 --t= xq=3D4 -- > rxq=3D4 --disable-rss ", eal_param=3Dself.eal_param) > + self.shaping_tc_test_ixgbe(4) > + > + def test_perf_shaping_1port_8tc_ixgbe(self): > + self.verify(self.kdriver in ["ixgbe"], "NIC Unsupported: " + str= (self.nic)) > + self.host_testpmd.start_testpmd("1S/9C/1T", " --nb-cores=3D8 --t= xq=3D8 -- > rxq=3D8 --disable-rss ", eal_param=3Dself.eal_param) > + self.shaping_tc_test_ixgbe(8) > + > + def shaping_tc_test_ixgbe(self, n): > + self.set_dcb(n) > + self.add_root_non_leaf_node() > + self.add_tc_node_ixgbe(n) > + self.add_private_shaper_ixgbe(n) > + self.add_queue_leaf_node_ixgbe(n) > + self.dut.send_expect('port tm hierarchy commit 1 no', 'testpmd> = ') > + self.dut.send_expect('start', 'testpmd> ') > + self.perf_test(n) > + > + def perf_test(self, n): > + > + dmac =3D self.dut.get_mac_address(self.dut_ports[0]) > + pkts =3D [] > + for i in range(n): > + pkt =3D 'Ether(dst=3D"%s", > src=3D"00:02:00:00:00:01")/Dot1Q(prio=3D%s)/IP()/("x"*26)' % (dmac, i) > + pkts.append(pkt) > + for i in range(n): > + flow =3D pkts[i] > + pcap =3D os.sep.join([self.output_path, "test.pcap"]) > + self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap, flow)= ) > + self.tester.scapy_execute() > + > + tgenInput =3D [] > + pcap =3D os.sep.join([self.output_path, "test.pcap"]) > + > + tgenInput.append((self.tester.get_local_port(self.dut_ports[0]), > + self.tester.get_local_port(self.dut_ports[1]), pcap)) > + > + self.tester.pktgen.clear_streams() > + streams =3D > self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100, None, > self.tester.pktgen) > + traffic_opt =3D {'delay': 10} > + bps, pps =3D > self.tester.pktgen.measure_throughput(stream_ids=3Dstreams, > options=3Dtraffic_opt) > + bps_rate =3D abs(float(self.bps) - bps)/self.bps > + print "bps_rate", bps_rate > + self.verify(round(self.bps_rate[1] >=3D bps_rate, 3) >=3D > + self.bps_rate[0], 'rx bps is not match 200M') > + > + def add_queue_leaf_node(self, n): > + for i in range(n): > + self.dut.send_expect('add port tm leaf node 1 %s %s 0 1 2 > + -1 0 0xffffffff 0 0' % (i, 900000 + i), 'testpmd> ') > + > + def add_queue_leaf_node_ixgbe(self, n): > + for i in range(n): > + self.dut.send_expect('add port tm leaf node 1 %s %s 0 1 2 0 > + 0 0xffffffff 0 0' % (i, 900000 + i), 'testpmd> ') > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.send_expect('quit', '# ') > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + pass > -- > 2.17.1