From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 2C845330D for ; Thu, 4 May 2017 05:23:37 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2017 20:23:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,286,1491289200"; d="scan'208";a="256670828" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 03 May 2017 20:23:36 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 3 May 2017 20:23:36 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 3 May 2017 20:23:36 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0319.002; Thu, 4 May 2017 11:23:34 +0800 From: "Liu, Yong" To: "Lin, Xueqin" , "dts@dpdk.org" CC: "Lin, Xueqin" Thread-Topic: [dts] [PATCH] TX preparation test suite Thread-Index: AQHSjarOvXuehw2FK0aBx0Y1Y8HuJqHj8D9g Date: Thu, 4 May 2017 03:23:33 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62DCA55F@SHSMSX103.ccr.corp.intel.com> References: <1487814933-7896-1-git-send-email-xueqin.lin@intel.com> In-Reply-To: <1487814933-7896-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: dlp-product: dlpe-windows dlp-version: 10.0.102.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] TX preparation 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, 04 May 2017 03:23:38 -0000 Thanks, applied. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xueqin Lin > Sent: Thursday, February 23, 2017 9:56 AM > To: dts@dpdk.org > Cc: Lin, Xueqin > Subject: [dts] [PATCH] TX preparation test suite >=20 > --- > tests/TestSuite_tx_preparation.py | 172 > ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 172 insertions(+) > create mode 100644 tests/TestSuite_tx_preparation.py >=20 > diff --git a/tests/TestSuite_tx_preparation.py > b/tests/TestSuite_tx_preparation.py > new file mode 100644 > index 0000000..3ea42d5 > --- /dev/null > +++ b/tests/TestSuite_tx_preparation.py > @@ -0,0 +1,172 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2010-2017 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 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. > + > + > + > +""" > +DPDK Test suite. > + > +Test tx preparation feature > + > +""" > + > +import os > +import time > +import dut > +from config import PortConf > +from test_case import TestCase > +from pmd_output import PmdOutput > +from settings import FOLDERS > +from packet import Packet > +# > +# > +# Test class. > +# > + > + > +class TestTX_preparation(TestCase): > + # > + # Test cases. > + # > + > + def set_up_all(self): > + """ > + Run at the start of each test suite. > + """ > + self.ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.ports) >=3D 1, "Insufficient number of port= s.") > + self.used_dut_port =3D self.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.tester.send_expect("ethtool -K %s rx off tx off tso off gso= \ > + off gro off lro off" %self.tester_intf, "#") > + > + 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") > + self.dmac =3D self.dut_testpmd.get_port_mac(0) > + self.dut_testpmd.execute_cmd('set fwd csum') > + self.dut_testpmd.execute_cmd('set verbose 1') > + > + def start_tcpdump(self, rxItf): > + > + self.tester.send_expect("rm -rf ./getPackageByTcpdump.cap", "#") > + self.tester.send_expect("tcpdump -Q in -i %s -n -e -vv -w\ > + ./getPackageByTcpdump.cap 2> /dev/null& " % rxItf, "#") > + > + def get_tcpdump_package(self): > + self.tester.send_expect("killall tcpdump", "#") > + return self.tester.send_expect( > + "tcpdump -nn -e -v -r ./getPackageByTcpdump.cap", "#") > + > + def send_packet_verify(self, tsoflag =3D 0): > + """ > + Send packet to portid and output > + """ > + pkts =3D {'IPv4/cksum TCP': 'Ether(dst=3D"%s")/IP()/TCP(flags=3D= 0x10)\ > + /Raw(RandString(50))' % self.dmac, > + 'IPv4/bad IP cksum': 'Ether(dst=3D"%s")/IP(chksum=3D0x12= 34)\ > + /TCP(flags=3D0x10)/Raw(RandString(50))' %self.dmac, > + 'IPv4/bad TCP cksum': > 'Ether(dst=3D"%s")/IP()/TCP(flags=3D0x10,\ > + chksum=3D0x1234)/Raw(RandString(50))' %self.dmac, > + 'IPv4/large pkt': 'Ether(dst=3D"%s")/IP()/TCP(flags=3D0x= 10)\ > + /Raw(RandString(1400))' %self.dmac, > + 'IPv4/bad cksum/large pkt': > 'Ether(dst=3D"%s")/IP(chksum=3D0x1234)\ > + /TCP(flags=3D0x10,chksum=3D0x1234)/Raw(RandString(14= 00))' > + %self.dmac, > + 'IPv6/cksum TCP': > 'Ether(dst=3D"%s")/IPv6()/TCP(flags=3D0x10)\ > + /Raw(RandString(50))' %self.dmac, > + 'IPv6/cksum UDP': 'Ether(dst=3D"%s")/IPv6()/UDP()\ > + /Raw(RandString(50))' %self.dmac, > + 'IPv6/bad TCP cksum': > 'Ether(dst=3D"%s")/IPv6()/TCP(flags=3D0x10,\ > + chksum=3D0x1234)/Raw(RandString(50))' %self.dmac, > + 'IPv6/large pkt': > 'Ether(dst=3D"%s")/IPv6()/TCP(flags=3D0x10)\ > + /Raw(RandString(1400))' %self.dmac } > + > + for packet_type in pkts.keys(): > + self.start_tcpdump(self.tester_intf) > + self.tester.scapy_append( > + 'sendp([%s], iface=3D"%s")' % (pkts[packet_type], > self.tester_intf)) > + self.tester.scapy_execute() > + out =3D self.get_tcpdump_package() > + if packet_type =3D=3D 'IPv6/cksum UDP': > + self.verify("udp sum ok" in out, > + "Failed to check UDP checksum correctness!!!") > + else : > + self.verify("cksum" in out, "Failed to check IP/TCP > checksum!!!") > + self.verify("correct" in out and "incorrect" not in out, > + "Failed to check IP/TCP/UDP checksum correctness!!!"= ) > + > + if tsoflag =3D=3D 1: > + if packet_type in\ > + ['IPv4/large pkt', 'IPv6/large pkt', 'IPv4/bad > cksum/large pkt']: > + self.verify("length 800" in out and "length 600" in > out, > + "Failed to verify TSO correctness for large > packets!!!") > + > + > + def test_tx_preparation_NonTSO(self): > + """ > + ftag functional test > + """ > + self.dut_testpmd.execute_cmd('tso set 0 0') > + self.dut_testpmd.execute_cmd('start') > + > + self.send_packet_verify() > + self.dut_testpmd.execute_cmd('stop') > + self.dut_testpmd.quit() > + > + def test_tx_preparation_TSO(self): > + """ > + ftag functional test > + """ > + self.dut_testpmd.execute_cmd('tso set 800 0') > + self.dut_testpmd.execute_cmd('start') > + > + self.send_packet_verify(1) > + self.dut_testpmd.execute_cmd('stop') > + self.dut_testpmd.quit() > + > + > + 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.5.5