From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id F25A53772 for ; Wed, 27 Jul 2016 02:32:30 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 26 Jul 2016 17:32:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,427,1464678000"; d="scan'208";a="854170773" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 26 Jul 2016 17:32:30 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 26 Jul 2016 17:32:29 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 26 Jul 2016 17:32:28 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.116]) with mapi id 14.03.0248.002; Wed, 27 Jul 2016 08:32:25 +0800 From: "Liu, Yong" To: "Liu, Yong" , "Mo, YufengX" , "dts@dpdk.org" CC: "Mo, YufengX" Thread-Topic: [dts] [PATCH V2 2/2] Ipgre: upload automation testing script Thread-Index: AQHR5wD4xeNL/ZckmkavAC9ybkUn7aAqYEoQgAENTpA= Date: Wed, 27 Jul 2016 00:32:25 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E2226292B@SHSMSX103.ccr.corp.intel.com> References: <1469511903-30103-1-git-send-email-yufengx.mo@intel.com> <1469511903-30103-3-git-send-email-yufengx.mo@intel.com> <86228AFD5BCD8E4EBFD2B90117B5E81E222620AA@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <86228AFD5BCD8E4EBFD2B90117B5E81E222620AA@SHSMSX103.ccr.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzk3NjRmMjctOGZhMC00MmVjLTkzYTUtYjNjMDFjMzlmMzE4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkZYeEZCSWJwWXZ1VFVWWVR5Nk4rbEYwUWtyanFVa2poUVZLU0xoZVhSb009In0= x-ctpclassification: CTP_IC 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 V2 2/2] Ipgre: upload automation testing script 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: Wed, 27 Jul 2016 00:32:32 -0000 Hi Yufen, To calculate the checksum value, scapy can help on that.=20 The first step is to set chksum to None. Then call do_build function which = will return packet in character stream. The checksum value can be stripped from the character string. >>> p =3D Ether()/IP(chksum=3DNone)/UDP()/Raw('x'*20) >>> pkt_str =3D p.do_build() >>> hexstr(pkt_str[24]) '7c |' >>> hexstr(pkt_str[25]) 'ba .' >>> > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Liu, Yong > Sent: Tuesday, July 26, 2016 4:28 PM > To: Mo, YufengX; dts@dpdk.org > Cc: Mo, YufengX > Subject: Re: [dts] [PATCH V2 2/2] Ipgre: upload automation testing script >=20 > Thanks Yufen, one question for checksum offload case. In the test plan, > checksum offload case only check whether checksum error detected by NIC. > For the checksum value, the case not checked whether it's correct. It's > different from vxlan/nvgre case, what cause the difference? >=20 > > -----Original Message----- > > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Yufen Mo > > Sent: Tuesday, July 26, 2016 1:45 PM > > To: dts@dpdk.org > > Cc: Mo, YufengX > > Subject: [dts] [PATCH V2 2/2] Ipgre: upload automation testing script > > > > From: yufengmx > > > > Generic Routing Encapsulation (GRE) is a tunneling protocol developed b= y > > Cisco Systems that can encapsulate > > a wide variety of network layer protocols inside virtual point-to-point > > links over an Internet Protocol network. > > Fortville support GRE packet detecting, checksum computing and filterin= g. > > > > Signed-off-by: yufengmx > > --- > > test_plans/ipgre_test_plan.rst | 181 +++++++++++++++++++++++++ > > tests/TestSuite_ipgre.py | 295 > > +++++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 476 insertions(+) > > create mode 100644 test_plans/ipgre_test_plan.rst > > create mode 100644 tests/TestSuite_ipgre.py > > > > diff --git a/test_plans/ipgre_test_plan.rst > > b/test_plans/ipgre_test_plan.rst > > new file mode 100644 > > index 0000000..444efdf > > --- /dev/null > > +++ b/test_plans/ipgre_test_plan.rst > > @@ -0,0 +1,181 @@ > > +.. Copyright(c) 2010-2016 Intel Corporation > > + All rights reserved. > > + > > + Redistribution and use in source and binary forms, with or without > > + modification, are permitted provided that the following conditions > > + 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 > > + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > > + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > > + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > > + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > > + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > > + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > > + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > > + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > > + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > > + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED > > + OF THE POSSIBILITY OF SUCH DAMAGE. > > + > > + > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > +Generic Routing Encapsulation (GRE) > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > + > > +Generic Routing Encapsulation (GRE) is a tunneling protocol developed > by > > Cisco Systems that can encapsulate a wide variety of network layer > > protocols inside virtual point-to-point links over an Internet Protocol > > network. > > +Fortville support GRE packet detecting, checksum computing and > filtering. > > + > > +Prerequisites > > +------------- > > + > > +Fortville nic should be on the DUT. > > + > > +Test cases > > +---------- > > + > > +Test Case 1: GRE ipv4 packet detect > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > +Start testpmd and enable rxonly forwarding mode:: > > + testpmd -c ffff -n 4 -- -i --txqflags=3D0x0 > > + testpmd> set fwd rxonly > > + testpmd> set verbose 1 > > + testpmd> start > > + > > +Send packet as table listed and packet type match each layer. > > + > > ++------------+----------+-----------+----------+-----------+ > > +| Outer Vlan | Outer IP | Tunel | Inner L3 | Inner L4 | > > ++------------+----------+-----------+----------+-----------+ > > +| No | Ipv4 | GRE | Ipv4 | Udp | > > ++------------+----------+-----------+----------+-----------+ > > +| No | Ipv4 | GRE | Ipv4 | Tcp | > > ++------------+----------+-----------+----------+-----------+ > > +| No | Ipv4 | GRE | Ipv4 | Sctp | > > ++------------+----------+-----------+----------+-----------+ > > +| Yes | Ipv4 | GRE | Ipv4 | Udp | > > ++------------+----------+-----------+----------+-----------+ > > +| Yes | Ipv4 | GRE | Ipv4 | Tcp | > > ++------------+----------+-----------+----------+-----------+ > > +| Yes | Ipv4 | GRE | Ipv4 | Sctp | > > ++------------+----------+-----------+----------+-----------+ > > + > > + > > +Test Case 2: GRE ipv6 packet detect > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > +Start testpmd and enable rxonly forwarding mode:: > > + testpmd -c ffff -n 4 -- -i --txqflags=3D0x0 > > + testpmd> set fwd rxonly > > + testpmd> set verbose 1 > > + testpmd> start > > + > > +Send packet as table listed and packet type match each layer. > > +Ether()/IPv6(nh=3D47)/GRE()/IP()/UDP()/Raw('x'*40) > > +Ether()/IPv6(nh=3D47)/GRE(proto=3D0x86dd)/IPv6()/UDP()/Raw('x'*40) > > ++------------+----------+-----------+----------+-----------+ > > +| Outer Vlan | Outer IP | Tunel | Inner L3 | Inner L4 | > > ++------------+----------+-----------+----------+-----------+ > > +| No | Ipv6 | GRE | Ipv4 | Udp | > > ++------------+----------+-----------+----------+-----------+ > > +| No | Ipv6 | GRE | Ipv4 | Tcp | > > ++------------+----------+-----------+----------+-----------+ > > +| No | Ipv6 | GRE | Ipv4 | Sctp | > > ++------------+----------+-----------+----------+-----------+ > > +| Yes | Ipv6 | GRE | Ipv4 | Udp | > > ++------------+----------+-----------+----------+-----------+ > > +| Yes | Ipv6 | GRE | Ipv4 | Tcp | > > ++------------+----------+-----------+----------+-----------+ > > +| Yes | Ipv6 | GRE | Ipv4 | Sctp | > > ++------------+----------+-----------+----------+-----------+ > > + > > ++------------+----------+-----------+----------+-----------+ > > +| Outer Vlan | Outer IP | Tunel | Inner L3 | Inner L4 | > > ++------------+----------+-----------+----------+-----------+ > > +| No | Ipv6 | GRE | Ipv6 | Udp | > > ++------------+----------+-----------+----------+-----------+ > > +| No | Ipv6 | GRE | Ipv6 | Tcp | > > ++------------+----------+-----------+----------+-----------+ > > +| No | Ipv6 | GRE | Ipv6 | Sctp | > > ++------------+----------+-----------+----------+-----------+ > > +| Yes | Ipv6 | GRE | Ipv6 | Udp | > > ++------------+----------+-----------+----------+-----------+ > > +| Yes | Ipv6 | GRE | Ipv6 | Tcp | > > ++------------+----------+-----------+----------+-----------+ > > +| Yes | Ipv6 | GRE | Ipv6 | Sctp | > > ++------------+----------+-----------+----------+-----------+ > > + > > +Test Case 3: GRE packet filter > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > +Start testpmd with multi queues:: > > + testpmd -c ff -n 3 -- -i --rxq=3D4 --txq=3D4 --txqflags=3D0x0 > > + testpmd> set fwd rxonly > > + testpmd> set nbcore 4 > > + testpmd> set verbose 1 > > + testpmd> start > > + > > +Add GRE filter that forward inner ip address 0.0.0.0 to queue 3 > > + testpmd> tunnel_filter add 0 XX:XX:XX:XX:XX:XX YY:YY:YY:YY:YY:YY \ > > + 0.0.0.0 1 ipingre iip 0 3 > > + > > +Send packet inner ip address matched and check packet recevied by queu= e > 3. > > + p =3D Ether()/IP()/GRE()/IP(dst=3D"0.0.0.0")/UDP() > > + > > +Remove tunnel filter and check same packet recevied by queue 0 > > + testpmd> tunnel_filter rm 0 XX:XX:XX:XX:XX:XX YY:YY:YY:YY:YY:YY \ > > + 0.0.0.0 1 ipingre iip 0 3 > > + > > +Add GRE filter that forward outer ip address 0.0.0.0 to queue 3 > > + testpmd> tunnel_filter add 0 XX:XX:XX:XX:XX:XX YY:YY:YY:YY:YY:YY \ > > + 0.0.0.0 1 ipingre oip 0 3 > > + > > +Send packet outer ip address matched and check packet recevied by queu= e > 3. > > + > > +Remove tunnel filter and check same packet recevied by queue 0. > > + testpmd> tunnel_filter rm 0 XX:XX:XX:XX:XX:XX YY:YY:YY:YY:YY:YY \ > > + 0.0.0.0 1 ipingre iip 0 3 > > + > > +Test Case 4: GRE packet chksum offload > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > +Start testpmd with hardware checksum offload enabled:: > > + testpmd -c ff -n 3 -- -i --txqflags=3D0x0 --enable-rx-cksum --por= t- > > topology=3Dloop > > + testpmd> set verbose 1 > > + testpmd> set fwd csum > > + testpmd> csum set ip hw 0 > > + testpmd> csum set udp hw 0 > > + testpmd> csum set sctp hw 0 > > + testpmd> csum set outer-ip hw 0 > > + testpmd> csum set tcp hw 0 > > + testpmd> csum parse_tunnel on 0 > > + testpmd> start > > + > > +Send packet with wrong outer IP checksum and check forwarded packet IP > > +checksum is correct. > > + Ether()/IP(chksum=3D0x0)/GRE()/IP()/TCP() > > + > > +Send packet with wrong inner IP checksum and check forwarded packet IP > > +checksum is correct. > > + Ether()/IP()/GRE()/IP(chksum=3D0x0)/TCP() > > + > > +Send packet with wrong inner TCP checksum and check forwarded packet > TCP > > +checksum is correct. > > + Ether()/IP()/GRE()/IP()/TCP(chksum=3D0x0) > > + > > +Send packet with wrong inner UDP checksum and check forwarded packet > UDP > > +checksum is correct. > > + Ether()/IP()/GRE()/IP()/UDP(chksum=3D0xffff) > > + > > +Send packet with wrong inner SCTP checksum and check forwarded packet > > SCTP > > +checksum is correct. > > + Ether()/IP()/GRE()/IP()/SCTP(chksum=3D0x0) > > diff --git a/tests/TestSuite_ipgre.py b/tests/TestSuite_ipgre.py > > new file mode 100644 > > index 0000000..a628f59 > > --- /dev/null > > +++ b/tests/TestSuite_ipgre.py > > @@ -0,0 +1,295 @@ > > +# BSD LICENSE > > +# > > +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. > > +# All rights reserved. > > +# > > +# Redistribution and use in source and binary forms, with or without > > +# modification, are permitted provided that the following conditions > > +# 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 copyrigh= t > > +# 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 > > +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > > +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FO= R > > +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > > +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL= , > > +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > > +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE= , > > +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON AN= Y > > +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > > +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE US= E > > +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > + > > +""" > > +DPDK Test suite. > > + > > +Generic Routing Encapsulation (GRE) is a tunneling protocol developed > by > > +Cisco Systems that can encapsulate a wide variety of network layer > > protocols > > +inside virtual point-to-point links over an Internet Protocol network. > > + > > +Fortville support GRE packet detecting, checksum computing and > filtering. > > +""" > > + > > +import time > > +import os > > + > > +import dts > > +from test_case import TestCase > > +from exception import VerifyFailure > > +from packet import Packet > > + > > +class TestIpgre(TestCase): > > + > > + def set_up_all(self): > > + """ > > + Run at the start of each test suite. > > + """ > > + self.printFlag =3D dts.debug_mode > > + self.src_mac =3D "11:22:33:44:55:66" > > + ports =3D self.dut.get_ports() > > + self.verify(self.nic.startswith("fortville"), > > + "GRE tunnel packet type only support by Fortville"= ) > > + self.verify(len(ports) >=3D 1, "Insufficient ports for testing= ") > > + valports =3D [_ for _ in ports if > self.tester.get_local_port(_) !=3D > > -1] > > + # start testpmd > > + self.dut_port =3D valports[0] > > + tester_port =3D self.tester.get_local_port(self.dut_port) > > + self.tester_iface =3D self.tester.get_interface(tester_port) > > + self.tester_iface_mac =3D self.tester.get_mac(tester_port) > > + > > + def set_up(self): > > + """ > > + Run before each test case. > > + Nothing to do. > > + """ > > + pass > > + > > + def check_packet_transmission(self, pkt_types, layer_configs=3DNon= e): > > + time.sleep(1) > > + for pkt_type in pkt_types.keys(): > > + pkt_names =3D pkt_types[pkt_type] > > + pkt =3D Packet(pkt_type=3Dpkt_type) > > + if layer_configs: > > + for layer in layer_configs.keys(): > > + pkt.config_layer(layer, layer_configs[layer]) > > + pkt.send_pkt(tx_port=3Dself.tester_iface) > > + out =3D self.dut.get_session_output(timeout=3D2) > > + if self.printFlag: # debug output > > + print out > > + for pkt_layer_name in pkt_names: > > + if self.printFlag:# debug output > > + print pkt_layer_name > > + if pkt_layer_name not in out: > > + print dts.RED("Fail to detect %s" % pkt_layer_name= ) > > + if not self.printFlag: > > + raise VerifyFailure("Failed to detect %s" % > > pkt_layer_name) > > + else: > > + print dts.GREEN("Detected %s successfully" % pkt_type) > > + time.sleep(1) > > + > > + def test_GRE_ipv4_packet_detect(self): > > + """ > > + Start testpmd and enable rxonly forwarding mode > > + Send packet as table listed and packet type match each layer > > + """ > > + pkt_types =3D { > > + "MAC_IP_GRE_IP_UDP_PKT": ["Tunnel type: GRENAT", > > "Inner L4 type: UDP"], > > + "MAC_IP_GRE_IP_TCP_PKT": ["Tunnel type: GRENAT", > > "Inner L4 type: TCP"], > > + "MAC_IP_GRE_IP_SCTP_PKT": ["Tunnel type: GRENAT", > > "Inner L4 type: SCTP"], > > + "MAC_VLAN_IP_GRE_IP_UDP_PKT": ["Tunnel type: GRENAT", > > "Inner L4 type: UDP"], > > + "MAC_VLAN_IP_GRE_IP_TCP_PKT": ["Tunnel type: GRENAT", > > "Inner L4 type: TCP"], > > + "MAC_VLAN_IP_GRE_IP_SCTP_PKT": ["Tunnel type: GRENAT", > > "Inner L4 type: SCTP"] > > + } > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'ipv4': {'proto': 'gre'}} > > + # Start testpmd and enable rxonly forwarding mode > > + testpmd_cmd =3D "./%s/app/testpmd -c ffff -n 4 -- -i --enable-= rx- > > cksum --enable-rx-cksum" % self.target > > + self.dut.send_expect( testpmd_cmd, > > + "testpmd>", > > + 20) > > + self.dut.send_expect("set fwd rxonly", "testpmd>") > > + self.dut.send_expect("set verbose 1", "testpmd>") > > + self.dut.send_expect("start", "testpmd>") > > + > > + self.check_packet_transmission(pkt_types, config_layers) > > + > > + self.dut.send_expect("quit", "#") > > + > > + def test_GRE_ipv6_packet_detect(self): > > + """ > > + Start testpmd and enable rxonly forwarding mode > > + Send packet as table listed and packet type match each layer > > + """ > > + pkt_types_ipv6_ip =3D { > > + "MAC_IPv6_GRE_IP_UDP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: UDP"], > > + "MAC_IPv6_GRE_IP_TCP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: TCP"], > > + "MAC_IPv6_GRE_IP_SCTP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: SCTP"], > > + "MAC_VLAN_IPv6_GRE_IP_UDP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: UDP", "PKT_RX_VLAN_PKT"], > > + "MAC_VLAN_IPv6_GRE_IP_TCP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: TCP", "PKT_RX_VLAN_PKT"], > > + "MAC_VLAN_IPv6_GRE_IP_SCTP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: SCTP", "PKT_RX_VLAN_PKT"] > > + } > > + > > + pkt_types_ipv6_ipv6 =3D { > > + "MAC_IPv6_GRE_IPv6_UDP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: UDP"], > > + "MAC_IPv6_GRE_IPv6_TCP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: TCP"], > > + "MAC_VLAN_IPv6_GRE_IPv6_UDP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: UDP", "PKT_RX_VLAN_PKT"], > > + "MAC_VLAN_IPv6_GRE_IPv6_TCP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: TCP", "PKT_RX_VLAN_PKT"] > > + } > > + > > + pkt_types_ipv6_ipv6_SCTP =3D { > > + "MAC_IPv6_GRE_IPv6-TUNNEL_SCTP_PKT": ["Tunnel type: > > GRENAT", "Inner L4 type: SCTP"], > > + "MAC_VLAN_IPv6_GRE_IPv6-TUNNEL_SCTP_PKT": ["Tunnel type: > > GRENAT", "Inner L4 type: SCTP", "PKT_RX_VLAN_PKT"] > > + } > > + > > + # Start testpmd and enable rxonly forwarding mode > > + testpmd_cmd =3D "./%s/app/testpmd -c ffff -n 4 -- -i --enable-= rx- > > cksum" % self.target > > + self.dut.send_expect(testpmd_cmd, "testpmd>", 20) > > + self.dut.send_expect("set fwd rxonly", "testpmd>") > > + self.dut.send_expect("set verbose 1", "testpmd>") > > + self.dut.send_expect("start", "testpmd>") > > + > > + # inner ipv4 > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'ipv6': {'nh': 47}, > > + 'raw': {'payload':['78']*40}} > > + self.check_packet_transmission(pkt_types_ipv6_ip, config_layer= s) > > + > > + # inner ipv6 > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'ipv6': {'nh': 47}, > > + 'gre': {'proto': 0x86dd}, > > + 'raw': {'payload':['78']*40}} > > + self.check_packet_transmission(pkt_types_ipv6_ipv6, > config_layers) > > + > > + # inner ipv6 SCTP > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'ipv6': {'nh': 47}, > > + 'gre': {'proto': 0x86dd}, > > + 'inner_ipv6': {'nh': 132}, > > + 'raw': {'payload':['78']*40}} > > + self.check_packet_transmission(pkt_types_ipv6_ipv6_SCTP, > > config_layers) > > + self.dut.send_expect("quit", "#") > > + > > + def test_GRE_packet_filter(self): > > + """ > > + Start testpmd with multi queues, add GRE filter that forward > > + inner/outer ip address 0.0.0.0 to queue 3, Send packet inner > > + ip address matched and check packet recevied by queue 3 > > + """ > > + outer_mac =3D self.tester_iface_mac > > + inner_mac =3D "10:00:00:00:00:00" > > + > > + # Start testpmd with multi queues > > + testpmd_cmd =3D "./%s/app/testpmd -c ff -n 3 -- -i --enable-rx= - > > cksum --rxq=3D4 --txq=3D4" % self.target > > + self.dut.send_expect(testpmd_cmd, "testpmd>", 20) > > + self.dut.send_expect("set fwd rxonly", "testpmd>") > > + self.dut.send_expect("set nbcore 4", "testpmd>") > > + self.dut.send_expect("set verbose 1", "testpmd>") > > + self.dut.send_expect("start", "testpmd>") > > + > > + # Add GRE filter that forward inner ip address 0.0.0.0 to queu= e > 3 > > + cmd =3D "tunnel_filter add 0 %s %s 0.0.0.0 1 ipingre iip 0 > > 3"%(outer_mac, inner_mac) > > + self.dut.send_expect( cmd, "testpmd>") > > + > > + # Send packet inner ip address matched and check packet > recevied > > by queue 3 > > + pkt_types =3D {"MAC_IP_GRE_IP_UDP_PKT": ["Tunnel type: GRENAT= ", > > "Inner L4 type: UDP"]} > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'ipv4': {'dst': "0.0.0.0", 'proto': 'gre'}} > > + self.check_packet_transmission(pkt_types, config_layers) > > + > > + # Remove tunnel filter and check same packet recevied by queue > 0 > > + cmd =3D "tunnel_filter rm 0 %s %s 0.0.0.0 1 ipingre iip 0 > > 3"%(outer_mac, inner_mac) > > + self.dut.send_expect( cmd, "testpmd>") > > + > > + # Add GRE filter that forward outer ip address 0.0.0.0 to queu= e > 3 > > + cmd =3D "tunnel_filter add 0 %s %s 0.0.0.0 1 ipingre oip 0 > > 3"%(outer_mac, inner_mac) > > + self.dut.send_expect( cmd, "testpmd>") > > + > > + # Send packet outer ip address matched and check packet > recevied > > by queue 3. > > + pkt_types =3D {"MAC_IP_GRE_IP_UDP_PKT": ["Tunnel type: GRENAT"= , > > "Inner L4 type: UDP"]} > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'ipv4': {'dst': "0.0.0.0", 'proto': 'gre'}} > > + self.check_packet_transmission(pkt_types, config_layers) > > + > > + # Add GRE filter that forward outer ip address 0.0.0.0 to queu= e > 3 > > + cmd =3D "tunnel_filter rm 0 %s %s 0.0.0.0 1 ipingre iip 0 > > 3"%(outer_mac, inner_mac) > > + self.dut.send_expect( cmd, "testpmd>") > > + time.sleep(2) > > + self.dut.send_expect("quit", "#") > > + > > + def test_GRE_packet_chksum_offload(self): > > + """ > > + Start testpmd with hardware checksum offload enabled, > > + Send packet with wrong IP/TCP/UDP/SCTP checksum and check > > forwarded packet checksum > > + """ > > + # Start testpmd and enable rxonly forwarding mode > > + testpmd_cmd =3D "./%s/app/testpmd -c ff -n 3 -- -i --enable-rx= - > > cksum --txqflags=3D0x0 --port-topology=3Dloop" % self.target > > + self.dut.send_expect(testpmd_cmd, "testpmd>", 20) > > + self.dut.send_expect("set verbose 1", "testpmd>") > > + self.dut.send_expect("set fwd csum", "testpmd>") > > + self.dut.send_expect("csum set ip hw 0", "testpmd>") > > + self.dut.send_expect("csum set udp hw 0", "testpmd>") > > + self.dut.send_expect("csum set sctp hw 0", "testpmd>") > > + self.dut.send_expect("csum set outer-ip hw 0", "testpmd>") > > + self.dut.send_expect("csum set tcp hw 0", "testpmd>") > > + self.dut.send_expect("csum parse_tunnel on 0", "testpmd>") > > + self.dut.send_expect("start", "testpmd>") > > + > > + # Send packet with wrong outer IP checksum and check forwarded > > packet IP checksum is correct > > + pkt_types =3D { "MAC_IP_GRE_IP_TCP_PKT": > ["PKT_TX_OUTER_IP_CKSUM"]} > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'ipv4': {'chksum': 0x0, 'proto': 'gre'}} > > + self.check_packet_transmission(pkt_types, config_layers) > > + > > + # Send packet with wrong inner IP checksum and check forwarded > > packet IP checksum is correct > > + pkt_types =3D { "MAC_IP_GRE_IP_TCP_PKT": ["PKT_TX_IP_CKSUM"]} > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'inner_ipv4': {'chksum': 0x0, 'proto': 'gre'}= } > > + self.check_packet_transmission(pkt_types, config_layers) > > + > > + # Send packet with wrong inner TCP checksum and check forwarde= d > > packet TCP checksum is correct > > + pkt_types =3D { "MAC_IP_GRE_IP_TCP_PKT": ["PKT_TX_TCP_CKSUM"]} > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'tcp': {'chksum': 0x0}, > > + 'ipv4': {'proto': 'gre'}} > > + self.check_packet_transmission(pkt_types, config_layers) > > + > > + # Send packet with wrong inner UDP checksum and check forwarde= d > > packet UDP checksum is correct > > + pkt_types =3D { "MAC_IP_GRE_IP_UDP_PKT": ["PKT_TX_UDP_CKSUM"]} > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'udp': {'chksum': 0xffff}, > > + 'ipv4': {'proto': 'gre'}} > > + self.check_packet_transmission(pkt_types, config_layers) > > + > > + # Send packet with wrong inner SCTP checksum and check > forwarded > > packet SCTP checksum is correct > > + pkt_types =3D { "MAC_IP_GRE_IP_SCTP_PKT": ["PKT_TX_SCTP_CKSUM"= ]} > > + config_layers =3D {'ether': {'src': self.src_mac}, > > + 'ipv4': {'proto': 'gre'}, > > + 'sctp': {'chksum': 0x0}} > > + self.check_packet_transmission(pkt_types , config_layers) > > + > > + self.dut.send_expect("quit", "#") > > + > > + def tear_down(self): > > + """ > > + Run after each test case. > > + Nothing to do. > > + """ > > + pass > > + > > + def tear_down_all(self): > > + """ > > + Run after each test suite. > > + Nothing to do. > > + """ > > + self.dut.kill_all() > > + pass > > -- > > 1.9.3