From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 43C4123B for ; Tue, 21 Nov 2017 06:38:25 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2017 21:38:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,431,1505804400"; d="scan'208";a="4170954" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 20 Nov 2017 21:38:25 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 20 Nov 2017 21:38:24 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Tue, 21 Nov 2017 13:38:23 +0800 From: "Liu, Yong" To: "Lin, Xueqin" , "dts@dpdk.org" CC: "Lin, Xueqin" Thread-Topic: [dts] [PATCH v4] add dynamic flow type test suite Thread-Index: AQHTYojx2pMcp2cFQkmhQW9DXt9hL6MeTuOg Date: Tue, 21 Nov 2017 05:38:22 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62F1B638@SHSMSX103.ccr.corp.intel.com> References: <1511219443-10347-1-git-send-email-xueqin.lin@intel.com> In-Reply-To: <1511219443-10347-1-git-send-email-xueqin.lin@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzQ3YjA3MmUtNjQwNC00ZmZiLWJmOGEtZDQxYzg0ZmYxYTE0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJkdzRDRTBGeGVhN0FJejR0Nm5KRG9wZ1wvRDhObFNCb0RuUFAwTVwvaTljR3JhV0ZaRzBreFRWNU5UVFMxT1A1Uk8ifQ== x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 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 v4] add dynamic flow type test suite 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: , X-List-Received-Date: Tue, 21 Nov 2017 05:38:26 -0000 Xueqin, Few comments are inline. Thanks, Marvin > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xueqin Lin > Sent: Tuesday, November 21, 2017 7:11 AM > To: dts@dpdk.org > Cc: Lin, Xueqin > Subject: [dts] [PATCH v4] add dynamic flow type test suite >=20 > --- > tests/TestSuite_dynamic_flowtype.py | 293 > ++++++++++++++++++++++++++++++++++++ > 1 file changed, 293 insertions(+) > create mode 100644 tests/TestSuite_dynamic_flowtype.py >=20 > diff --git a/tests/TestSuite_dynamic_flowtype.py > b/tests/TestSuite_dynamic_flowtype.py > new file mode 100644 > index 0000000..98baa31 > --- /dev/null > +++ b/tests/TestSuite_dynamic_flowtype.py > @@ -0,0 +1,293 @@ > +# > + > +import time > +import re > +import sys > +import utils > +from qemu_kvm import QEMUKvm Please remove useless import. > +from test_case import TestCase > +from pmd_output import PmdOutput > +from settings import get_nic_name Please remove useless import. > +import random > + > +VM_CORES_MASK =3D 'all' > + > + > +class TestDynamic_Flowtype(TestCase): Please change the name to TestDynamicFlowtype. > + > + def set_up_all(self): > + self.verify(self.nic in ['fortville_25g'], > + 'dynamic flow type mapping can not support %s nic' > + % self.nic) > + ports =3D self.dut.get_ports() > + self.verify(len(ports) >=3D 1, "Insufficient ports for testing") > + valports =3D [_ for _ in ports if self.tester.get_local_port(_) = !=3D > -1] > + self.dut_port =3D valports[0] > + tester_port =3D self.tester.get_local_port(self.dut_port) > + self.tester_intf =3D self.tester.get_interface(tester_port) > + profile_file =3D 'dep/gtp.pkgo' > + profile_dst =3D "/tmp/" > + self.dut.session.copy_file_to(profile_file, profile_dst) > + PF_Q_strip =3D 'CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF' > + self.PF_QUEUE =3D self.search_queue_number(PF_Q_strip) > + > + def set_up(self): > + """ > + Run before each test case. > + """ > + self.dut_testpmd =3D PmdOutput(self.dut) > + self.dut_testpmd.start_testpmd( > + "Default", "--port-topology=3Dchained --txq=3D%s --rxq=3D%s" > + % (self.PF_QUEUE, self.PF_QUEUE)) > + self.load_profile() > + > + def search_queue_number(self, Q_strip): > + """ > + Search max queue number from configuration. > + """ > + out =3D self.dut.send_expect("cat config/common_base", "]# ", 10= ) > + pattern =3D "(%s=3D)(\d*)" % Q_strip > + s =3D re.compile(pattern) > + res =3D s.search(out) > + if res is None: > + print utils.RED('Search no queue number.') > + return None > + else: > + queue =3D res.group(2) > + return int(queue) > + > + def load_profile(self): > + """ > + Load profile to update FVL configuration tables, profile will be > + stored in binary file and need to be passed to AQ to program FVL > + during initialization stage. > + """ > + self.dut_testpmd.execute_cmd('port stop all') > + time.sleep(1) > + out =3D self.dut_testpmd.execute_cmd('ddp get list 0') > + self.dut_testpmd.execute_cmd('ddp add 0 /tmp/gtp.pkgo') > + out =3D self.dut_testpmd.execute_cmd('ddp get list 0') > + self.verify("Profile number is: 1" in out, > + "Failed to load ddp profile!!!") > + self.dut_testpmd.execute_cmd('port start all') > + time.sleep(1) > + self.dut_testpmd.execute_cmd('set fwd rxonly') > + self.dut_testpmd.execute_cmd('set verbose 1') > + self.dut_testpmd.execute_cmd('start') > + > + def gtp_packets(self, flowtype=3D26, match_opt=3D'matched'): > + """ > + Generate different GTP types according to different parameters. > + I40e PCTYPEs are statically mapped to RTE_ETH_FLOW_* types in > + DPDK, defined in rte_eth_ctrl.h, and flow types used to define > + ETH_RSS_* offload types in rte_ethdev.h. RTE_ETH_FLOW_MAX is > + defined now as 22, leaves 42 flow type unassigned. > + Input: > + flowtype: define flow type 26, 23, 24, 25 for GTP types as below > + table, check each layer type, tunnel packet includes > + GTPC and GTPU, GTPC has none inner L3, GTPU has none, > + IPV4 and IPV6 inner L3. > + match_opt: PF or VSIs receive match packets to rss queue, but > + receive not match packets to queue 0. > + > + +------------+------------+------------+ > + |Packet Type | PCTYPEs | Flow Types | > + +------------+------------+------------+ > + |GTP-U IPv4 | 22 | 26 | > + +------------+------ -----+------------+ > + |GTP-U IPv6 | 23 | 23 | > + +------------+------------+------------+ > + |GTP-U PAY4 | 24 | 24 | > + +------------+------------+------------+ > + |GTP-C PAY4 | 25 | 25 | > + +------------+------------+------------+ > + > + """ > + pkts =3D [] > + pkts_ipv4 =3D {'IPV4': 'Ether()/IP()/Raw("X"*20)'} > + > + pkts_gtpc_pay =3D {'IPV4/GTPC': > 'Ether()/IP()/UDP(dport=3D2123)/GTP_U_Header()/Raw("X"*20)', > + 'IPV6/GTPC': > 'Ether()/IPv6()/UDP(dport=3D2123)/GTP_U_Header()/Raw("X"*20)'} > + > + pkts_gtpu_pay =3D {'IPV4/GTPU': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/Raw("X"*20)', > + 'IPV6/GTPU': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/Raw("X"*20)'} > + > + pkts_gtpu_ipv4 =3D {'IPV4/GTPU/IPV4': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IP()/Raw("X"*20)', > + 'IPV4/GTPU/IPV4/FRAG': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IP(frag=3D5)/Raw("X"*20)', > + 'IPV4/GTPU/IPV4/UDP': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IP()/UDP()/Raw("X"*20)', > + 'IPV4/GTPU/IPV4/TCP': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IP()/TCP()/Raw("X"*20)', > + 'IPV4/GTPU/IPV4/SCTP': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IP()/SCTP()/Raw("X"*20)', > + 'IPV4/GTPU/IPV4/ICMP': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IP()/ICMP()/Raw("X"*20)', > + 'IPV6/GTPU/IPV4': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IP()/Raw("X"*20)', > + 'IPV6/GTPU/IPV4/FRAG': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IP(frag=3D5)/Raw("X"*20)= ', > + 'IPV6/GTPU/IPV4/UDP': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IP()/UDP()/Raw("X"*20)', > + 'IPV6/GTPU/IPV4/TCP': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IP()/TCP()/Raw("X"*20)', > + 'IPV6/GTPU/IPV4/SCTP': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IP()/SCTP()/Raw("X"*20)'= , > + 'IPV6/GTPU/IPV4/ICMP': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IP()/ICMP()/Raw("X"*20)'= } > + > + pkts_gtpu_ipv6 =3D {'IPV4/GTPU/IPV6/FRAG': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IPv6()/IPv6ExtHdrFragment(= )/R > aw("X"*20)', > + 'IPV4/GTPU/IPV6': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IPv6()/Raw("X"*20)', > + 'IPV4/GTPU/IPV6/UDP': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IPv6()/UDP()/Raw("X"*20)', > + 'IPV4/GTPU/IPV6/TCP': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IPv6()/TCP()/Raw("X"*20)', > + 'IPV4/GTPU/IPV6/SCTP': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IPv6()/SCTP()/Raw("X"*20)'= , > + 'IPV4/GTPU/IPV6/ICMP': > 'Ether()/IP()/UDP(dport=3D2152)/GTP_U_Header()/IPv6(nh=3D58)/ICMP()/Raw("= X"*20 > )', > + 'IPV6/GTPU/IPV6/FRAG': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IPv6()/IPv6ExtHdrFragmen= t() > /Raw("X"*20)', > + 'IPV6/GTPU/IPV6': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IPv6()/Raw("X"*20)', > + 'IPV6/GTPU/IPV6/UDP': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IPv6()/UDP()/Raw("X"*20)= ', > + 'IPV6/GTPU/IPV6/TCP': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IPv6()/TCP()/Raw("X"*20)= ', > + 'IPV6/GTPU/IPV6/SCTP': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IPv6()/SCTP()/Raw("X"*20= )', > + 'IPV6/GTPU/IPV6/ICMP': > 'Ether()/IPv6()/UDP(dport=3D2152)/GTP_U_Header()/IPv6(nh=3D58)/ICMP()/Raw= ("X"* > 20)'} > + > + if match_opt =3D=3D 'matched': > + # Define flow type for IPV4 as 2 in rte_eth_ctrl.h > + if flowtype =3D=3D 2: > + pkts =3D pkts_ipv4 > + if flowtype =3D=3D 23: > + pkts =3D pkts_gtpu_ipv6 > + if flowtype =3D=3D 24: > + pkts =3D pkts_gtpu_pay > + if flowtype =3D=3D 25: > + pkts =3D pkts_gtpc_pay > + if flowtype =3D=3D 26: > + pkts =3D pkts_gtpu_ipv4 > + > + if match_opt =3D=3D 'not matched': > + if flowtype =3D=3D 23: > + pkts =3D dict(pkts_gtpc_pay.items() + > + pkts_gtpu_pay.items() + > + pkts_gtpu_ipv4.items()) > + if flowtype =3D=3D 24: > + pkts =3D dict(pkts_gtpc_pay.items() + > + pkts_gtpu_ipv4.items() + > + pkts_gtpu_ipv6.items()) > + if flowtype =3D=3D 25: > + pkts =3D dict(pkts_gtpu_pay.items() + > + pkts_gtpu_ipv4.items() + > + pkts_gtpu_ipv6.items()) > + if flowtype =3D=3D 26: > + pkts =3D dict(pkts_gtpc_pay.items() + > + pkts_gtpu_pay.items() + > + pkts_gtpu_ipv6.items()) > + > + return pkts > + > + def packet_send_verify(self, flowtype=3D26, match_opt=3D'matched'): > + """ > + Send packet and verify rss function. > + """ > + pkts =3D self.gtp_packets(flowtype, match_opt) > + for packet_type in pkts.keys(): > + self.tester.scapy_append( > + 'sendp([%s], iface=3D"%s")' > + % (pkts[packet_type], self.tester_intf)) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D2) > + if match_opt =3D=3D 'matched': > + self.verify("port 0/queue 0" not in out, > + "Failed to receive packet in rss queue!!!") > + self.verify("PKT_RX_RSS_HASH" in out, > + "Failed to receive packet in rss queue!!!") > + elif match_opt =3D=3D 'not matched': > + self.verify("port 0/queue 0" in out, > + "Failed to receive packet in queue 0!!!") > + self.verify("PKT_RX_RSS_HASH" not in out, > + "Failed to receive packet in queue 0!!!") > + > + def dynamic_flowtype_test(self, pctype=3D22, flowtype=3D26, reset=3D= False): > + """ > + Dynamic modify, return or reset the contents of flow type to > pctype > + dynamic mapping, enable rss hash for new protocal. > + reset: If reset is true, reset the contents of flow type to > pctype > + mapping. If reset is false, enable rss hash for new > protocal. > + """ > + out =3D self.dut_testpmd.execute_cmd('show port 0 pctype mapping= ') > + self.verify("pctype: 63 -> flowtype: 14" in out, > + "Failed show flow type to pctype mapping!!!") > + self.verify("pctype: %s -> flowtype: %s" > + % (pctype, flowtype) not in out, > + "Failed show flow type to pctype mapping!!!") > + self.dut_testpmd.execute_cmd( > + 'port config 0 pctype mapping update %s %s' % (pctype, > flowtype)) > + out =3D self.dut_testpmd.execute_cmd('show port 0 pctype mapping= ') > + self.verify("pctype: %s -> flowtype: %s" > + % (pctype, flowtype) in out, > + "Failed update flow type to pctype mapping!!!") > + if reset is False: > + self.dut_testpmd.execute_cmd( > + 'set_hash_input_set 0 %s udp-key add' % flowtype) > + self.dut_testpmd.execute_cmd('port config all rss %s' % > flowtype) > + else: > + self.dut_testpmd.execute_cmd('port config 0 pctype mapping > reset') > + out =3D self.dut_testpmd.execute_cmd('show port 0 pctype > mapping') > + self.verify("pctype: %s -> flowtype: %s" > + % (pctype, flowtype) not in out, > + "Failed reset flow type to pctype mapping!!!") > + """ > + Send normal ipv4 packet to test rss, rte_eth_ctrl.h defines > flow > + type for IPV4 is 2. > + """ > + flowtype =3D 2 > + for match_opt in ['matched', 'not matched']: > + if match_opt =3D=3D 'not matched' and reset is True: > + break > + self.packet_send_verify(flowtype, match_opt) > + > + def test_profile_correctness(self): > + """ > + GTP is supported by NVM with profile updated. Check profile > + information correctness, includes used protocols, packet > + classification types, defined packet types and so on. > + """ > + out =3D self.dut_testpmd.execute_cmd('ddp get info /tmp/gtp.pkgo= ') > + self.verify("i40e Profile Version" in out, > + "Failed to verify profile version!!!") > + self.verify("List of used protocols" in out, > + "Failed to verify profie used protocols!!!") > + self.verify("List of defined packet classification types" in out= , > + "Failed to verify profile packet classification > types!!!") > + self.verify("List of defined packet types" in out, > + "Failed to verify profile packet types!!!") > + > + def test_dynamic_flowtype_reset(self): > + """ > + Dynamic modify, reset and return the contents of flow type to > pctype > + dynamic mapping. > + """ > + self.dynamic_flowtype_test(pctype=3D22, flowtype=3D26, reset=3DT= rue) > + > + def test_dynamic_flowtype_gtpu_ipv4(self): > + """ > + Dynamic modify, return the contents of flow type to pctype > dynamic > + mapping, enable and verify rss for GTP-U IPV4 packets. > + """ > + self.dynamic_flowtype_test(pctype=3D22, flowtype=3D26, reset=3DF= alse) > + > + def test_dynamic_flowtype_gtpu_ipv6(self): > + """ > + Dynamic modify, return the contents of flow type to pctype > dynamic > + mapping, enable and verify rss for GTP-U IPV6 packets. > + """ > + self.dynamic_flowtype_test(pctype=3D23, flowtype=3D23, reset=3DF= alse) > + > + def test_dynamic_flowtype_gtpu_pay(self): > + """ > + Dynamic modify, return the contents of flow type to pctype > dynamic > + mapping, enable and verify rss for GTP-U PAY packets. > + """ > + self.dynamic_flowtype_test(pctype=3D24, flowtype=3D24, reset=3DF= alse) > + > + def test_dynamic_flowtype_gtpc_pay(self): > + """ > + Dynamic modify, return the contents of flow type to pctype > dynamic > + mapping, enable and verify rss for GTP-C PAY packets. > + """ > + self.dynamic_flowtype_test(pctype=3D25, flowtype=3D25, reset=3DF= alse) > + > + def tear_down(self): > + if self.dut_testpmd: > + self.dut_testpmd.execute_cmd('write reg 0 0xb8190 1') > + self.dut_testpmd.execute_cmd('write reg 0 0xb8190 2') > + self.dut_testpmd.quit() > + > + def tear_down_all(self): > + self.dut.kill_all() > -- > 2.5.5