From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 703799366 for ; Thu, 22 Oct 2015 04:41:31 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 21 Oct 2015 19:41:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,180,1444719600"; d="scan'208";a="799793848" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga001.jf.intel.com with ESMTP; 21 Oct 2015 19:41:29 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 21 Oct 2015 19:41:29 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 21 Oct 2015 19:41:28 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.96]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.106]) with mapi id 14.03.0248.002; Thu, 22 Oct 2015 10:41:26 +0800 From: "Qiu, Michael" To: "Ding, HengX" , "dts@dpdk.org" Thread-Topic: [dts] [PATCH] L3fwd: Add RFC2544 support and able to print loss packets in linerate now. Thread-Index: AQHRDG7g9wzkGnqrqU6uv/lSoJCHBg== Date: Thu, 22 Oct 2015 02:41:26 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E6028621B502EA@SHSMSX101.ccr.corp.intel.com> References: <1445479809-5459-1-git-send-email-hengx.ding@intel.com> Accept-Language: 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] [PATCH] L3fwd: Add RFC2544 support and able to print loss packets in linerate now. 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, 22 Oct 2015 02:41:33 -0000 You should remove "-P" option, and for RRC, the packet L2 should include=0A= src mac=0A= =0A= Thanks,=0A= Michael=0A= =0A= =0A= On 2015/10/22 10:10, Ding Heng wrote:=0A= > Now l3fwd could do RFC2544 test and get zero loss rate. File etgen.py and= tester.py has been made some changes to met this function.=0A= >=0A= > Signed-off-by: Ding Heng =0A= >=0A= > diff --git a/framework/etgen.py b/framework/etgen.py=0A= > index 508439b..ee58dfd 100644=0A= > --- a/framework/etgen.py=0A= > +++ b/framework/etgen.py=0A= > @@ -33,7 +33,7 @@ import re=0A= > import string=0A= > import time=0A= > import dts=0A= > -from config import IxiaConf=0A= > +import ixiacfg=0A= > from ssh_connection import SSHConnection=0A= > from settings import SCAPY2IXIA=0A= > from logger import getLogger=0A= > @@ -147,19 +147,16 @@ class IxiaPacketGenerator(SSHConnection):=0A= > self.conRelation =3D {}=0A= > =0A= > ixiaRef =3D self.tester.get_external_traffic_generator()=0A= > -=0A= > - ixiacfg =3D IxiaConf()=0A= > - ixiaPorts =3D ixiacfg.load_ixia_config()=0A= > - if ixiaRef is None or ixiaRef not in ixiaPorts:=0A= > + if ixiaRef is None or ixiaRef not in ixiacfg.ixiaPorts:=0A= > return=0A= > =0A= > - self.ixiaVersion =3D ixiaPorts[ixiaRef]["Version"]=0A= > - self.ports =3D ixiaPorts[ixiaRef]["Ports"]=0A= > + self.ixiaVersion =3D ixiacfg.ixiaPorts[ixiaRef]["Version"]=0A= > + self.ports =3D ixiacfg.ixiaPorts[ixiaRef]["Ports"]=0A= > =0A= > self.logger.info(self.ixiaVersion)=0A= > self.logger.info(self.ports)=0A= > =0A= > - self.tclServerIP =3D ixiaPorts[ixiaRef]["IP"]=0A= > + self.tclServerIP =3D ixiacfg.ixiaPorts[ixiaRef]["IP"]=0A= > =0A= > # prepare tcl shell and ixia library=0A= > self.send_expect("tclsh", "% ")=0A= > @@ -476,18 +473,18 @@ class IxiaPacketGenerator(SSHConnection):=0A= > =0A= > return {'card': int(m.group(1)), 'port': int(m.group(2))}=0A= > =0A= > - def loss(self, portList, ratePercent):=0A= > + def loss(self, portList, ratePercent, delay=3D5):=0A= > """=0A= > Run loss performance test and return loss rate.=0A= > """=0A= > rxPortlist, txPortlist =3D self._configure_everything(portList, = ratePercent)=0A= > - return self.get_loss_packet_rate(rxPortlist, txPortlist)=0A= > + return self.get_loss_packet_rate(rxPortlist, txPortlist, delay)= =0A= > =0A= > - def get_loss_packet_rate(self, rxPortlist, txPortlist):=0A= > + def get_loss_packet_rate(self, rxPortlist, txPortlist, delay=3D5):= =0A= > """=0A= > Get RX/TX packet statistics and calculate loss rate.=0A= > """=0A= > - time.sleep(3)=0A= > + time.sleep(delay)=0A= > =0A= > self.send_expect("ixStopTransmit portList", "%", 10)=0A= > time.sleep(2)=0A= > @@ -507,7 +504,7 @@ class IxiaPacketGenerator(SSHConnection):=0A= > revNumber +=3D self.get_frames_received()=0A= > self.logger.info("rev :%f" % revNumber)=0A= > =0A= > - return float(sendNumber - revNumber) / sendNumber=0A= > + return float(sendNumber - revNumber) / sendNumber, sendNumber, r= evNumber=0A= > =0A= > def latency(self, portList, ratePercent, delay=3D5):=0A= > """=0A= > @@ -801,7 +798,10 @@ class IxiaPacketGenerator(SSHConnection):=0A= > Returns the number of packets captured by IXIA on a previously s= et=0A= > port. Call self.stat_get_stat_all_stats(port) before.=0A= > """=0A= > - return self._stat_cget_value('framesReceived')=0A= > + if self._stat_cget_value('framesReceived') !=3D0:=0A= > + return self._stat_cget_value('framesReceived')=0A= > + else:=0A= > + return self._stat_cget_value('oversize')=0A= > =0A= > def get_flow_control_frames(self):=0A= > """=0A= > diff --git a/framework/tester.py b/framework/tester.py=0A= > index de0bc24..665cdf3 100644=0A= > --- a/framework/tester.py=0A= > +++ b/framework/tester.py=0A= > @@ -424,12 +424,12 @@ class Tester(Crb):=0A= > return None=0A= > return self.packet_gen.throughput(portList, rate_percent)=0A= > =0A= > - def traffic_generator_loss(self, portList, ratePercent):=0A= > + def traffic_generator_loss(self, portList, ratePercent, delay=3D60):= =0A= > """=0A= > Run loss performance test on specified ports.=0A= > """=0A= > if self.check_port_list(portList, 'ixia'):=0A= > - return self.ixia_packet_gen.loss(portList, ratePercent)=0A= > + return self.ixia_packet_gen.loss(portList, ratePercent, dela= y)=0A= > elif not self.check_port_list(portList):=0A= > self.logger.warning("exception by mixed port types")=0A= > return None=0A= > diff --git a/tests/TestSuite_l3fwd.py b/tests/TestSuite_l3fwd.py=0A= > index 65fa6f7..9c1955d 100644=0A= > --- a/tests/TestSuite_l3fwd.py=0A= > +++ b/tests/TestSuite_l3fwd.py=0A= > @@ -1,36 +1,9 @@=0A= > -# BSD LICENSE=0A= > -#=0A= > -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.=0A= > -# All rights reserved.=0A= > -#=0A= > -# Redistribution and use in source and binary forms, with or without=0A= > -# modification, are permitted provided that the following conditions=0A= > -# are met:=0A= > -#=0A= > -# * Redistributions of source code must retain the above copyright=0A= > -# notice, this list of conditions and the following disclaimer.=0A= > -# * Redistributions in binary form must reproduce the above copyright= =0A= > -# notice, this list of conditions and the following disclaimer in=0A= > -# the documentation and/or other materials provided with the=0A= > -# distribution.=0A= > -# * Neither the name of Intel Corporation nor the names of its=0A= > -# contributors may be used to endorse or promote products derived=0A= > -# from this software without specific prior written permission.=0A= > -#=0A= > -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS=0A= > -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT=0A= > -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR= =0A= > -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT= =0A= > -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,= =0A= > -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT=0A= > -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,= =0A= > -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY= =0A= > -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT=0A= > -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE= =0A= > -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.= =0A= > +# =0A= > =0A= > """=0A= > DPDK Test suite.=0A= > +=0A= > +=0A= > Layer-3 forwarding test script.=0A= > """=0A= > =0A= > @@ -41,72 +14,55 @@ from plotting import Plotting=0A= > from test_case import TestCase=0A= > from exception import VerifyFailure=0A= > from settings import HEADER_SIZE=0A= > +from etgen import IxiaPacketGenerator=0A= > +=0A= > +import time=0A= > +=0A= > +#=0A= > +#=0A= > +# Test class.=0A= > +#=0A= > =0A= > =0A= > class TestL3fwd(TestCase):=0A= > =0A= > path =3D "./examples/l3fwd/build/"=0A= > =0A= > - test_cases_2_ports =3D {"1S/1C/1T": "%s -c %s -n %d -- -p %s -P --co= nfig '(P0,0,C{1.1.0}), (P1,0,C{1.1.0})'",=0A= > - "1S/1C/2T": "%s -c %s -n %d -- -p %s -P --conf= ig '(P0,0,C{1.1.0}), (P1,0,C{1.1.1})'",=0A= > - "1S/2C/1T": "%s -c %s -n %d -- -p %s -P --conf= ig '(P0,0,C{1.1.0}), (P1,0,C{1.2.0})'"=0A= > - }=0A= > -=0A= > - test_cases_4_ports =3D [(1, "1S/1C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P1,0,C{1.1.0}),(P2,0,C{1.1.0}),(P3,0,C{1.1.0})'"),=0A= > - (1, "1S/1C/2T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P1,0,C{1.1.0}),(P2,0,C{1.1.1}),(P3,0,C{1.1.1})'"),=0A= > - (1, "1S/2C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P1,0,C{1.1.0}),(P2,0,C{1.2.0}),(P3,0,C{1.2.0})'"),=0A= > - (1, "1S/2C/2T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P1,0,C{1.1.1}),(P2,0,C{1.2.0}),(P3,0,C{1.2.1})'"),=0A= > - (1, "1S/4C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P1,0,C{1.2.0}),(P2,0,C{1.3.0}),(P3,0,C{1.4.0})'"),=0A= > - (1, "2S/1C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {0.1.0}),(P1,0,C{0.1.0}),(P2,0,C{1.1.0}),(P3,0,C{1.1.0})'"),=0A= > - (1, "2S/1C/2T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {0.1.0}),(P1,0,C{0.1.1}),(P2,0,C{1.1.0}),(P3,0,C{1.1.1})'"),=0A= > - (1, "2S/2C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {0.1.0}),(P1,0,C{0.2.0}),(P2,0,C{1.1.0}),(P3,0,C{1.2.0})'"),=0A= > - (2, "1S/1C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P0,1,C{1.1.0}),(P1,0,C{1.1.0}),(P1,1,C{1.1.0}),(P2,0,C{1.1.0}),(P= 2,1,C{1.1.0}),(P3,0,C{1.1.0}),(P3,1,C{1.1.0})'"),=0A= > - (2, "1S/1C/2T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P0,1,C{1.1.0}),(P1,0,C{1.1.0}),(P1,1,C{1.1.0}),(P2,0,C{1.1.1}),(P= 2,1,C{1.1.1}),(P3,0,C{1.1.1}),(P3,1,C{1.1.1})'"),=0A= > - (2, "1S/2C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P0,1,C{1.1.0}),(P1,0,C{1.1.0}),(P1,1,C{1.1.0}),(P2,0,C{1.2.0}),(P= 2,1,C{1.2.0}),(P3,0,C{1.2.0}),(P3,1,C{1.2.0})'"),=0A= > - (2, "1S/2C/2T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P0,1,C{1.1.0}),(P1,0,C{1.1.1}),(P1,1,C{1.1.1}),(P2,0,C{1.2.0}),(P= 2,1,C{1.2.0}),(P3,0,C{1.2.1}),(P3,1,C{1.2.1})'"),=0A= > - (2, "1S/4C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P0,1,C{1.1.0}),(P1,0,C{1.2.0}),(P1,1,C{1.2.0}),(P2,0,C{1.3.0}),(P= 2,1,C{1.3.0}),(P3,0,C{1.4.0}),(P3,1,C{1.4.0})'"),=0A= > - (2, "1S/4C/2T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {1.1.0}),(P0,1,C{1.1.1}),(P1,0,C{1.2.0}),(P1,1,C{1.2.1}),(P2,0,C{1.3.0}),(P= 2,1,C{1.3.1}),(P3,0,C{1.4.0}),(P3,1,C{1.4.1})'"),=0A= > - (2, "2S/1C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {0.1.0}),(P0,1,C{0.1.0}),(P1,0,C{0.1.0}),(P1,1,C{0.1.0}),(P2,0,C{1.1.0}),(P= 2,1,C{1.1.0}),(P3,0,C{1.1.0}),(P3,1,C{1.1.0})'"),=0A= > - (2, "2S/1C/2T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {0.1.0}),(P0,1,C{0.1.0}),(P1,0,C{0.1.1}),(P1,1,C{0.1.1}),(P2,0,C{1.1.0}),(P= 2,1,C{1.1.0}),(P3,0,C{1.1.1}),(P3,1,C{1.1.1})'"),=0A= > - (2, "2S/2C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {0.1.0}),(P0,1,C{0.1.0}),(P1,0,C{0.2.0}),(P1,1,C{0.2.0}),(P2,0,C{1.1.0}),(P= 2,1,C{1.1.0}),(P3,0,C{1.2.0}),(P3,1,C{1.2.0})'"),=0A= > - (2, "2S/2C/2T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {0.1.0}),(P0,1,C{0.1.1}),(P1,0,C{0.2.0}),(P1,1,C{0.2.1}),(P2,0,C{1.1.0}),(P= 2,1,C{1.1.1}),(P3,0,C{1.2.0}),(P3,1,C{1.2.1})'"),=0A= > - (2, "2S/4C/1T",=0A= > - "%s -c %s -n %d -- -p %s -P --config '(P0,0,C= {0.1.0}),(P0,1,C{0.2.0}),(P1,0,C{0.3.0}),(P1,1,C{0.4.0}),(P2,0,C{1.1.0}),(P= 2,1,C{1.2.0}),(P3,0,C{1.3.0}),(P3,1,C{1.4.0})'")=0A= > - ]=0A= > -=0A= > - queues_4_ports =3D []=0A= > -=0A= > - for case in test_cases_4_ports:=0A= > - if case[0] * 4 not in queues_4_ports:=0A= > - queues_4_ports.append(case[0] * 4)=0A= > + test_cases_1_ports_1S_2C_1T =3D {=0A= > + "1S/2C/1T": "%s -c %s -n %d -- -p %s -P --config '(P0,0,C{1.1.0}= ), (P0,1,C{1.2.0})'"=0A= > + }=0A= > +=0A= > + test_cases_1_ports_1S_1C_1T =3D {=0A= > + "1S/1C/1T": "%s -c %s -n %d -- -p %s -P --config '(P0,0,C{1.1.0}= )'"=0A= > + }=0A= > +=0A= > + test_cases_2_ports_1S_4C_1T =3D {=0A= > + "1S/4C/1T": "%s -c %s -n %d -- -p %s -P --config '(P0,0,C{1.1.0}= ), (P0,1,C{1.2.0}),(P1,0,C{1.3.0}),(P1,1,C{1.4.0})'"=0A= > + }=0A= > +=0A= > + test_cases_2_ports_1S_2C_1T =3D {=0A= > + "1S/2C/1T": "%s -c %s -n %d -- -p %s -P --config '(P0,0,C{1.1.0}= ), (P1,0,C{1.2.0})'"=0A= > + }=0A= > +=0A= > + test_cases_4_ports_1S_4C_1T =3D [=0A= > + (4, "1S/4C/1T",=0A= > + "%s -c %s -n %d -- -p %s -P --config '(P0,0,C{1.1.0}),(P1,0,C{1= .2.0}),(P2,0,C{1.3.0}),(P3,0,C{1.4.0})'")=0A= > + ]=0A= > +=0A= > + test_cases_4_ports_1S_1C_1T =3D [=0A= > + (1, "1S/1C/1T",=0A= > + "%s -c %s -n %d -- -p %s -P --config '(P0,0,C{1.1.0}),(P1,0,C{= 1.1.0}),(P2,0,C{1.1.0}),(P3,0,C{1.1.0})'")=0A= > + ]=0A= > =0A= > host_table =3D [=0A= > - "{{IPv4(10,100,0,1), IPv4(1,2,3,4), 1, 10, IPPROTO_UDP}, P0}",= =0A= > - "{{IPv4(10,101,0,1), IPv4(1,2,3,4), 1, 10, IPPROTO_UDP}, P0}",= =0A= > - "{{IPv4(11,100,0,1), IPv4(1,2,3,4), 1, 11, IPPROTO_UDP}, P1}",= =0A= > - "{{IPv4(11,101,0,1), IPv4(1,2,3,4), 1, 11, IPPROTO_UDP}, P1}",= =0A= > - "{{IPv4(12,100,0,1), IPv4(1,2,3,4), 1, 12, IPPROTO_UDP}, P2}",= =0A= > - "{{IPv4(12,101,0,1), IPv4(1,2,3,4), 1, 12, IPPROTO_UDP}, P2}",= =0A= > - "{{IPv4(13,100,0,1), IPv4(1,2,3,4), 1, 13, IPPROTO_UDP}, P3}",= =0A= > - "{{IPv4(13,101,0,1), IPv4(1,2,3,4), 1, 13, IPPROTO_UDP}, P3}",= =0A= > + "{{IPv4(10,100,0,1), IPv4(0,0,0,0), 1, 10, IPPROTO_UDP}, P0}",= =0A= > + "{{IPv4(10,101,0,1), IPv4(0,0,0,0), 1, 10, IPPROTO_UDP}, P0}",= =0A= > + "{{IPv4(11,100,0,1), IPv4(0,0,0,0), 1, 11, IPPROTO_UDP}, P1}",= =0A= > + "{{IPv4(11,101,0,1), IPv4(0,0,0,0), 1, 11, IPPROTO_UDP}, P1}",= =0A= > + "{{IPv4(12,100,0,1), IPv4(0,0,0,0), 1, 12, IPPROTO_UDP}, P2}",= =0A= > + "{{IPv4(12,101,0,1), IPv4(0,0,0,0), 1, 12, IPPROTO_UDP}, P2}",= =0A= > + "{{IPv4(13,100,0,1), IPv4(0,0,0,0), 1, 13, IPPROTO_UDP}, P3}",= =0A= > + "{{IPv4(13,101,0,1), IPv4(0,0,0,0), 1, 13, IPPROTO_UDP}, P3}",= =0A= > ]=0A= > =0A= > lpm_table =3D [=0A= > @@ -120,9 +76,9 @@ class TestL3fwd(TestCase):=0A= > "{IPv4(13,101,0,0), 24, P3}",=0A= > ]=0A= > =0A= > - frame_sizes =3D [64] # 65, 128=0A= > -=0A= > - methods =3D ['lpm', 'exact']=0A= > + frame_sizes =3D [64, 128, 256, 2048]=0A= > + #frame_sizes =3D [64]=0A= > + methods =3D ['lpm']=0A= > =0A= > #=0A= > #=0A= > @@ -147,174 +103,32 @@ class TestL3fwd(TestCase):=0A= > # Test cases.=0A= > #=0A= > =0A= > - def plot_4_ports(self):=0A= > -=0A= > - data =3D self.l3fwd_test_results['data']=0A= > -=0A= > - # Create a plot for each number of queues for frame size and mod= e comparison=0A= > - cores =3D '1S/1C/1T'=0A= > - for queues in TestL3fwd.queues_4_ports:=0A= > - ydata =3D []=0A= > - lpm_ydata =3D []=0A= > - exact_ydata =3D []=0A= > - for frame_size in TestL3fwd.frame_sizes:=0A= > - for row in data:=0A= > - if row[1] * 4 =3D=3D queues and row[2] =3D=3D cores = and \=0A= > - row[0] =3D=3D frame_size:=0A= > - if len(TestL3fwd.methods) =3D=3D 2:=0A= > - lpm_ydata.append(row[4])=0A= > - exact_ydata.append(row[6])=0A= > - else:=0A= > - if 'lpm' in TestL3fwd.methods:=0A= > - lpm_ydata.append(row[4])=0A= > - if 'exact' in TestL3fwd.methods:=0A= > - exact_ydata.append(row[4])=0A= > -=0A= > - if 'lpm' in TestL3fwd.methods:=0A= > - ydata.append(lpm_ydata)=0A= > - if 'exact' in TestL3fwd.methods:=0A= > - ydata.append(exact_ydata)=0A= > -=0A= > - if len(ydata[0]) =3D=3D 0:=0A= > - self.logger.warning('No data for plotting 1S/1C/1T')=0A= > - break=0A= > - else:=0A= > - try:=0A= > - image_path =3D self.plotting.create_bars_plot(=0A= > - 'test_perf_l3fwd_4ports_1S_1C_1T_%dRxQ' % queues= ,=0A= > - 'LPM & Exact modes, 1S/1C/1T, %d Rx Queues, 4 po= rts' % queues,=0A= > - TestL3fwd.frame_sizes,=0A= > - ydata,=0A= > - ylabel=3D'% linerate',=0A= > - legend=3DTestL3fwd.methods)=0A= > -=0A= > - dts.results_plot_print(image_path, 50)=0A= > - except VerifyFailure as e:=0A= > - self.logger.error(str(e))=0A= > -=0A= > - # Create a plot for each number of queues for core config and mo= de comparison=0A= > - frame_size =3D TestL3fwd.frame_sizes[0] # Frame size fixed to = the first selected=0A= > - for queues in TestL3fwd.queues_4_ports:=0A= > -=0A= > - cores =3D []=0A= > - for row in data:=0A= > - if row[2] not in cores and \=0A= > - row[1] * 4 =3D=3D queues:=0A= > - cores.append(row[2])=0A= > -=0A= > - ydata =3D []=0A= > - lpm_ydata =3D []=0A= > - exact_ydata =3D []=0A= > -=0A= > - for core in cores:=0A= > - for row in data:=0A= > - if row[1] * 4 =3D=3D queues and \=0A= > - row[2] =3D=3D core and \=0A= > - row[0] =3D=3D frame_size:=0A= > - if len(TestL3fwd.methods) =3D=3D 2:=0A= > - lpm_ydata.append(row[4])=0A= > - exact_ydata.append(row[6])=0A= > - else:=0A= > - if 'lpm' in TestL3fwd.methods:=0A= > - lpm_ydata.append(row[4])=0A= > - if 'exact' in TestL3fwd.methods:=0A= > - exact_ydata.append(row[4])=0A= > -=0A= > - if 'lpm' in TestL3fwd.methods:=0A= > - ydata.append(lpm_ydata)=0A= > - if 'exact' in TestL3fwd.methods:=0A= > - ydata.append(exact_ydata)=0A= > -=0A= > - try:=0A= > - image_path =3D self.plotting.create_bars_plot(=0A= > - 'test_perf_l3fwd_4ports_%d_%dRxQ' % (frame_size, que= ues),=0A= > - 'LPM & Exact modes, %dB, %d Rx Queues, 4 ports' % (f= rame_size, queues),=0A= > - cores,=0A= > - ydata,=0A= > - ylabel=3D'% linerate',=0A= > - legend=3DTestL3fwd.methods)=0A= > -=0A= > - dts.results_plot_print(image_path)=0A= > - except VerifyFailure as e:=0A= > - self.logger.error(str(e))=0A= > -=0A= > - def plot_2_ports(self):=0A= > -=0A= > - data =3D self.l3fwd_test_results['data']=0A= > -=0A= > - cores =3D []=0A= > - for row in data:=0A= > - if row[2] not in cores:=0A= > - cores.append(row[2])=0A= > -=0A= > - # Create a plot for each mode for frame size and cores compariso= n=0A= > - for mode in TestL3fwd.methods:=0A= > - mode_ydata =3D []=0A= > -=0A= > - for core in cores:=0A= > - core_ydata =3D []=0A= > - for row in data:=0A= > - if row[5] =3D=3D mode and row[2] =3D=3D core:=0A= > - core_ydata.append(float(row[4]))=0A= > -=0A= > - mode_ydata.append(core_ydata)=0A= > -=0A= > - image_path =3D self.plotting.create_bars_plot(=0A= > - 'test_perf_l3fwd_2ports_%s' % mode,=0A= > - 'L3fwd %s mode, 2 ports' % mode,=0A= > - TestL3fwd.frame_sizes,=0A= > - mode_ydata,=0A= > - ylabel=3D'% linerate',=0A= > - legend=3Dcores)=0A= > -=0A= > - dts.results_plot_print(image_path, 50)=0A= > -=0A= > - # If testing only one mode, do nothing else.=0A= > - if len(TestL3fwd.methods) =3D=3D 1:=0A= > - return=0A= > -=0A= > - # Create a plot for 1st core config for mode and frame size comp= arison=0A= > - core =3D '1S/1C/1T'=0A= > -=0A= > - ydata =3D []=0A= > - for mode in TestL3fwd.methods:=0A= > - mode_ydata =3D []=0A= > - for frame_size in TestL3fwd.frame_sizes:=0A= > - for row in data:=0A= > - if row[2] =3D=3D core and row[0] =3D=3D frame_size a= nd \=0A= > - row[5] =3D=3D mode:=0A= > - mode_ydata.append(float(row[4]))=0A= > -=0A= > - ydata.append(mode_ydata)=0A= > -=0A= > - str_frame_sizes =3D []=0A= > - for frame_size in TestL3fwd.frame_sizes:=0A= > - str_frame_sizes.append(str(frame_size))=0A= > -=0A= > - image_path =3D self.plotting.create_bars_plot(=0A= > - 'test_perf_l3fwd_2ports_1S_1C_1T',=0A= > - 'L3fwd 1S/1C/1T cores, 2 ports',=0A= > - TestL3fwd.frame_sizes,=0A= > - ydata,=0A= > - ylabel=3D'% linerate',=0A= > - legend=3DTestL3fwd.methods)=0A= > -=0A= > - dts.results_plot_print(image_path)=0A= > -=0A= > def set_up_all(self):=0A= > """=0A= > Run at the start of each test suite.=0A= > -=0A= > -=0A= > L3fwd Prerequisites=0A= > """=0A= > +=0A= > + self.dut.unbind_interfaces_linux()=0A= > + self.dut.send_expect(=0A= > + "sed -i 's/CONFIG_RTE_PCI_CONFIG=3D.*$/CONFIG_RTE_PCI_CONFIG= =3Dy/' ./config/common_linuxapp", "# ", 5)=0A= > + self.dut.send_expect(=0A= > + "sed -i 's/CONFIG_RTE_PCI_EXTENDED_TAG=3D.*$/CONFIG_RTE_PCI_= EXTENDED_TAG=3D\"on\"/' ./config/common_linuxapp", "# ", 5)=0A= > + self.dut.send_expect(=0A= > + "sed -i 's/CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=3D.*$/CONFI= G_RTE_LIBRTE_I40E_16BYTE_RX_DESC=3Dy/' ./config/common_linuxapp", "# ", 5)= =0A= > + self.dut.send_expect(=0A= > + "sed -i 's/CONFIG_RTE_PCI_MAX_READ_REQUEST_SIZE=3D.*$/CONFIG= _RTE_PCI_MAX_READ_REQUEST_SIZE=3D4096/' ./config/common_linuxapp", "# ", 5)= =0A= > + self.dut.send_expect("export RTE_TARGET=3D" + self.target, "#")= =0A= > + self.dut.send_expect("export RTE_SDK=3D`pwd`", "#")=0A= > + self.dut.send_expect("rm -rf %s" % self.target, "# ", 5)=0A= > + self.dut.build_install_dpdk(self.target)=0A= > + time.sleep(10)=0A= > + self.dut.bind_interfaces_linux()=0A= > +=0A= > # Based on h/w type, choose how many ports to use=0A= > - ports =3D self.dut.get_ports(socket=3D1)=0A= > + ports =3D self.dut.get_ports(self.nic, socket=3D1)=0A= > if not ports:=0A= > - ports =3D self.dut.get_ports(socket=3D0)=0A= > -=0A= > - # Verify that enough ports are available=0A= > - self.verify(len(ports) >=3D 2, "Insufficient ports for speed tes= ting")=0A= > + ports =3D self.dut.get_ports(self.nic, socket=3D0)=0A= > =0A= > # Verify that enough threads are available=0A= > cores =3D self.dut.get_core_list("2S/4C/2T")=0A= > @@ -322,14 +136,16 @@ class TestL3fwd(TestCase):=0A= > =0A= > global valports=0A= > valports =3D [_ for _ in ports if self.tester.get_local_port(_) = !=3D -1]=0A= > - self.verify(len(valports) >=3D 2, "Insufficient active ports for= speed testing")=0A= > + self.verify(=0A= > + len(valports) >=3D 2, "Insufficient active ports for speed t= esting")=0A= > =0A= > pat =3D re.compile("P([0123])")=0A= > =0A= > # Prepare long prefix match table, replace P(x) port pattern=0A= > lpmStr =3D "static struct ipv4_l3fwd_route ipv4_l3fwd_route_arra= y[] =3D {\\\n"=0A= > for idx in range(len(TestL3fwd.lpm_table)):=0A= > - TestL3fwd.lpm_table[idx] =3D pat.sub(self.portRepl, TestL3fw= d.lpm_table[idx])=0A= > + TestL3fwd.lpm_table[idx] =3D pat.sub(=0A= > + self.portRepl, TestL3fwd.lpm_table[idx])=0A= > lpmStr =3D lpmStr + ' ' * 4 + TestL3fwd.lpm_table[idx] + ",\= \\n"=0A= > lpmStr =3D lpmStr + "};"=0A= > self.logger.debug(lpmStr)=0A= > @@ -337,30 +153,37 @@ class TestL3fwd(TestCase):=0A= > # Prepare host route table, replace P(x) port pattern=0A= > exactStr =3D "static struct ipv4_l3fwd_route ipv4_l3fwd_route_ar= ray[] =3D {\\\n"=0A= > for idx in range(len(TestL3fwd.host_table)):=0A= > - TestL3fwd.host_table[idx] =3D pat.sub(self.portRepl, TestL3f= wd.host_table[idx])=0A= > + TestL3fwd.host_table[idx] =3D pat.sub(=0A= > + self.portRepl, TestL3fwd.host_table[idx])=0A= > exactStr =3D exactStr + ' ' * 4 + TestL3fwd.host_table[idx] = + ",\\\n"=0A= > exactStr =3D exactStr + "};"=0A= > self.logger.debug(exactStr)=0A= > =0A= > # Compile l3fwd with LPM lookup.=0A= > - self.dut.send_expect(r"sed -i '/ipv4_l3fwd_route_array\[\].*{/,/= ^\}\;/c\\%s' examples/l3fwd/main.c" % lpmStr, "# ")=0A= > - out =3D self.dut.build_dpdk_apps("./examples/l3fwd", "USER_FLAGS= =3D-DAPP_LOOKUP_METHOD=3D1")=0A= > + self.dut.send_expect(=0A= > + r"sed -i '/ipv4_l3fwd_route_array\[\].*{/,/^\}\;/c\\%s' exam= ples/l3fwd/main.c" % lpmStr, "# ")=0A= > + out =3D self.dut.build_dpdk_apps(=0A= > + "./examples/l3fwd", "USER_FLAGS=3D-DAPP_LOOKUP_METHOD=3D1")= =0A= > self.verify("Error" not in out, "compilation error 1")=0A= > self.verify("No such file" not in out, "compilation error 2")=0A= > =0A= > # Backup the LPM exe and clean up the build.=0A= > - self.dut.send_expect("mv -f examples/l3fwd/build/l3fwd examples/= l3fwd/build/l3fwd_lpm", "# ")=0A= > + self.dut.send_expect(=0A= > + "mv -f examples/l3fwd/build/l3fwd examples/l3fwd/build/l3fwd= _lpm", "# ")=0A= > out =3D self.dut.send_expect("make clean -C examples/l3fwd", "# = ")=0A= > =0A= > - # Compile l3fwd with hash/exact lookup.=0A= > - self.dut.send_expect(r"sed -i -e '/ipv4_l3fwd_route_array\[\].*{= /,/^\}\;/c\\%s' examples/l3fwd/main.c" % exactStr, "# ")=0A= > - out =3D self.dut.build_dpdk_apps("./examples/l3fwd", "USER_FLAGS= =3D-DAPP_LOOKUP_METHOD=3D0")=0A= > -=0A= > - self.verify("Error" not in out, "compilation error 1")=0A= > - self.verify("No such file" not in out, "compilation error 2")=0A= > -=0A= > - # Backup the Hash/Exact exe.=0A= > - self.dut.send_expect("mv -f examples/l3fwd/build/l3fwd examples/= l3fwd/build/l3fwd_exact", "# ")=0A= > +# # Compile l3fwd with hash/exact lookup.=0A= > +# self.dut.send_expect(=0A= > +# r"sed -i -e '/ipv4_l3fwd_route_array\[\].*{/,/^\}\;/c\\%s' = examples/l3fwd/main.c" % exactStr, "# ")=0A= > +# out =3D self.dut.build_dpdk_apps(=0A= > +# "./examples/l3fwd", "USER_FLAGS=3D-DAPP_LOOKUP_METHOD=3D0")= =0A= > +#=0A= > +# self.verify("Error" not in out, "compilation error 1")=0A= > +# self.verify("No such file" not in out, "compilation error 2")= =0A= > +#=0A= > +# # Backup the Hash/Exact exe.=0A= > +# self.dut.send_expect(=0A= > +# "mv -f examples/l3fwd/build/l3fwd examples/l3fwd/build/l3fw= d_exact", "# ")=0A= > =0A= > self.l3fwd_test_results =3D {'header': [],=0A= > 'data': []}=0A= > @@ -374,14 +197,14 @@ class TestL3fwd(TestCase):=0A= > =0A= > """=0A= > return [=0A= > - 'IP(src=3D"1.2.3.4",dst=3D"10.100.0.1")/UDP(sport=3D10,dport= =3D1)',=0A= > - 'IP(src=3D"1.2.3.4",dst=3D"10.101.0.1")/UDP(sport=3D10,dport= =3D1)',=0A= > - 'IP(src=3D"1.2.3.4",dst=3D"11.100.0.1")/UDP(sport=3D11,dport= =3D1)',=0A= > - 'IP(src=3D"1.2.3.4",dst=3D"11.101.0.1")/UDP(sport=3D11,dport= =3D1)',=0A= > - 'IP(src=3D"1.2.3.4",dst=3D"12.100.0.1")/UDP(sport=3D12,dport= =3D1)',=0A= > - 'IP(src=3D"1.2.3.4",dst=3D"12.101.0.1")/UDP(sport=3D12,dport= =3D1)',=0A= > - 'IP(src=3D"1.2.3.4",dst=3D"13.100.0.1")/UDP(sport=3D13,dport= =3D1)',=0A= > - 'IP(src=3D"1.2.3.4",dst=3D"13.101.0.1")/UDP(sport=3D13,dport= =3D1)']=0A= > + 'IP(src=3D"0.0.0.0",dst=3D"11.100.0.1")',=0A= > + 'IP(src=3D"0.0.0.0",dst=3D"11.101.0.1")',=0A= > + 'IP(src=3D"0.0.0.0",dst=3D"10.100.0.1")',=0A= > + 'IP(src=3D"0.0.0.0",dst=3D"10.101.0.1")',=0A= > + 'IP(src=3D"0.0.0.0",dst=3D"13.100.0.1")',=0A= > + 'IP(src=3D"0.0.0.0",dst=3D"13.101.0.1")',=0A= > + 'IP(src=3D"0.0.0.0",dst=3D"12.100.0.1")',=0A= > + 'IP(src=3D"0.0.0.0",dst=3D"12.101.0.1")']=0A= > =0A= > def repl(self, match):=0A= > pid =3D match.group(1)=0A= > @@ -398,6 +221,33 @@ class TestL3fwd(TestCase):=0A= > =0A= > return '%s,%s,%s' % (str(valports[int(pid)]), qid, lcid)=0A= > =0A= > + def RFC2544(self, portlist, delay=3D120):=0A= > + """=0A= > + zero_rate: dpdk will not lost packet in this line rate.=0A= > + loss_rate: dpdk will loss packet in this line rate.=0A= > + test_rate: the line rate we are going to test.=0A= > + """=0A= > + zero_rate =3D 0.0=0A= > + loss_rate =3D 100.0=0A= > + test_rate =3D 100.0=0A= > +=0A= > + while (loss_rate - zero_rate) > 0.002:=0A= > + self.logger.info("test rate: %f " % test_rate)=0A= > + if test_rate =3D=3D 100:=0A= > + lost, tx_num, rx_num =3D self.tester.traffic_generator_= loss(portlist, test_rate, delay)=0A= > + else:=0A= > + lost, _, _ =3D self.tester.traffic_generator_loss(portlist, test_rat= e, delay)=0A= > + if lost !=3D 0:=0A= > + loss_rate =3D test_rate=0A= > + test_rate =3D (test_rate + zero_rate)/2=0A= > + else:=0A= > + zero_rate =3D test_rate=0A= > + test_rate =3D (test_rate + loss_rate)/2=0A= > +=0A= > + self.logger.info("zero loss rate is %s" % test_rate)=0A= > + return test_rate, tx_num, rx_num=0A= > +=0A= > +=0A= > def get_throughput(self, frame_size, rx_queues_per_port, cores_confi= g, command_line):=0A= > """=0A= > Get the throughput for a test case from test_cases_4_ports.=0A= > @@ -421,10 +271,17 @@ class TestL3fwd(TestCase):=0A= > # First, measure by two different methods=0A= > for method in TestL3fwd.methods:=0A= > # start l3fwd=0A= > - method_command_line =3D command_line % (TestL3fwd.path + "l3= fwd_" + method,=0A= > - core_mask,=0A= > - self.dut.get_memory_ch= annels(),=0A= > - dts.create_mask(valpor= ts[:4]))=0A= > + if frame_size =3D=3D 2048:=0A= > +=0A= > + method_command_line =3D command_line % (TestL3fwd.path += "l3fwd_" + method, core_mask,=0A= > + self.dut.get_memory_channels(), dts.create_mask(valport= s[:4]))=0A= > +=0A= > + method_command_line +=3D " --enable-jumbo --max-pkt-len = " + "%d" % frame_size=0A= > +=0A= > + else:=0A= > + method_command_line =3D command_line % (TestL3fwd.path += "l3fwd_" + method, core_mask,=0A= > + self.dut.get_memory_channels(),=0A= > + dts.create_mask(valports[:4]))=0A= > =0A= > dts.report(method_command_line + "\n", frame=3DTrue, annex= =3DTrue)=0A= > =0A= > @@ -434,25 +291,48 @@ class TestL3fwd(TestCase):=0A= > tgen_input =3D []=0A= > for rxPort in range(4):=0A= > if rxPort % 2 =3D=3D 0:=0A= > - tx_interface =3D self.tester.get_local_port(valports= [rxPort + 1])=0A= > + tx_interface =3D self.tester.get_local_port(=0A= > + valports[rxPort + 1])=0A= > else:=0A= > - tx_interface =3D self.tester.get_local_port(valports= [rxPort - 1])=0A= > + tx_interface =3D self.tester.get_local_port(=0A= > + valports[rxPort - 1])=0A= > =0A= > rx_interface =3D self.tester.get_local_port(valports[rxP= ort])=0A= > - tgen_input.append((tx_interface, rx_interface, "dst%d.pc= ap" % valports[rxPort]))=0A= > + tgen_input.append(=0A= > + (tx_interface, rx_interface, "dst%d.pcap" % valports= [rxPort]))=0A= > =0A= > # FIX ME=0A= > - bps[method], pps[method] =3D self.tester.traffic_generator_t= hroughput(tgen_input)=0A= > + =0A= > + bps[method], pps[=0A= > + method] =3D self.tester.traffic_generator_throughput(tge= n_input)=0A= > self.verify(pps[method] > 0, "No traffic detected")=0A= > pps[method] /=3D 1000000.0=0A= > pct[method] =3D pps[method] * 100 / float(self.wirespeed(sel= f.nic,=0A= > - frame= _size,=0A= > - 4))= =0A= > + frame= _size,4))=0A= > +# if RFC2544 =3D=3D True:=0A= > +# zero_rate =3D 0.0=0A= > +# loss_rate =3D 100.0=0A= > +# test_rate =3D 100.0=0A= > +#=0A= > +# while (loss_rate - zero_rate) > 0.002:=0A= > +# print "test_rate is %s!!!!!!!!!!!!!!" % test_rate=0A= > +# if self.tester.traffic_generator_loss(tgen_input, test_rate, 60) != =3D 0:=0A= > +# stable_flag =3D 0=0A= > +# loss_rate =3D test_rate=0A= > +# test_rate =3D (test_rate + zero_rate)/2=0A= > +# else:=0A= > +# stable_flag =3D stable_flag + 1=0A= > +# zero_rate =3D test_rate=0A= > +# test_rate =3D (test_rate + loss_rate)/2=0A= > +# =0A= > +# print "zero loss rate is %s" % test_rate=0A= > +# =0A= > =0A= > # stop l3fwd=0A= > self.dut.send_expect("^C", "#")=0A= > =0A= > - data_row =3D [frame_size, rx_queues_per_port, cores_config]=0A= > +# data_row =3D [frame_size, rx_queues_per_port, cores_config]=0A= > + data_row =3D [frame_size]=0A= > for method in TestL3fwd.methods:=0A= > data_row.append(pps[method])=0A= > data_row.append(pct[method])=0A= > @@ -467,21 +347,22 @@ class TestL3fwd(TestCase):=0A= > """=0A= > pass=0A= > =0A= > - def test_perf_l3fwd_4ports(self):=0A= > + def test_perf_l3fwd_4ports_1S_4C_1T(self):=0A= > """=0A= > L3fwd main 4 ports.=0A= > """=0A= > =0A= > # Based on h/w type, choose how many ports to use=0A= > - ports =3D self.dut.get_ports()=0A= > + ports =3D self.dut.get_ports(self.nic)=0A= > # Verify that enough ports are available=0A= > self.verify(len(ports) >=3D 4, "Insufficient ports for speed tes= ting")=0A= > =0A= > - header_row =3D ["Frame size", "RX Queues/NIC Port", "S/C/T"]=0A= > +# header_row =3D ["Frame size", "RX Queues/NIC Port", "S/C/T"]=0A= > + header_row =3D ["Frame Size(bytes)"]=0A= > =0A= > for method in TestL3fwd.methods:=0A= > - header_row.append('%s Mpps' % method)=0A= > - header_row.append('% linerate')=0A= > + header_row.append('Throughput(Mpps)')=0A= > + header_row.append('linerate%')=0A= > =0A= > dts.results_table_add_header(header_row)=0A= > self.l3fwd_test_results['header'] =3D header_row=0A= > @@ -490,13 +371,15 @@ class TestL3fwd(TestCase):=0A= > for frame_size in TestL3fwd.frame_sizes:=0A= > =0A= > # Prepare traffic flow=0A= > - payload_size =3D frame_size - HEADER_SIZE['udp'] - \=0A= > + payload_size =3D frame_size - \=0A= > HEADER_SIZE['ip'] - HEADER_SIZE['eth']=0A= > =0A= > for _port in range(4):=0A= > dmac =3D self.dut.get_mac_address(valports[_port])=0A= > - flows =3D ['Ether(dst=3D"%s")/%s/("X"*%d)' % (dmac, flow= , payload_size) for flow in self.flows()[_port * 2:(_port + 1) * 2]]=0A= > - self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' % = (valports[_port], string.join(flows, ',')))=0A= > + flows =3D ['Ether(dst=3D"%s")/%s/("X"*%d)' % (dmac, flow= , payload_size)=0A= > + for flow in self.flows()[_port * 2:(_port + 1) = * 2]]=0A= > + self.tester.scapy_append(=0A= > + 'wrpcap("dst%d.pcap", [%s])' % (valports[_port], str= ing.join(flows, ',')))=0A= > =0A= > self.tester.scapy_execute()=0A= > =0A= > @@ -506,25 +389,25 @@ class TestL3fwd(TestCase):=0A= > frame=3DTrue, annex=3DTrue)=0A= > =0A= > # Get the number of sockets of the board=0A= > - number_sockets =3D self.dut.send_expect("grep \"processor\|p= hysical id\|core id\|^$\" /proc/cpuinfo | grep physical | sort -u | wc -l",= "# ")=0A= > + number_sockets =3D self.dut.send_expect(=0A= > + "grep \"processor\|physical id\|core id\|^$\" /proc/cpui= nfo | grep physical | sort -u | wc -l", "# ")=0A= > number_sockets =3D int(number_sockets.split('\r\n')[0])=0A= > =0A= > # Run case by case=0A= > - for test_case in TestL3fwd.test_cases_4_ports:=0A= > + for test_case in TestL3fwd.test_cases_4_ports_1S_4C_1T:=0A= > =0A= > # Check if the board has sockets enough for the test cas= e=0A= > if number_sockets >=3D int(test_case[1].split('/')[0][0]= ):=0A= > self.get_throughput(frame_size, *test_case)=0A= > =0A= > - self.plot_4_ports()=0A= > dts.results_table_print()=0A= > =0A= > - def test_perf_l3fwd_2ports(self):=0A= > + def no_test_perf_l3fwd_2ports_1S_4C_1T(self):=0A= > """=0A= > L3fwd main 2 ports.=0A= > """=0A= > =0A= > - header_row =3D ["Frame", "Ports", "S/C/T", "Mpps", "% linerate",= "mode"]=0A= > + header_row =3D ["Frame Size(bytes)", "Throughput(Mpps)", "linera= te%"]=0A= > self.l3fwd_test_results['header'] =3D header_row=0A= > dts.results_table_add_header(header_row)=0A= > self.l3fwd_test_results['data'] =3D []=0A= > @@ -532,24 +415,26 @@ class TestL3fwd(TestCase):=0A= > for frame_size in TestL3fwd.frame_sizes:=0A= > =0A= > # Prepare traffic flow=0A= > - payload_size =3D frame_size - HEADER_SIZE['udp'] - \=0A= > + payload_size =3D frame_size - \=0A= > HEADER_SIZE['ip'] - HEADER_SIZE['eth']=0A= > =0A= > - flows =3D ['Ether()/%s/("X"*%d)' % (flow, payload_size) for = flow in self.flows()[:4]]=0A= > + flows =3D ['Ether()/%s/("X"*%d)' % (flow, payload_size)=0A= > + for flow in self.flows()[:4]]=0A= > =0A= > dts.report("Flows for 2 ports, %d frame size.\n" % (frame_si= ze),=0A= > annex=3DTrue)=0A= > dts.report("%s" % string.join(flows, '\n'),=0A= > frame=3DTrue, annex=3DTrue)=0A= > =0A= > - self.tester.scapy_append('wrpcap("test2ports.pcap", [%s])' %= string.join(flows, ','))=0A= > + self.tester.scapy_append(=0A= > + 'wrpcap("test2ports.pcap", [%s])' % string.join(flows, '= ,'))=0A= > self.tester.scapy_execute()=0A= > =0A= > # Prepare the command line=0A= > global corelist=0A= > pat =3D re.compile("P([0123]),([0123]),(C\{\d.\d.\d\})")=0A= > coreMask =3D {}=0A= > - rtCmdLines =3D dict(TestL3fwd.test_cases_2_ports)=0A= > + rtCmdLines =3D dict(TestL3fwd.test_cases_2_ports_1S_4C_1T)= =0A= > for key in rtCmdLines.keys():=0A= > corelist =3D []=0A= > while pat.search(rtCmdLines[key]):=0A= > @@ -572,8 +457,14 @@ class TestL3fwd(TestCase):=0A= > dts.report(info, annex=3DTrue)=0A= > =0A= > subtitle.append(cores)=0A= > - cmdline =3D rtCmdLines[cores] % (TestL3fwd.path + "l= 3fwd_" + mode, coreMask[cores],=0A= > - self.dut.get_memory_c= hannels(), dts.create_mask(valports[:2]))=0A= > + if frame_size =3D=3D 2048:=0A= > + cmdline =3D rtCmdLines[cores] % (TestL3fwd.path = + "l3fwd_" + mode, coreMask[cores],=0A= > + self.dut.get_memory_channels(), dts.create_mask= (valports[:2]))=0A= > +=0A= > + cmdline =3D cmdline + " --enable-jumbo --max-pkt= -len " + "%d" % frame_size=0A= > + else:=0A= > + cmdline =3D rtCmdLines[cores] % (TestL3fwd.path = + "l3fwd_" + mode, coreMask[cores],=0A= > + self.dut.get_memory_channels(), dts.create_mask= (valports[:2]))=0A= > =0A= > dts.report(cmdline + "\n", frame=3DTrue, annex=3DTru= e)=0A= > =0A= > @@ -584,30 +475,407 @@ class TestL3fwd(TestCase):=0A= > for rxPort in range(2):=0A= > # No use on rx/tx limitation=0A= > if rxPort % 2 =3D=3D 0:=0A= > - txIntf =3D self.tester.get_local_port(valpor= ts[rxPort + 1])=0A= > + txIntf =3D self.tester.get_local_port(=0A= > + valports[rxPort + 1])=0A= > else:=0A= > - txIntf =3D self.tester.get_local_port(valpor= ts[rxPort - 1])=0A= > + txIntf =3D self.tester.get_local_port(=0A= > + valports[rxPort - 1])=0A= > =0A= > rxIntf =3D self.tester.get_local_port(valports[r= xPort])=0A= > =0A= > tgenInput.append((txIntf, rxIntf, "test2ports.pc= ap"))=0A= > =0A= > - _, pps =3D self.tester.traffic_generator_throughput(= tgenInput)=0A= > + _, pps =3D self.tester.traffic_generator_throughput(= =0A= > + tgenInput)=0A= > self.verify(pps > 0, "No traffic detected")=0A= > pps /=3D 1000000.0=0A= > linerate =3D self.wirespeed(self.nic, frame_size, 2)= =0A= > pct =3D pps * 100 / linerate=0A= > =0A= > + latencys =3D self.tester.traffic_generator_latency(t= genInput)=0A= > + print latencys=0A= > +=0A= > + index +=3D 1=0A= > +=0A= > + # Stop l3fwd=0A= > + self.dut.send_expect("^C", "#")=0A= > +=0A= > + data_row =3D [frame_size, str(pps), str(pct)]=0A= > + dts.results_table_add_row(data_row)=0A= > +=0A= > + self.l3fwd_test_results['data'].append(data_row)=0A= > +=0A= > + dts.results_table_print()=0A= > +=0A= > + def no_test_perf_l3fwd_1ports_1S_2C_1T(self):=0A= > + """=0A= > + L3fwd main 1 ports.=0A= > + """=0A= > +=0A= > + header_row =3D ["Frame Size(bytes)", "Throughput(Mpps)", "linera= te%",=0A= > + "Latency Max(ns)", "Latency Average(ns)", "Laten= cy Min(ns)"]=0A= > + self.l3fwd_test_results['header'] =3D header_row=0A= > + dts.results_table_add_header(header_row)=0A= > + self.l3fwd_test_results['data'] =3D []=0A= > +=0A= > + for frame_size in TestL3fwd.frame_sizes:=0A= > +=0A= > + # Prepare traffic flow=0A= > + payload_size =3D frame_size - \=0A= > + HEADER_SIZE['ip'] - HEADER_SIZE['eth']=0A= > +=0A= > + flows =3D ['Ether()/%s/("X"*%d)' % (flow, payload_size)=0A= > + for flow in self.flows()[:1]]=0A= > +=0A= > + dts.report("Flows for 1 ports, %d frame size.\n" % (frame_si= ze),=0A= > + annex=3DTrue)=0A= > + dts.report("%s" % string.join(flows, '\n'),=0A= > + frame=3DTrue, annex=3DTrue)=0A= > +=0A= > + self.tester.scapy_append(=0A= > + 'wrpcap("test2ports.pcap", [%s])' % string.join(flows, '= ,'))=0A= > + self.tester.scapy_execute()=0A= > +=0A= > + # Prepare the command line=0A= > + global corelist=0A= > + global corelist_jumboframe=0A= > + pat =3D re.compile("P([0123]),([0123]),(C\{\d.\d.\d\})")=0A= > + coreMask =3D {}=0A= > +=0A= > + rtCmdLines =3D dict(TestL3fwd.test_cases_1_ports_1S_2C_1T)= =0A= > +=0A= > + for key in rtCmdLines.keys():=0A= > + corelist =3D []=0A= > + while pat.search(rtCmdLines[key]):=0A= > + rtCmdLines[key] =3D pat.sub(self.repl, rtCmdLines[ke= y])=0A= > + self.logger.info("%s\n" % str(corelist))=0A= > + coreMask[key] =3D dts.create_mask(set(corelist))=0A= > +=0A= > + # measure by two different mode=0A= > + for mode in TestL3fwd.methods:=0A= > +=0A= > + # start l3fwd=0A= > + index =3D 0=0A= > + subtitle =3D []=0A= > + for cores in rtCmdLines.keys():=0A= > +=0A= > + info =3D "Executing l3fwd using %s mode, 1 ports, %s= and %d frame size.\n" % (=0A= > + mode, cores, frame_size)=0A= > +=0A= > + self.logger.info(info)=0A= > + dts.report(info, annex=3DTrue)=0A= > +=0A= > + subtitle.append(cores)=0A= > +=0A= > + if frame_size =3D=3D 2048:=0A= > + cmdline =3D rtCmdLines[cores] % (TestL3fwd.path = + "l3fwd_" + mode, coreMask[cores],=0A= > + self.dut.get_memory_channels(), dts.create_mask= (valports[:1]))=0A= > + cmdline =3D cmdline + " --enable-jumbo --max-pkt= -len " + "%d" % frame_size=0A= > + else:=0A= > + cmdline =3D rtCmdLines[cores] % (TestL3fwd.path = + "l3fwd_" + mode, coreMask[cores],=0A= > + self.dut.get_memory_channels(), dts.create_mask= (valports[:1]))=0A= > +=0A= > + dts.report(cmdline + "\n", frame=3DTrue, annex=3DTru= e)=0A= > +=0A= > + out =3D self.dut.send_expect(cmdline, "L3FWD:", 120)= =0A= > +=0A= > + # Measure test=0A= > + tgenInput =3D []=0A= > + for rxPort in range(1):=0A= > + txIntf =3D self.tester.get_local_port(valports[r= xPort])=0A= > + rxIntf =3D self.tester.get_local_port(valports[r= xPort])=0A= > +=0A= > + tgenInput.append((txIntf, rxIntf, "test2ports.pc= ap"))=0A= > +=0A= > + _, pps =3D self.tester.traffic_generator_throughput(= =0A= > + tgenInput)=0A= > + self.verify(pps > 0, "No traffic detected")=0A= > + pps /=3D 1000000.0=0A= > + linerate =3D self.wirespeed(self.nic, frame_size, 1)= =0A= > + pct =3D pps * 100 / linerate=0A= > +=0A= > + latencys =3D self.tester.traffic_generator_latency(t= genInput)=0A= > + print latencys=0A= > +=0A= > + index +=3D 1=0A= > +=0A= > + # Stop l3fwd=0A= > + self.dut.send_expect("^C", "#")=0A= > +=0A= > + for latency in latencys:=0A= > + data_row =3D [frame_size, str(pps), str(pct), st= r(=0A= > + latency['max']), str(latency['average']), st= r(latency['min'])]=0A= > + dts.results_table_add_row(data_row)=0A= > + self.l3fwd_test_results['data'].append(data_row)=0A= > +=0A= > + dts.results_table_print()=0A= > +=0A= > + def test_perf_l3fwd_4ports_1S_1C_1T(self):=0A= > + """=0A= > + L3fwd main 4 ports.=0A= > + """=0A= > +=0A= > + # Based on h/w type, choose how many ports to use=0A= > + ports =3D self.dut.get_ports(self.nic)=0A= > + # Verify that enough ports are available=0A= > + self.verify(len(ports) >=3D 4, "Insufficient ports for speed tes= ting")=0A= > +=0A= > +# header_row =3D ["Frame size", "RX Queues/NIC Port", "S/C/T"]=0A= > + header_row =3D ["Frame Size(bytes)"]=0A= > +=0A= > + for method in TestL3fwd.methods:=0A= > + header_row.append('Throughput(Mpps)')=0A= > + header_row.append('linerate%')=0A= > +=0A= > + dts.results_table_add_header(header_row)=0A= > + self.l3fwd_test_results['header'] =3D header_row=0A= > + self.l3fwd_test_results['data'] =3D []=0A= > +=0A= > + for frame_size in TestL3fwd.frame_sizes:=0A= > +=0A= > + # Prepare traffic flow=0A= > + payload_size =3D frame_size - \=0A= > + HEADER_SIZE['ip'] - HEADER_SIZE['eth']=0A= > +=0A= > + for _port in range(4):=0A= > + =0A= > + dmac =3D self.dut.get_mac_address(valports[_port])=0A= > + print dmac,"\n"=0A= > + flows =3D ['Ether(dst=3D"%s")/%s/("X"*%d)' % (dmac, flow= , payload_size)=0A= > + for flow in self.flows()[_port * 2:(_port + 1) = * 2]]=0A= > + self.tester.scapy_append(=0A= > + 'wrpcap("dst%d.pcap", [%s])' % (valports[_port], str= ing.join(flows, ',')))=0A= > +=0A= > + self.tester.scapy_execute()=0A= > +=0A= > + dts.report("Flows for 4 ports, %d frame size.\n" % (frame_si= ze),=0A= > + annex=3DTrue)=0A= > + dts.report("%s" % string.join(flows, '\n'),=0A= > + frame=3DTrue, annex=3DTrue)=0A= > +=0A= > + # Get the number of sockets of the board=0A= > + number_sockets =3D self.dut.send_expect(=0A= > + "grep \"processor\|physical id\|core id\|^$\" /proc/cpui= nfo | grep physical | sort -u | wc -l", "# ")=0A= > + number_sockets =3D int(number_sockets.split('\r\n')[0])=0A= > +=0A= > + # Run case by case=0A= > + for test_case in TestL3fwd.test_cases_4_ports_1S_1C_1T:=0A= > +=0A= > + # Check if the board has sockets enough for the test cas= e=0A= > + if number_sockets >=3D int(test_case[1].split('/')[0][0]= ):=0A= > + self.get_throughput(frame_size, *test_case)=0A= > +=0A= > + dts.results_table_print()=0A= > +=0A= > + def test_perf_l3fwd_2ports_1S_2C_1T(self):=0A= > + """=0A= > + L3fwd main 2 ports.=0A= > + """=0A= > +=0A= > + header_row =3D ["Frame Size", "Throughput(Mpps)", "linerate%", "= LR_loss_pkts(2mins)", "LR_tx_pkts(2mins)", "LR_rx_pkts(2mins)"]=0A= > + self.l3fwd_test_results['header'] =3D header_row=0A= > + dts.results_table_add_header(header_row)=0A= > + self.l3fwd_test_results['data'] =3D []=0A= > +=0A= > + for frame_size in TestL3fwd.frame_sizes:=0A= > +=0A= > + # Prepare traffic flow=0A= > + payload_size =3D frame_size - \=0A= > + HEADER_SIZE['ip'] - HEADER_SIZE['eth']=0A= > +=0A= > + flows =3D ['Ether()/%s/("X"*%d)' % (flow, payload_size)=0A= > + for flow in self.flows()[:4]]=0A= > +=0A= > + dts.report("Flows for 2 ports, %d frame size.\n" % (frame_si= ze),=0A= > + annex=3DTrue)=0A= > + dts.report("%s" % string.join(flows, '\n'),=0A= > + frame=3DTrue, annex=3DTrue)=0A= > +=0A= > + self.tester.scapy_append(=0A= > + 'wrpcap("test2ports.pcap", [%s])' % string.join(flows, '= ,'))=0A= > + self.tester.scapy_execute()=0A= > +=0A= > + # Prepare the command line=0A= > + global corelist=0A= > + pat =3D re.compile("P([0123]),([0123]),(C\{\d.\d.\d\})")=0A= > + coreMask =3D {}=0A= > + rtCmdLines =3D dict(TestL3fwd.test_cases_2_ports_1S_2C_1T)= =0A= > + for key in rtCmdLines.keys():=0A= > + corelist =3D []=0A= > + while pat.search(rtCmdLines[key]):=0A= > + rtCmdLines[key] =3D pat.sub(self.repl, rtCmdLines[ke= y])=0A= > + self.logger.info("%s\n" % str(corelist))=0A= > + coreMask[key] =3D dts.create_mask(set(corelist))=0A= > +=0A= > + # measure by two different mode=0A= > + for mode in TestL3fwd.methods:=0A= > +=0A= > + # start l3fwd=0A= > + index =3D 0=0A= > + subtitle =3D []=0A= > + for cores in rtCmdLines.keys():=0A= > +=0A= > + info =3D "Executing l3fwd using %s mode, 2 ports, %s= and %d frame size.\n" % (=0A= > + mode, cores, frame_size)=0A= > +=0A= > + self.logger.info(info)=0A= > + dts.report(info, annex=3DTrue)=0A= > +=0A= > + subtitle.append(cores)=0A= > + if frame_size =3D=3D 2048:=0A= > + cmdline =3D rtCmdLines[cores] % (TestL3fwd.path = + "l3fwd_" + mode, coreMask[cores],=0A= > + self.dut.get_memory_channels(), dts.create_mask= (valports[:2]))=0A= > +=0A= > + cmdline =3D cmdline + " --enable-jumbo --max-pkt= -len " + "%d" % frame_size=0A= > + else:=0A= > + cmdline =3D rtCmdLines[cores] % (TestL3fwd.path = + "l3fwd_" + mode, coreMask[cores],=0A= > + self.dut.get_memory_channels(), dts.create_mask= (valports[:2]))=0A= > +=0A= > + dts.report(cmdline + "\n", frame=3DTrue, annex=3DTru= e)=0A= > +=0A= > + out =3D self.dut.send_expect(cmdline, "L3FWD:", 120)= =0A= > +=0A= > + # Measure test=0A= > + tgenInput =3D []=0A= > + for rxPort in range(2):=0A= > + # No use on rx/tx limitation=0A= > + if rxPort % 2 =3D=3D 0:=0A= > + txIntf =3D self.tester.get_local_port(=0A= > + valports[rxPort + 1])=0A= > + else:=0A= > + txIntf =3D self.tester.get_local_port(=0A= > + valports[rxPort - 1])=0A= > +=0A= > + rxIntf =3D self.tester.get_local_port(valports[r= xPort])=0A= > +=0A= > + tgenInput.append((txIntf, rxIntf, "test2ports.pc= ap"))=0A= > +=0A= > + _, pps =3D self.tester.traffic_generator_throughput(= =0A= > + tgenInput)=0A= > + self.verify(pps > 0, "No traffic detected")=0A= > + pps /=3D 1000000.0=0A= > + linerate =3D self.wirespeed(self.nic, frame_size, 2)= =0A= > + pct =3D pps * 100 / linerate=0A= > + zero_loss_rate, tx_num, rx_num =3D self.RFC2544(tgenInput)=0A= > + loss_num =3D tx_num - rx_num=0A= > +=0A= > + latencys =3D self.tester.traffic_generator_latency(t= genInput)=0A= > + print latencys=0A= > +=0A= > + index +=3D 1=0A= > +=0A= > + # Stop l3fwd=0A= > + self.dut.send_expect("^C", "#")=0A= > +=0A= > + data_row =3D [frame_size, str(pps), str(pct), str(lo= ss_num), str(tx_num), str(rx_num)]=0A= > + dts.results_table_add_row(data_row)=0A= > +=0A= > + self.l3fwd_test_results['data'].append(data_row)=0A= > +=0A= > + dts.results_table_print()=0A= > +=0A= > + def test_perf_l3fwd_1ports_1S_1C_1T(self):=0A= > + """=0A= > + L3fwd main 1 ports.=0A= > + """=0A= > +=0A= > + header_row =3D ["Frame Size(bytes)", "Throughput(Mpps)", "linera= te%",=0A= > + "Latency Max(ns)", "Latency Average(ns)", "Laten= cy Min(ns)"]=0A= > + self.l3fwd_test_results['header'] =3D header_row=0A= > + dts.results_table_add_header(header_row)=0A= > + self.l3fwd_test_results['data'] =3D []=0A= > +=0A= > + for frame_size in TestL3fwd.frame_sizes:=0A= > +=0A= > + # Prepare traffic flow=0A= > + payload_size =3D frame_size - \=0A= > + HEADER_SIZE['ip'] - HEADER_SIZE['eth']=0A= > +=0A= > + flows =3D ['Ether()/%s/("X"*%d)' % (flow, payload_size)=0A= > + for flow in self.flows()[:1]]=0A= > +=0A= > + dts.report("Flows for 1 ports, %d frame size.\n" % (frame_si= ze),=0A= > + annex=3DTrue)=0A= > + dts.report("%s" % string.join(flows, '\n'),=0A= > + frame=3DTrue, annex=3DTrue)=0A= > +=0A= > + self.tester.scapy_append(=0A= > + 'wrpcap("test2ports.pcap", [%s])' % string.join(flows, '= ,'))=0A= > + self.tester.scapy_execute()=0A= > +=0A= > + # Prepare the command line=0A= > + global corelist=0A= > + global corelist_jumboframe=0A= > + pat =3D re.compile("P([0123]),([0123]),(C\{\d.\d.\d\})")=0A= > + coreMask =3D {}=0A= > +=0A= > + rtCmdLines =3D dict(TestL3fwd.test_cases_1_ports_1S_1C_1T)= =0A= > +=0A= > + for key in rtCmdLines.keys():=0A= > + corelist =3D []=0A= > + while pat.search(rtCmdLines[key]):=0A= > + rtCmdLines[key] =3D pat.sub(self.repl, rtCmdLines[ke= y])=0A= > + self.logger.info("%s\n" % str(corelist))=0A= > + coreMask[key] =3D dts.create_mask(set(corelist))=0A= > +=0A= > + # measure by two different mode=0A= > + for mode in TestL3fwd.methods:=0A= > +=0A= > + # start l3fwd=0A= > + index =3D 0=0A= > + subtitle =3D []=0A= > + for cores in rtCmdLines.keys():=0A= > +=0A= > + info =3D "Executing l3fwd using %s mode, 1 ports, %s= and %d frame size.\n" % (=0A= > + mode, cores, frame_size)=0A= > +=0A= > + self.logger.info(info)=0A= > + dts.report(info, annex=3DTrue)=0A= > +=0A= > + subtitle.append(cores)=0A= > +=0A= > + if frame_size =3D=3D 2048:=0A= > + cmdline =3D rtCmdLines[cores] % (TestL3fwd.path = + "l3fwd_" + mode, coreMask[cores],=0A= > + self.dut.get_memory_channels(), dts.create_mask= (valports[:1]))=0A= > +=0A= > + cmdline =3D cmdline + " --enable-jumbo --max-pkt= -len " + "%d" % frame_size=0A= > + else:=0A= > + cmdline =3D rtCmdLines[cores] % (TestL3fwd.path = + "l3fwd_" + mode, coreMask[cores],=0A= > + self.dut.get_memory_channels(), dts.create_mask= (valports[:1]))=0A= > +=0A= > + dts.report(cmdline + "\n", frame=3DTrue, annex=3DTru= e)=0A= > +=0A= > + out =3D self.dut.send_expect(cmdline, "L3FWD:", 120)= =0A= > +=0A= > + # Measure test=0A= > + tgenInput =3D []=0A= > + for rxPort in range(1):=0A= > + txIntf =3D self.tester.get_local_port(valports[r= xPort])=0A= > + rxIntf =3D self.tester.get_local_port(valports[r= xPort])=0A= > +=0A= > + tgenInput.append((txIntf, rxIntf, "test2ports.pc= ap"))=0A= > +=0A= > + _, pps =3D self.tester.traffic_generator_throughput(= =0A= > + tgenInput)=0A= > + self.verify(pps > 0, "No traffic detected")=0A= > + pps /=3D 1000000.0=0A= > + linerate =3D self.wirespeed(self.nic, frame_size, 1)= =0A= > + pct =3D pps * 100 / linerate=0A= > +=0A= > + latencys =3D self.tester.traffic_generator_latency(t= genInput)=0A= > + print latencys=0A= > +=0A= > index +=3D 1=0A= > =0A= > # Stop l3fwd=0A= > self.dut.send_expect("^C", "#")=0A= > =0A= > - data_row =3D [frame_size, 2, cores, str(pps), str(pc= t), mode]=0A= > + for latency in latencys:=0A= > + data_row =3D [frame_size, str(pps), str(pct), st= r(=0A= > + latency['max']), str(latency['average']), st= r(latency['min'])]=0A= > dts.results_table_add_row(data_row)=0A= > self.l3fwd_test_results['data'].append(data_row)=0A= > =0A= > - self.plot_2_ports()=0A= > dts.results_table_print()=0A= > =0A= > def ip(self, port, frag, src, proto, tos, dst, chksum, len, options,= version, flags, ihl, ttl, id):=0A= =0A=