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 0BB4CA00E6 for ; Thu, 8 Aug 2019 08:25:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 05089231E; Thu, 8 Aug 2019 08:25:18 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 123B3F04 for ; Thu, 8 Aug 2019 08:25:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2019 23:25:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,360,1559545200"; d="scan'208";a="186251436" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga002.jf.intel.com with ESMTP; 07 Aug 2019 23:25:14 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 7 Aug 2019 23:25:14 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 7 Aug 2019 23:25:14 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.139]) by shsmsx102.ccr.corp.intel.com ([169.254.2.19]) with mapi id 14.03.0439.000; Thu, 8 Aug 2019 14:25:12 +0800 From: "Peng, Yuan" To: "Zhao, MeijuanX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V3] tests: add new test suite qos api Thread-Index: AQHVTbE+r+617flR+UKuYVlA0Kn8p6bwyGGw Date: Thu, 8 Aug 2019 06:25:12 +0000 Message-ID: <67D543A150B29E4CAAE53918F64EDAEA3774299E@SHSMSX103.ccr.corp.intel.com> References: <20190808141951.8990-1-meijuanx.zhao@intel.com> In-Reply-To: <20190808141951.8990-1-meijuanx.zhao@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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] 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" Acked-by Peng, Yuan -----Original Message----- From: Zhao, MeijuanX=20 Sent: Thursday, August 8, 2019 10:20 PM To: dts@dpdk.org Cc: Peng, Yuan ; Zhao, MeijuanX Subject: [dts][PATCH V3] tests: add new test suite qos api add new test suite about qos api Signed-off-by: zhaomeijuan --- changes v1 -> v3: - chenge code structure, change function queue_map_test, shaping_tc_test_= i40e location to make test case be togehter tests/TestSuite_qos_api.py | 264 +++++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 tests/TestSuite_qos_api.py diff --git a/tests/TestSuite_qos_api.py b/tests/TestSuite_qos_api.py new fi= le 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 #=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 COPYRIGHT #=20 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #=20 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #=20 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #=20 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #=20 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #=20 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #=20 +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=20 +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 testi= ng") + global P0, P1 + P0 =3D ports[0] + P1 =3D ports[1] + + self.txItf =3D self.tester.get_interface(self.tester.get_local_por= t(P0)) + self.rxItf =3D self.tester.get_interface(self.tester.get_local_por= t(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_pa= th]) + # 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=20 + 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=20 + 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=20 + 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=20 + 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=20 + 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, 't= estpmd> ') + self.dut.send_expect('port config 1 dcb vt off %s pfc off' % n, 't= estpmd> ') + 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(pr= io=3D%s)/IP()/Raw('x'*20)" % (dmac, i) + self.tester.scapy_append('sendp([%s], iface=3D"%s")' % (pkt, s= elf.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 out,= 'wrong queue receive packet') + else: + if n =3D=3D 4: + self.verify('queue %s' % queues_4tc[i] in out and dmac= .upper() in out, 'wrong queue receive packet') + else: + self.verify('queue %s' % queues_8tc[i] in out and=20 + 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(se= lf.nic)) + self.host_testpmd.start_testpmd("1S/5C/1T", " --nb-cores=3D4 --txq= =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(se= lf.nic)) + self.host_testpmd.start_testpmd("1S/9C/1T", " --nb-cores=3D8 --txq= =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(se= lf.nic)) + eal_param =3D ' --master-lcore=3D1' + self.host_testpmd.start_testpmd("1S/5C/1T", " --nb-cores=3D4 --txq= =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 2500= 0000 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(se= lf.nic)) + self.host_testpmd.start_testpmd("1S/5C/1T", " --nb-cores=3D4 --txq= =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(se= lf.nic)) + self.host_testpmd.start_testpmd("1S/9C/1T", " --nb-cores=3D8 --txq= =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(s= elf.nic)) + self.host_testpmd.start_testpmd("1S/5C/1T", " --nb-cores=3D4 --txq= =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(s= elf.nic)) + self.host_testpmd.start_testpmd("1S/9C/1T", " --nb-cores=3D8 --txq= =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(s= elf.nic)) + self.host_testpmd.start_testpmd("1S/5C/1T", " --nb-cores=3D4 --txq= =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(s= elf.nic)) + self.host_testpmd.start_testpmd("1S/9C/1T", " --nb-cores=3D8 --txq= =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(pr= io=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"]) + =20 + tgenInput.append((self.tester.get_local_port(self.dut_ports[0]),=20 + self.tester.get_local_port(self.dut_ports[1]), pcap)) + + self.tester.pktgen.clear_streams() + streams =3D self.pktgen_helper.prepare_stream_from_tginput(tge= nInput, 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=20 + 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=20 + -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=20 + 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