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 01690A046B for ; Mon, 19 Aug 2019 04:09:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AFF62DE3; Mon, 19 Aug 2019 04:09:50 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 80FC0B62 for ; Mon, 19 Aug 2019 04:09:48 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Aug 2019 19:09:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,403,1559545200"; d="scan'208";a="180223498" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 18 Aug 2019 19:09:46 -0700 Received: from fmsmsx161.amr.corp.intel.com (10.18.125.9) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 18 Aug 2019 19:09:46 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX161.amr.corp.intel.com (10.18.125.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 18 Aug 2019 19:09:45 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.80]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.65]) with mapi id 14.03.0439.000; Mon, 19 Aug 2019 10:09:43 +0800 From: "Wu, ChangqingX" To: "Zhu, WenhuiX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V1] tests:add new test suite about interrupt pmd Thread-Index: AQHVVi85gjyfqQDw4UmyVpes+A+A1KcBuZiQ Date: Mon, 19 Aug 2019 02:09:42 +0000 Message-ID: <7F81DD3887C58F49A6B2EFEC3C28E22E0B745C3F@SHSMSX101.ccr.corp.intel.com> References: <1566179159-7877-1-git-send-email-wenhuix.zhu@intel.com> In-Reply-To: <1566179159-7877-1-git-send-email-wenhuix.zhu@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 V1] tests:add new test suite about interrupt pmd 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" This patch will be replaced with a new patch -----Original Message----- From: Zhu, WenhuiX=20 Sent: Monday, August 19, 2019 9:46 AM To: dts@dpdk.org Cc: Wu, ChangqingX Subject: [dts][PATCH V1] tests:add new test suite about interrupt pmd From: changqingxwu Signed-off-by: changqingxwu --- tests/TestSuite_interrupt_pmd.py | 128 +++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 tests/TestSuite_interrupt_pmd.py diff --git a/tests/TestSuite_interrupt_pmd.py b/tests/TestSuite_interrupt_p= md.py new file mode 100644 index 0000000..0aa0b95 --- /dev/null +++ b/tests/TestSuite_interrupt_pmd.py @@ -0,0 +1,128 @@ +# BSD LICENSE +# +# Copyright(c) 2010-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 interrupt pmd. +""" + +import string +import time +import utils +from test_case import TestCase + + +class TestInterruptPmd(TestCase): + def set_up_all(self): + """ + Run at the start of each test suite. + """ + + self.dut_ports =3D self.dut.get_ports(self.nic) + self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports") + cores =3D self.dut.get_core_list("1S/4C/1T") + self.coremask =3D utils.create_mask(cores) + + self.path =3D "./examples/l3fwd-power/build/l3fwd-power" + + self.trafficFlow =3D { + "Flow1": [[0, 0, 1], [1, 0, 2]], + "Flow2": [[0, 0, 0], [0, 1, 1], [0, 2, 2], [0, 3, 3], [0, 4, 4= ]], + "Flow3": [[0, 0, 0], [0, 1, 1], [0, 2, 2], [0, 3, 3], [0, 4, 4= ], [0, 5, 5], [0, 6, 6], [0, 7, 7], + [1, 0, 8], [1, 1, 9], [1, 2, 10], [1, 3, 11], [1, 4,= 12], [1, 5, 13], [1, 6, 14]], + } + # build sample app + out =3D self.dut.build_dpdk_apps("./examples/l3fwd-power") + self.verify("Error" not in out, "compilation error 1") + self.verify("No such file" not in out, "compilation error 2") + + def set_up(self): + """ + Run before each test case. + """ + pass + + def test_different_queue(self): + cmd =3D "%s -c %s -n 4 -- -p 0x3 -P --config=3D'(0,0,1),(1,0,2)' "= % (self.path, self.coremask) + self.dut.send_expect(cmd, "L3FWD_POWER", 60) + portQueueLcore =3D self.trafficFlow["Flow1"] + self.verifier_result(2, 2, portQueueLcore) + + self.dut.kill_all() + cmd =3D "%s -c 0x3f -n 4 -- -p 0x3 -P --config=3D'(0,0,0),(0,1,1),= (0,2,2),(0,3,3),(0,4,4)' "% self.path + self.dut.send_expect(cmd, "L3FWD_POWER", 120) + portQueueLcore =3D self.trafficFlow["Flow2"] + self.verifier_result(20, 1, portQueueLcore) + + self.dut.kill_all() + cmd =3D "%s -c 0xffffff -n 4 -- -p 0x3 -P --config=3D'(0,0,0),(0,1= ,1),(0,2,2),(0,3,3),\ + (0,4,4),(0,5,5),(0,6,6),(0,7,7),(1,0,8),(1,1,9),(1,2,10),(1,3,11),= \ + (1,4,12),(1,5,13),(1,6,14)' "% self.path + + self.dut.send_expect(cmd, "L3FWD_POWER", 60) + portQueueLcore =3D self.trafficFlow["Flow3"] + self.verifier_result(40, 2, portQueueLcore) + + def verifier_result(self, num, portnum, portQueueLcore): + self.scapy_send_packet(num, portnum) + result =3D self.dut.get_session_output(timeout=3D5) + for i in range(len(portQueueLcore)): + lcorePort =3D portQueueLcore[i] + self.verify("FWD_POWER: lcore %d is waked up from rx interrupt= on port %d queue %d" %(lcorePort[2], + lcorePort[0], lcorePort[1]) in result, "Wrong: lcore %d is= waked up failed" % lcorePort[2]) + self.verify("L3FWD_POWER: lcore %d sleeps until interrupt trig= gers" %( + lcorePort[2]) in result, "Wrong: lcore %d not sleeps=20 + until interrupt triggers" % lcorePort[2]) + + def scapy_send_packet(self, num, portnum): + """ + Send a packet to port + """ + for i in range(len(self.dut_ports[:portnum])): + for j in range(num): + txport =3D self.tester.get_local_port(self.dut_ports[i]) + mac =3D self.dut.get_mac_address(self.dut_ports[i]) + txItf =3D self.tester.get_interface(txport) + self.tester.scapy_append( + 'sendp([Ether()/IP(dst=3D"198.0.0.%d")/UDP()/Raw(\'X\'= *18)], iface=3D"%s")' % (j, txItf)) + self.tester.scapy_execute() + + def tear_down(self): + """ + Run after each test case. + """ + pass + + def tear_down_all(self): + """ + Run after each test suite. + """ + self.dut.kill_all() -- 2.17.2