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 C7172A0096 for ; Thu, 11 Apr 2019 08:47:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 605E75F16; Thu, 11 Apr 2019 08:47:46 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id B2ED05F13 for ; Thu, 11 Apr 2019 08:47:44 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2019 23:47:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,336,1549958400"; d="scan'208";a="335754371" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 10 Apr 2019 23:47:43 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 10 Apr 2019 23:47:43 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 10 Apr 2019 23:47:42 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.164]) by shsmsx102.ccr.corp.intel.com ([169.254.2.206]) with mapi id 14.03.0415.000; Thu, 11 Apr 2019 14:47:40 +0800 From: "Zhang, Yuwei1" To: "Ma, LihongX" , "dts@dpdk.org" Thread-Topic: [dts][PATCH V1] Add testsuite of eventdev_pipeline Thread-Index: AQHU8CX0o12VW9B/bke7M4D5VXMDDqY2hIgw Date: Thu, 11 Apr 2019 06:47:40 +0000 Message-ID: References: <1554933505-9568-1-git-send-email-lihongx.ma@intel.com> In-Reply-To: <1554933505-9568-1-git-send-email-lihongx.ma@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODkwOGM4YmUtMjQwNS00OGFjLThkNjEtOWM2MmZhYWE2Y2JiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUmxoXC9ub2h3TFJHcDE5YkRyMTBVWXpiSmthdHJ2aDMzc1BkTW12NlVoVGtldnVPc3dmWms4eUhJVGtNV0s4Y1AifQ== dlp-product: dlpe-windows dlp-version: 11.0.600.7 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 V1] Add testsuite of eventdev_pipeline 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: Yuwei Zhang (yuwei1.zhang@intel.com) -----Original Message----- From: Ma, LihongX=20 Sent: Thursday, April 11, 2019 5:58 AM To: dts@dpdk.org; Zhang, Yuwei1 Cc: Ma, LihongX Subject: [dts][PATCH V1] Add testsuite of eventdev_pipeline Add keep ordered test cases about eventdev pipeline Signed-off-by: lihong --- tests/TestSuite_eventdev_pipeline.py | 219 +++++++++++++++++++++++++++++++= ++++ 1 file changed, 219 insertions(+) create mode 100644 tests/TestSuite_eventdev_pipeline.py diff --git a/tests/TestSuite_eventdev_pipeline.py b/tests/TestSuite_eventde= v_pipeline.py new file mode 100644 index 0000000..cee636a --- /dev/null +++ b/tests/TestSuite_eventdev_pipeline.py @@ -0,0 +1,219 @@ +# 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 eventdev pipeline +""" + +import utils +import time +import re +from test_case import TestCase +import scapy.layers.inet +from scapy.utils import rdpcap + + +class TestEventdevPipeline(TestCase): + + def set_up_all(self): + """ + Run at the start of each test suite. + """ + self.works =3D 4 + self.packet_num =3D 96 + self.core_config =3D "1S/7C/1T" + self.build_eventdev_app() + + self.dut_ports =3D self.dut.get_ports() + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports for=20 + testing") + + self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) + self.core_list =3D self.dut.get_core_list( + self.core_config, socket=3Dself.ports_socket) + self.core_list_rx =3D self.core_list[0:1] + self.core_list_tx =3D self.core_list[1:2] + self.core_list_sd =3D self.core_list[2:3] + self.core_list_wk =3D self.core_list[3:7] + self.core_mask_rx =3D utils.create_mask(self.core_list_rx) + self.core_mask_tx =3D utils.create_mask(self.core_list_tx) + self.core_mask_sd =3D utils.create_mask(self.core_list_sd) + self.core_mask_wk =3D utils.create_mask(self.core_list_wk) + + self.core_list =3D ",".join(self.core_list) + pre =3D int(self.core_list[0]) - 1 + self.core_list =3D str(pre) + "," + self.core_list + + self.rx_port =3D self.tester.get_local_port(self.dut_ports[0]) + self.tx_port =3D self.rx_port + self.rx_interface =3D self.tester.get_interface(self.rx_port) + self.tx_interface =3D self.tester.get_interface(self.tx_port) + self.d_mac =3D self.dut.get_mac_address(self.dut_ports[0]) + + def set_up(self): + """ + Run before each test case. + """ + self.dut.send_expect("killall -s INT eventdev_pipeline", "#") + + def build_eventdev_app(self): + self.app_command =3D "examples/eventdev_pipeline" + out =3D self.dut.build_dpdk_apps(self.app_command) + self.verify('make: Leaving directory' in out, "Compilation failed"= ) + self.verify("Error" not in out, "compilation error 1") + self.verify("No such file" not in out, "compilation error 2") + + def lanuch_eventdev_pipeline(self, cmd_type): + """ + run eventdev_pipeline command + """ + command_line =3D "taskset -c %s " + self.app_command + \ + "/build/app/eventdev_pipeline " + \ + "--vdev event_sw0 -- -r%s -t%s -e%s -w %s -s1 -n0 -= c32 -W1000 %s -D" + command_line =3D command_line % ( + self.core_list, self.core_mask_rx, self.core_mask_tx, + self.core_mask_sd, self.core_mask_wk, cmd_type) + self.dut.send_expect(command_line, "Port 0", 30) + + out =3D self.dut.get_session_output() + self.verify("executing NIC Rx" in out, "lcore of rx not right") + self.verify("executing NIC Tx" in out, "lcore of tx not right") + self.verify("executing scheduler" in out, "lcore of scheduler not = right") + self.verify("executing worker" in out, "lcore of worker not=20 + right") + + def remove_dhcp_from_revpackets(self, inst): + pkts =3D self.tester.load_tcpdump_sniff_packets(inst) + i =3D 0 + while len(pkts) !=3D 0 and i <=3D len(pkts) - 1: + if pkts[i].pktgen.pkt.haslayer('DHCP'): + pkts.remove(pkts[i]) + i =3D i - 1 + i =3D i + 1 + return pkts + + def send_ordered_packet(self): + """ + send the packets with ordered of src-ip info + worker dequeue depth of 32, so the packet number is multiple of 32= is better + compose the pcap file, each queue has same 5 tuple and diff load i= nfo + eg: + if only one flow, the pcap has same 5 tuple and the load info from= 000001 to 000096 + if has eight flow, the pcap has 8 couples with diff 5 tuple, and e= ach couple load info from + 000001 to 000012 + """ + for queue in range(self.queues): + src_ip =3D "11.12.13.%d" % (queue+1) + pay_load =3D "000001" + flow_info =3D 'flow1 =3D [Ether(dst=3D"%s",src=3D"%s")/IP(src= =3D"%s")/UDP(sport=3D123, dport=3D12)/("%s")]' + self.tester.scapy_append(flow_info % (self.d_mac, self.s_mac, = src_ip, pay_load)) + for i in range(1, self.packet_num/self.queues): + pay_load =3D "0000%.2d" % (i+1) + self.tester.scapy_append('flow_temp =3D [Ether(dst=3D"%s",= src=3D"%s")/IP(src=3D"%s")/UDP(sport=3D123, dport=3D12)/("%s")]' + % (self.d_mac, self.s_mac, src_ip,= pay_load)) + if i =3D=3D 1: + self.tester.scapy_append('flow2 =3D flow_temp') + else: + self.tester.scapy_append('flow2 =3D flow2 + flow_temp'= ) + if queue =3D=3D 0: + self.tester.scapy_append('flow =3D flow1 + flow2') + else: + self.tester.scapy_append('flow =3D flow + flow1 + flow2') + + self.tester.scapy_append('wrpcap("pipeline.pcap", flow)') + self.tester.scapy_execute() + time.sleep(5) + + filt =3D [{'layer': 'ether', 'config': {'src': '%s' % self.s_mac}}= ] + inst =3D self.tester.tcpdump_sniff_packets(self.rx_interface, time= out=3D15, filters=3Dfilt) + self.tester.scapy_append('pkt=3Drdpcap("pipeline.pcap")') + self.tester.scapy_append('sendp(pkt, iface=3D"%s")' % self.tx_inte= rface) + self.tester.scapy_execute() + time.sleep(5) + self.pkts =3D self.remove_dhcp_from_revpackets(inst) + + def check_packet_order(self): + """ + observe the packets sended by scapy, check the packets order + """ + self.send_ordered_packet() + for queue in range(self.queues): + src_ip =3D "11.12.13.%d" % (queue+1) + packet_index =3D 0 + for i in range(len(self.pkts)): + pay_load =3D "0000%.2d" % (packet_index) + if self.pkts[i].pktgen.pkt['IP'].src =3D=3D src_ip: + print self.pkts[i].pktgen.pkt.show + # get the start index load info of each queue + if packet_index =3D=3D 0: + packet_index =3D int(self.pkts[i].pktgen.pkt['Raw'= ].load[-2:]) + pay_load =3D "0000%.2d" % (packet_index) + self.verify(self.pkts[i].pktgen.pkt['Raw'].load =3D=3D= pay_load, + "The packets not ordered") + packet_index =3D packet_index + 1 + + def test_keep_packet_order_with_ordered_stage(self): + """ + keep the packets order with one ordered stage in single-flow and m= ulti-flow + according to the tcpdump may be capture the packets whitch not bel= ong current + flow, so set different src_mac of flow to identify the packets + """ + self.lanuch_eventdev_pipeline("-o") + self.queues =3D 1 + self.s_mac =3D "00:00:00:00:00:00" + self.check_packet_order() + self.s_mac =3D "00:00:00:00:00:01" + self.queues =3D 8 + self.check_packet_order() + + def test_keep_packet_order_with_default_stage(self): + """ + keep the packets order with atomic stage in single-flow and multi-= flow + """ + self.lanuch_eventdev_pipeline(" ") + self.queues =3D 1 + self.s_mac =3D "00:00:00:00:00:02" + self.check_packet_order() + self.s_mac =3D "00:00:00:00:00:03" + self.queues =3D 8 + self.check_packet_order() + + def tear_down(self): + """ + Run after each test case. + """ + self.dut.send_expect("^c", "#", 10) + self.dut.send_expect("killall -s INT eventdev_pipeline", "#") + time.sleep(5) + + def tear_down_all(self): + """ + Run after each test suite. + """ -- 2.7.4