From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B57ADA0487 for ; Wed, 3 Jul 2019 07:46:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A9D5E4CE4; Wed, 3 Jul 2019 07:46:42 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 15D641E20 for ; Wed, 3 Jul 2019 07:46:40 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2019 22:46:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,446,1557212400"; d="scan'208";a="247508714" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 02 Jul 2019 22:46:40 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 2 Jul 2019 22:46:40 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 2 Jul 2019 22:46:39 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.134]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.174]) with mapi id 14.03.0439.000; Wed, 3 Jul 2019 13:46:38 +0800 From: "Tu, Lijuan" To: "Han, YingyaX" , "dts@dpdk.org" CC: "Han, YingyaX" Thread-Topic: [dts] [PATCH V2]tests/vf_l3fwd: use the new pktgen API and change the configuration for flow Thread-Index: AQHVMI2iO+Ivn50OfE2qSLREMKyuUKa4ZDwA Date: Wed, 3 Jul 2019 05:46:37 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BAD91D2@SHSMSX101.ccr.corp.intel.com> References: <20190702122151.40732-1-yingyax.han@intel.com> In-Reply-To: <20190702122151.40732-1-yingyax.han@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: 11.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiM2NmYWI1MzMtZmMyZC00ZjZkLWFhYWMtOThmNTBkZTc1Y2FhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVVZ5N1BEaUFaWjhtOTBIV0FucEtGUzdhWk1NTkxKSE1seTdBb1ZLUzVsNFwvUEozSHFvdGk5bFpVZE94aTVZRkQifQ== 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]tests/vf_l3fwd: use the new pktgen API and change the configuration for flow 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of hanyingya > Sent: Tuesday, July 2, 2019 8:22 PM > To: dts@dpdk.org > Cc: Han, YingyaX > Subject: [dts] [PATCH V2]tests/vf_l3fwd: use the new pktgen API and chang= e > the configuration for flow >=20 > Signed-off-by: hanyingya > --- > tests/TestSuite_vf_l3fwd.py | 88 +++++++++++++++++++++++-------------- > 1 file changed, 54 insertions(+), 34 deletions(-) >=20 > diff --git a/tests/TestSuite_vf_l3fwd.py b/tests/TestSuite_vf_l3fwd.py in= dex > e150a64..cf16dec 100644 > --- a/tests/TestSuite_vf_l3fwd.py > +++ b/tests/TestSuite_vf_l3fwd.py > @@ -29,17 +29,17 @@ > # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF > THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > SUCH DAMAGE. >=20 > -import re > import time > +import os > import string > - > import utils > from test_case import TestCase > from pmd_output import PmdOutput > -from etgen import IxiaPacketGenerator > from settings import HEADER_SIZE > +from pktgen import PacketGeneratorHelper > + >=20 > -class TestVfL3fwd(TestCase, IxiaPacketGenerator): > +class TestVfL3fwd(TestCase): >=20 > supported_vf_driver =3D ['pci-stub', 'vfio-pci'] >=20 > @@ -91,6 +91,16 @@ class TestVfL3fwd(TestCase, IxiaPacketGenerator): > self.vf_assign_method =3D 'vfio-pci' > self.dut.send_expect('modprobe vfio-pci', '#') >=20 > + # get dts output path > + if self.logger.log_path.startswith(os.sep): > + self.output_path =3D self.logger.log_path > + else: > + cur_path =3D os.path.dirname( > + os.path.dirname(os.path.realpath(__file_= _))) > + self.output_path =3D os.sep.join([cur_path, self.logger.log_= path]) > + # create an instance to set stream field setting > + self.pktgen_helper =3D PacketGeneratorHelper() > + > def set_up(self): > """ > Run before each test case. > @@ -144,7 +154,7 @@ class TestVfL3fwd(TestCase, IxiaPacketGenerator): > self.host_testpmd.execute_cmd('quit', '# ') > self.host_testpmd =3D None > for i in valports: > - if getattr(self, '%d' % self.used_dut_port[i] , None) !=3D N= one: > + if getattr(self, '%d' % self.used_dut_port[i], None) is not = None: > self.dut.destroy_sriov_vfs_by_port(self.used_dut_port[i]= ) > port =3D self.dut.ports_info[self.used_dut_port[i]]['por= t'] > port.bind_driver() > @@ -175,26 +185,36 @@ class TestVfL3fwd(TestCase, IxiaPacketGenerator): > dmac =3D self.vfs_mac > smac =3D ["02:00:00:00:00:0%d" % i for i in valports] > payload_size =3D frame_size - HEADER_SIZE['ip'] - HEADER_SIZE['e= th'] > + pcaps =3D {} > for _port in valports: > - flows =3D ['Ether(dst=3D"%s", src=3D"%s")/%s/("X"*%d)' % (dm= ac[_port], > smac[_port], flow, payload_size) for > - flow in self.flows()[_port*2:(_port + 1)*2]] > - self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' % > (valports[_port], string.join(flows, ','))) > - self.tester.scapy_execute() > + index =3D valports[_port] > + cnt =3D 0 > + for layer in self.flows()[_port * 2:(_port + 1) * 2]: > + flow =3D ['Ether(dst=3D"%s", src=3D"%s")/%s/("X"*%d)' % = (dmac[index], > smac[index], layer, payload_size)] > + pcap =3D os.sep.join([self.output_path, > "dst{0}_{1}.pcap".format(index, cnt)]) > + self.tester.scapy_append('wrpcap("%s", [%s])' % (pcap, > string.join(flow, ','))) > + self.tester.scapy_execute() > + if index not in pcaps: > + pcaps[index] =3D [] > + pcaps[index].append(pcap) > + cnt +=3D 1 > + return pcaps >=20 > - def prepare_steam(self): > + def prepare_steam(self, pcaps): > """ > create streams for ports,one port one stream > """ > tgen_input =3D [] > for rxPort in valports: > - if rxPort % len(valports) =3D=3D 0 or rxPort % len(valports)= =3D=3D 2: > + if rxPort % len(valports) =3D=3D 0 or len(valports) % rxPort= =3D=3D 2: > txIntf =3D self.tester.get_local_port(valports[rxPort + = 1]) > - rxIntf =3D self.tester.get_local_port(valports[rxPort]) > - tgen_input.append((txIntf, rxIntf, "dst%d.pcap" % > valports[rxPort+1])) > - elif rxPort % len(valports) =3D=3D 1 or rxPort % len(valport= s) =3D=3D 3: > + port_id =3D valports[rxPort + 1] > + else: > txIntf =3D self.tester.get_local_port(valports[rxPort - = 1]) > - rxIntf =3D self.tester.get_local_port(valports[rxPort]) > - tgen_input.append((txIntf, rxIntf, "dst%d.pcap" % valpor= ts[rxPort- > 1])) > + port_id =3D valports[rxPort - 1] > + rxIntf =3D self.tester.get_local_port(valports[rxPort]) > + for pcap in pcaps[port_id]: > + tgen_input.append((txIntf, rxIntf, pcap)) > return tgen_input >=20 > def perf_test(self, cmdline): > @@ -207,8 +227,7 @@ class TestVfL3fwd(TestCase, IxiaPacketGenerator): > self.result_table_create(header_row) > self.l3fwd_test_results['data'] =3D [] > for frame_size in self.frame_sizes: > - self.create_pacap_file(frame_size) > - > + pcaps =3D self.create_pacap_file(frame_size) > for mode in self.l3fwd_methods: > info =3D "Executing l3fwd using %s mode, %d ports, %d fr= ame > size.\n" % (mode, len(valports), frame_size) > self.logger.info(info) > @@ -216,8 +235,17 @@ class TestVfL3fwd(TestCase, IxiaPacketGenerator): > cmdline =3D cmdline + " --max-pkt-len %d" % frame_si= ze > l3fwd_session.send_expect(cmdline, "L3FWD:", 120) > # send the traffic and Measure test > - tgenInput =3D self.prepare_steam() > - _, pps =3D self.tester.traffic_generator_throughput(tgen= Input, > rate_percent=3D100, delay=3D30) > + tgenInput =3D self.prepare_steam(pcaps) > + > + vm_config =3D self.set_fields() > + # clear streams before add new streams > + self.tester.pktgen.clear_streams() > + # run packet generator > + streams =3D > self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100, vm_config, > self.tester.pktgen) > + # set traffic option > + traffic_opt =3D {'delay': 30} > + # _, pps =3D self.tester.traffic_generator_throughput(tg= enInput, > rate_percent=3D100, delay=3D30) > + _, pps =3D > + self.tester.pktgen.measure_throughput(stream_ids=3Dstreams, > + options=3Dtraffic_opt) > self.verify(pps > 0, "No traffic detected") > pps /=3D 1000000.0 > linerate =3D self.wirespeed(self.nic, frame_size, len(va= lports)) @@ - > 265,20 +293,12 @@ class TestVfL3fwd(TestCase, IxiaPacketGenerator): >=20 > self.measure_vf_performance(host_driver=3Dself.vf_driver) >=20 > - def ip(self, port, frag, src, proto, tos, dst, chksum, len, options,= version, > flags, ihl, ttl, id): > - > - self.add_tcl_cmd("protocol config -name ip") > - self.add_tcl_cmd('ip config -sourceIpAddr "%s"' % src) > - self.add_tcl_cmd("ip config -sourceIpAddrMode ipRandom") > - self.add_tcl_cmd('ip config -destIpAddr "%s"' % dst) > - self.add_tcl_cmd("ip config -destIpAddrMode ipIdle") > - self.add_tcl_cmd("ip config -ttl %d" % ttl) > - self.add_tcl_cmd("ip config -totalLength %d" % len) > - self.add_tcl_cmd("ip config -fragment %d" % frag) > - self.add_tcl_cmd("ip config -ipProtocol ipV4ProtocolReserved255"= ) > - self.add_tcl_cmd("ip config -identifier %d" % id) > - self.add_tcl_cmd("stream config -framesize %d" % (len + 18)) > - self.add_tcl_cmd("ip set %d %d %d" % (self.chasId, port['card'], > port['port'])) > + def set_fields(self): > + """ > + set ip protocol field behavior > + """ > + fields_config =3D {'ip': {'src': {'action': 'random'}, }, } > + return fields_config >=20 > def tear_down(self): >=20 > -- > 2.17.1