From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 7A2744C75 for ; Thu, 8 Mar 2018 10:32:26 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2018 01:32:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,440,1515484800"; d="scan'208";a="23920037" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga006.jf.intel.com with ESMTP; 08 Mar 2018 01:32:24 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 8 Mar 2018 01:32:24 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 8 Mar 2018 01:32:23 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.125]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0319.002; Thu, 8 Mar 2018 17:32:20 +0800 From: "Lin, Xueqin" To: "Liu, Yong" , "dts@dpdk.org" Thread-Topic: [dts] [dts PATCH v2]tests: add ddp gtp qregion test suite Thread-Index: AQHTtrWWdKOV2BnbLEqIdWusbCQ8pqPGCIOAgAAJNYA= Date: Thu, 8 Mar 2018 09:32:19 +0000 Message-ID: <0D300480287911409D9FF92C1FA2A3355B2B22DD@SHSMSX104.ccr.corp.intel.com> References: <1520475146-174873-1-git-send-email-xueqin.lin@intel.com> <5AA16A99.8090405@intel.com> In-Reply-To: <5AA16A99.8090405@intel.com> Accept-Language: zh-CN, 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] [dts PATCH v2]tests: add ddp gtp qregion 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: Thu, 08 Mar 2018 09:32:27 -0000 Thanks Marvin for review, reply as below. Best regards, Xueqin -----Original Message----- From: Liu, Yong=20 Sent: Friday, March 9, 2018 12:54 AM To: Lin, Xueqin ; dts@dpdk.org Subject: Re: [dts] [dts PATCH v2]tests: add ddp gtp qregion test suite Xueqin, One comment is inline. Thanks, Marvin On 03/08/2018 10:12 AM, Xueqin Lin wrote: > --- > tests/TestSuite_ddp_gtp_ipv6.py | 401 +++++++++++++++++++++++++++++++++= +++++++ > 1 file changed, 401 insertions(+) > create mode 100644 tests/TestSuite_ddp_gtp_ipv6.py > > diff --git a/tests/TestSuite_ddp_gtp_ipv6.py=20 > b/tests/TestSuite_ddp_gtp_ipv6.py new file mode 100644 index=20 > 0000000..0c642ed > --- /dev/null > +++ b/tests/TestSuite_ddp_gtp_ipv6.py > @@ -0,0 +1,401 @@ > +# > + > +import time > +import re > +import sys > +import utils > +from test_case import TestCase > +from pmd_output import PmdOutput > +from settings import get_nic_name > +import random > + > + > +class TestDdpGtpIpv6(TestCase): > + > + def set_up_all(self): > + self.verify(self.nic in ['fortville_25g'], 'ddp gtp ipv6 can not= \ > + support %s nic' % self.nic) > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > + profile_file =3D 'dep/gtp.pkgo' > + profile_dst =3D "/tmp/" > + self.dut.session.copy_file_to(profile_file, profile_dst) > + out =3D self.dut.send_expect("cat config/common_base", "]# ", 10= ) > + self.PF_Q_strip =3D 'CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF' > + pattern =3D "(%s=3D)(\d*)" % self.PF_Q_strip > + self.PF_QUEUE =3D self.element_strip(out, pattern) > + self.bind_nic_driver(self.dut_ports[:1], driver=3D"igb_uio") Is the device must bound to igb_uio driver? I will add check function for DUT driver, you can this dependency in check = list file. Yes, need to bind to igb_uio. Okay, I will modify it after your change merged. > + self.used_dut_port =3D self.dut_ports[0] > + tester_port =3D self.tester.get_local_port(self.used_dut_port) > + self.tester_intf =3D self.tester.get_interface(tester_port) > + self.dut_testpmd =3D PmdOutput(self.dut) > + > + def set_up(self): > + self.load_profile() > + self.flowtype_qregion_mapping() > + > + def element_strip(self, out, pattern): > + """ > + Strip and get queue number. > + """ > + s =3D re.compile(pattern) > + res =3D s.search(out) > + if res is None: > + print utils.RED('Search no queue number.') > + return None > + else: > + result =3D res.group(2) > + return int(result) > + > + def bind_nic_driver(self, ports, driver=3D""): > + if driver =3D=3D "igb_uio": > + for port in ports: > + netdev =3D self.dut.ports_info[port]['port'] > + driver =3D netdev.get_nic_driver() > + if driver !=3D 'igb_uio': > + netdev.bind_driver(driver=3D'igb_uio') > + else: > + for port in ports: > + netdev =3D self.dut.ports_info[port]['port'] > + driver_now =3D netdev.get_nic_driver() > + if driver =3D=3D "": > + driver =3D netdev.default_driver > + if driver !=3D driver_now: > + netdev.bind_driver(driver=3Ddriver) > + > + 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.start_testpmd( > + "Default", "--pkt-filter-mode=3Dperfect --port-topology=3Dch= ained \ > + --txq=3D%s --rxq=3D%s" > + % (self.PF_QUEUE, self.PF_QUEUE)) > + self.dut_testpmd.execute_cmd('port stop all') > + time.sleep(1) > + self.dut_testpmd.execute_cmd('ddp add 0 /tmp/gtp.pkgo,/tmp/gtp.b= ak') > + 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') > + > + def flowtype_qregion_mapping(self): > + """ > + Queue region, queue range and flow type mapping set according to > + mapping table. > + """ > + rg_ids =3D [0, 1, 2, 3] > + idx_ids =3D [1, 10, 30, 40] > + q_nums =3D [8, 16, 8, 16] > + flowtypes =3D [26, 23, 24, 25] > + for rg_id, idx_id, q_num in zip(rg_ids, idx_ids, q_nums): > + self.dut_testpmd.execute_cmd('set port 0 queue-region region= _id \ > + %d queue_start_index %d queue_num %d' % (rg_id, idx_id, = q_num)) > + for rg_id, flowtype in zip(rg_ids, flowtypes): > + self.dut_testpmd.execute_cmd('set port 0 queue-region region= _id \ > + %d flowtype %d' % (rg_id, flowtype)) > + self.dut_testpmd.execute_cmd('set port 0 queue-region flush=20 > + on') > + > + def gtp_pkts(self, flowtype, keyword, opt): > + """ > + Generate GTP packets. > + """ > + src_ip =3D "1.1.1.1" > + dst_ip =3D "2.2.2.2" > + src_ipv6 =3D "1001:0db8:85a3:0000:0000:8a2e:0370:0001" > + dst_ipv6 =3D "2001:0db8:85a3:0000:0000:8a2e:0370:0001" > + teid =3D hex(0xfe) > + sport =3D 100 > + dport =3D 200 > + if opt is not 'word_opt': > + if keyword is 'src_ip': > + src_ip =3D "1.1.1.2" > + if keyword is 'dst_ip': > + dst_ip =3D "2.2.2.3" > + if keyword is 'src_ipv6': > + src_ipv6 =3D "1001:0db8:85a3:0000:0000:8a2e:0370:0002" > + if keyword is 'dst_ipv6': > + dst_ipv6 =3D "2001:0db8:85a3:0000:0000:8a2e:0370:0002" > + if keyword is 'teid': > + teid =3D hex(0xff) > + if keyword is 'sport': > + sport =3D 101 > + if keyword is 'dport': > + dport =3D 201 > + > + if flowtype =3D=3D 23: > + pkts =3D {'IPV6/GTPU/IPV6/UDP': 'Ether()/IPv6()/UDP(dport=3D= 2152)/GTP_U_Header(teid=3D%s)/IPv6(src=3D"%s",dst=3D"%s")/UDP(sport=3D%d,dp= ort=3D%d)/Raw("X"*20)' > + % (teid, src_ipv6, dst_ipv6, sport, dport)} > + if flowtype =3D=3D 25: > + pkts =3D {'IPV6/GTPC': 'Ether()/IPv6(src=3D"%s",dst=3D"%s")/= UDP(dport=3D2123)/GTP_U_Header(teid=3D%s)/Raw("X"*20)' > + % (src_ipv6, dst_ipv6, teid)} > + if flowtype =3D=3D 26: > + pkts =3D {'IPV6/GTPU/IPV4/UDP': 'Ether()/IPv6()/UDP(dport=3D= 2152)/GTP_U_Header(teid=3D%s)/IP(src=3D"%s",dst=3D"%s")/UDP(sport=3D%d,dpor= t=3D%d)/Raw("X"*20)' > + % (teid, src_ip, dst_ip, sport, dport)} > + return pkts > + > + def send_and_verify(self, flowtype, qmin, qmax, keyword): > + """ > + Send packets and verify result. > + opt has below three scenarios: > + word_opt: check RSS could work when enable words for keyword. > + chgword_opt: change keyword value, e.g. check dst controls queue > + number, change dst then check pmd could receive pac= ket > + from different queue. > + notword_opt: change not keyword, e.g. check dst controls queue n= umber, > + change src then check pmd receives packet from same= queue. > + """ > + for opt in ['word_opt', 'chgword_opt', 'notword_opt']: > + if opt is 'notword_opt': > + if keyword is 'teid' or keyword is 'sport' or \ > + keyword is 'dport': > + break > + elif keyword =3D=3D 'src_ip': > + keyword =3D 'dst_ip' > + elif keyword =3D=3D 'dst_ip': > + keyword =3D 'src_ip' > + elif keyword =3D=3D 'src_ipv6': > + keyword =3D 'dst_ipv6' > + elif keyword =3D=3D 'dst_ipv6': > + keyword =3D 'src_ipv6' > + pkts =3D self.gtp_pkts(flowtype, keyword, 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) > + self.verify("PKT_RX_RSS_HASH" in out, "Failed to test RS= S!!!") > + pattern =3D "port (\d)/queue (\d{1,2}): received (\d) pa= ckets" > + qnum =3D self.element_strip(out, pattern) > + if opt is 'word_opt': > + crol_qnum =3D qnum > + layerparams =3D ['L3_', 'TUNNEL_', > + 'INNER_L3_', 'INNER_L4_'] > + ptypes =3D packet_type.split('/') > + endparams =3D ['_EXT_UNKNOWN', '', > + '_EXT_UNKNOWN', ''] > + for layerparam, ptype, endparam in zip( > + layerparams, ptypes, endparams): > + layer_type =3D layerparam + ptype + endparam > + self.verify( > + layer_type in out, > + "Failed to output ptype information!!!") > + self.verify(qnum <=3D qmax and qnum >=3D qmin, > + "Queue is not between this queue range!!!") > + if opt is 'chgword_opt': > + self.verify(qnum !=3D crol_qnum, > + "Failed to test rss if changing key word= s!!!") > + if opt is 'notword_opt': > + self.verify(qnum =3D=3D crol_qnum, > + "Failed to test rss if changing to other= key \ > + words!!!") > + > + def run_gtp_test(self, crlwords, flowtype, pctype, qmin, qmax, keywo= rd): > + """ > + Use dynamic flowtype/pctype mapping, queue region, dynamic chang= e > + control words to set hash input configuration for new protocol > + GTP RSS enabling, check keyword could control queue number in > + configured queue regon. > + crlwords: control words of keyword > + 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. > + pctype: profile defines below 22, 23, 24, 25 pctypes for GTP pac= ket > + types. > + qmin: design queue minimum value for the flowtype in queue regio= n. > + qmax: design queue maximum value for the flowtype in queue regio= n. > + keyword: keyword has teid, sport, dport, src, dst, etc. > + > + +-------------+------------+------------+--------------+--------= -----+ > + | Packet Type | PCTypes | Flow Types | Queue region | Queue r= ange | > + +-------------+------------+------------+--------------+--------= -----+ > + | GTP-U IPv4 | 22 | 26 | 0 | 1~8= | > + +-------------+------------+------------+--------------+--------= -----+ > + | GTP-U IPv6 | 23 | 23 | 1 | 10~= 25 | > + +-------------+------------+------------+--------------+--------= -----+ > + | GTP-U PAY4 | 24 | 24 | 2 | 30~= 37 | > + +-------------+------------+------------+--------------+--------= -----+ > + | GTP-C PAY4 | 25 | 25 | 3 | 40~= 55 | > + +-------------+------------+------------+--------------+--------= -----+ > + """ > + 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: 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, flowt= ype)) > + 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!!!") > + self.dut_testpmd.execute_cmd('port stop all') > + time.sleep(1) > + self.dut_testpmd.execute_cmd( > + 'port config 0 pctype %s hash_inset clear all' % pctype) > + for word in crlwords: > + self.dut_testpmd.execute_cmd( > + 'port config 0 pctype %s hash_inset set field %s' > + % (pctype, word)) > + self.dut_testpmd.execute_cmd('port start all') > + self.dut_testpmd.execute_cmd('port config all rss %s' % flowtype= ) > + self.dut_testpmd.execute_cmd('set fwd rxonly') > + self.dut_testpmd.execute_cmd('set verbose 1') > + self.dut_testpmd.execute_cmd('start') > + self.send_and_verify(flowtype, qmin, qmax, keyword) > + > + def test_outer_dst_contrl_gtpcq(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash= input > + set configuration for outer dst mac words 50~57, enable rss, che= ck > + outer dst could control queue, also queue number is between the = queue > + range(40,55). > + """ > + crlwords =3D range(50, 58) > + self.run_gtp_test(crlwords, 25, 25, 40, 55, "dst_ipv6") > + > + def test_teid_contrl_gtpcq(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash= input > + set configuration for teid words 44~45, enable rss, check teid c= ould > + control queue, also queue number is between the queue range(40,5= 5). > + """ > + crlwords =3D range(44, 46) > + self.run_gtp_test(crlwords, 25, 25, 40, 55, "teid") > + > + def test_teid_contrl_gtpu_ipv4q(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash > + input set configuration for teid words 44~45, enable rss, check = teid > + could control queue, also queue number is between the queue > + range(1,8). > + """ > + crlwords =3D range(44, 46) > + self.run_gtp_test(crlwords, 26, 22, 1, 8, "teid") > + > + def test_sport_contrl_gtpu_ipv4q(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash > + input set configuration for sport words 29~30, enable rss, check > + sport could control queue, also queue number is between the queu= e > + range(1,8). > + """ > + crlwords =3D range(29, 31) > + self.run_gtp_test(crlwords, 26, 22, 1, 8, "sport") > + > + def test_dport_contrl_gtpu_ipv4q(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash > + input set configuration for dport words 29~30, enable rss, check > + dport could control queue, also queue number is between the queu= e > + range(1,8). > + """ > + crlwords =3D range(29, 31) > + self.run_gtp_test(crlwords, 26, 22, 1, 8, "dport") > + > + def test_inner_src_contrl_gtpu_ipv4q(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash > + input set configuration for inner src words 15~16, enable rss, c= heck > + inner src could control queue, also queue number is between the > + queue range(1,8). > + """ > + crlwords =3D range(15, 17) > + self.run_gtp_test(crlwords, 26, 22, 1, 8, "src_ip") > + > + def test_inner_dst_contrl_gtpu_ipv4q(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash > + input set configuration for inner dst words 27~28, enable rss, c= heck > + inner dst could control queue, also queue number is between the = queue > + range(1,8). > + """ > + crlwords =3D range(27, 29) > + self.run_gtp_test(crlwords, 26, 22, 1, 8, "dst_ip") > + > + def test_teid_contrl_gtpu_ipv6q(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash > + input set configuration for teid words 44~45, enable rss, check = teid > + could control queue, also queue number is between the queue > + range(10,25). > + """ > + crlwords =3D range(44, 46) > + self.run_gtp_test(crlwords, 23, 23, 10, 25, "teid") > + > + def test_sport_contrl_gtpu_ipv6q(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash > + input set configuration for sport words 29~30, enable rss, check > + sport could control queue, also queue number is between the queu= e > + range(10,25). > + """ > + crlwords =3D range(29, 31) > + self.run_gtp_test(crlwords, 23, 23, 10, 25, "sport") > + > + def test_dport_contrl_gtpu_ipv6q(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash > + input set configuration for dport words 29~30, enable rss, check > + dport could control queue, also queue number is between the queu= e > + range(10,25). > + """ > + crlwords =3D range(29, 31) > + self.run_gtp_test(crlwords, 23, 23, 10, 25, "dport") > + > + def test_inner_src_contrl_gtpu_ipv6q(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash > + input set configuration for inner src words 13~20, enable rss, c= heck > + inner src could control queue, also queue number is between the = queue > + range(10,25). > + """ > + crlwords =3D range(13, 21) > + self.run_gtp_test(crlwords, 23, 23, 10, 25, "src_ipv6") > + > + def test_inner_dst_contrl_gtpu_ipv6q(self): > + """ > + GTP is supported by NVM with profile updated. Download profile t= hen > + set queue region/flowtype/pctype mapping, dynamic to change hash > + input set configuration for inner dst words 21~28, enable rss, c= heck > + inner dst could control queue, also queue number is between the = queue > + range(10,25). > + """ > + crlwords =3D range(21, 29) > + self.run_gtp_test(crlwords, 23, 23, 10, 25, "dst_ipv6") > + > + def tear_down(self): > + self.dut_testpmd.execute_cmd('stop') > + self.dut_testpmd.execute_cmd('set port 0 queue-region flush off'= ) > + out =3D self.dut_testpmd.execute_cmd('ddp get list 0') > + if "Profile number is: 0" not in out: > + self.dut_testpmd.execute_cmd('port stop all') > + time.sleep(1) > + self.dut_testpmd.execute_cmd('ddp del 0 /tmp/gtp.bak') > + out =3D self.dut_testpmd.execute_cmd('ddp get list 0') > + self.verify("Profile number is: 0" in out, > + "Failed to delete ddp profile!!!") > + self.dut_testpmd.execute_cmd('port start all') > + 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): > + pass