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 C13FCA0562; Tue, 31 Mar 2020 05:05:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B10B51C07C; Tue, 31 Mar 2020 05:05:55 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id B617A1C06A for ; Tue, 31 Mar 2020 05:05:53 +0200 (CEST) IronPort-SDR: qnZOx1EARqVXv7DVK43iRPNIN2iNzUjp05A31NdmPfBx+DR81u4wlPqDk0n3Tj5VzjyD3sv1h9 Ru3/3lMV7YaA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2020 20:05:52 -0700 IronPort-SDR: HIgbkZIPyCIKHrTdmt6FPfG2hte594NWhuwLk9XRahoItOclj9g9oLZfBJ87JxaHl6ccoaxgpz +il2Ome1EEkg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,326,1580803200"; d="scan'208";a="450012290" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 30 Mar 2020 20:05:52 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 30 Mar 2020 20:05:52 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 30 Mar 2020 20:05:51 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 30 Mar 2020 20:05:51 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by shsmsx102.ccr.corp.intel.com ([169.254.2.138]) with mapi id 14.03.0439.000; Tue, 31 Mar 2020 11:05:48 +0800 From: "Tu, Lijuan" To: "Han, YingyaX" , "dts@dpdk.org" CC: "Han, YingyaX" Thread-Topic: [dts] [PATCH V2]tests/vmdq: vmdq script refactoring Thread-Index: AQHWAmK2O9PSPCg+HEKriDuc8H7u6ahiDb8A Date: Tue, 31 Mar 2020 03:05:47 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BC034FF@SHSMSX101.ccr.corp.intel.com> References: <1585112902-137050-1-git-send-email-yingyax.han@intel.com> In-Reply-To: <1585112902-137050-1-git-send-email-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.2.0.6 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 V2]tests/vmdq: vmdq script refactoring 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: Wednesday, March 25, 2020 1:08 PM > To: dts@dpdk.org > Cc: Han, YingyaX > Subject: [dts] [PATCH V2]tests/vmdq: vmdq script refactoring >=20 > script refactoring and enable rss. >=20 > Signed-off-by: hanyingya > --- > tests/TestSuite_vmdq.py | 328 +++++++++++++++++----------------------- > 1 file changed, 142 insertions(+), 186 deletions(-) >=20 > diff --git a/tests/TestSuite_vmdq.py b/tests/TestSuite_vmdq.py index > 623d728..cb6bdf0 100644 > --- a/tests/TestSuite_vmdq.py > +++ b/tests/TestSuite_vmdq.py > @@ -11,44 +11,52 @@ import os > import re > from test_case import TestCase > from time import sleep > +from settings import HEADER_SIZE > from pktgen import PacketGeneratorHelper >=20 > + > class TestVmdq(TestCase): > - dut_ports =3D [] > - ip_dot1q_header_size =3D 22 > - default_framesize =3D 64 > - default_payload =3D default_framesize - ip_dot1q_header_size > - current_frame_size =3D 0 > - destmac_port0 =3D "52:54:00:12:00:00" > - destmac_port1 =3D "52:54:00:12:01:00" > - da_repeat =3D 1 > - vlan_repeat =3D 1 > - queues =3D 8 >=20 > def set_up_all(self): > """ > Run at the start of each test suite. > """ > self.tester.extend_external_packet_generator(TestVmdq, self) > - > + > + self.dut_ports =3D self.dut.get_ports(self.nic) > + self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports") > + self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) > + > self.dut.send_expect("sed -i > 's/CONFIG_RTE_MAX_QUEUES_PER_PORT=3D256/CONFIG_RTE_MAX_QUEUES_ > PER_PORT=3D1024/' ./config/common_base", "# ", 5) > - > self.dut.build_install_dpdk(self.target) > # Update the max queue per port for Fortville. > self.dut.send_expect("sed -i 's/define MAX_QUEUES 128/define > MAX_QUEUES 1024/' ./examples/vmdq/main.c", "#", 5) > - > - self.dut_ports =3D self.dut.get_ports(self.nic) > - self.verify(len(self.dut_ports) >=3D 2, "Insufficient ports") > + out =3D self.dut.send_expect("make -C examples/vmdq", "#", 10) > + self.verify("Error" not in out, "Compilation error") >=20 > + self.frame_size =3D 64 > + self.header_size =3D HEADER_SIZE['ip'] + HEADER_SIZE['eth'] > + self.destmac_port =3D ["52:54:00:12:0%d:00" % i for i in > + self.dut_ports] > self.core_configs =3D [] > self.core_configs.append({'cores': '1S/1C/1T', 'mpps': {}}) > self.core_configs.append({'cores': '1S/2C/1T', 'mpps': {}}) > self.core_configs.append({'cores': '1S/2C/2T', 'mpps': {}}) > self.core_configs.append({'cores': '1S/4C/1T', 'mpps': {}}) >=20 > - self.ports_socket =3D self.dut.get_numa_id(self.dut_ports[0]) > - out =3D self.dut.send_expect("make -C examples/vmdq", "#", 10) > - self.verify("Error" not in out, "Compilation error") > + # Put different number of pools: in the case of 10G 82599 Nic is= 64, in > the case > + # of FVL spirit is 63,in case of FVL eagle is 34. > + if self.nic in ("niantic", "springfountain"): > + self.pools =3D 64 > + elif self.nic in ("fortville_spirit", "fortville_spirit_single")= : > + self.pools =3D 63 > + elif self.nic in ("fortville_eagle"): > + self.pools =3D 34 > + else: > + self.pools =3D 8 > + > + # get dts output path > + if self.logger.log_path.startswith(os.sep): > + self.output_path =3D self.logger.log_path > # get dts output path > if self.logger.log_path.startswith(os.sep): > self.output_path =3D self.logger.log_path @@ -58,208 +66,137= @@ > class TestVmdq(TestCase): > 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() > + self.prios =3D range(8) >=20 > - def validateApproxEqual(self, lines): > + def set_up(self): > """ > - Check that all the rx queue stats are within a 30% range. > + Run before each test case. > """ > - minimum =3D 1000000 > - maximun =3D 0 > + pass >=20 > - # Need to use Python re package because utils.regexp only handle= s 1 > group, > - # we need 4. > - scanner =3D re.compile( > - "^Pool [0-9]+: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)$") > - for l in lines: > - m =3D scanner.search(l) > - if m is None: > - # Line at the end, "Finished handling signal", ignore > - pass > - else: > - for stat in m.groups(): > - if stat < minimum: > - minimum =3D stat > - if stat > maximun: > - maximun =3D stat > - self.verify(maximun - minimum <=3D minimum * > - 0.3, "Too wide variation in queue stats") > - > - def Npools_128queues(self, npools): > + def start_application(self, npools, core_config): > """ > - MAX queues is 128 > - queues/pools =3D 128/npools > + Prepare the commandline and start vmdq app > """ > - self.current_frame_size =3D self.default_framesize > - > - self.dut_ports =3D self.dut.get_ports(self.nic) > - > - core_list =3D self.dut.get_core_list("1S/4C/1T", socket=3Dself.p= orts_socket) > + core_list =3D self.dut.get_core_list(core_config, socket=3Dself.= ports_socket) > + self.verify(core_list is not None, "Requested cores failed") > core_mask =3D utils.create_mask(core_list) > - > - port_mask =3D utils.create_mask([self.dut_ports[0], self.dut_por= ts[1]]) > + port_mask =3D utils.create_mask(self.dut_ports) > # Run the application > - out =3D self.dut.send_expect("./examples/vmdq/build/vmdq_app -n = 4 - > c %s -- -p %s --nb-pools %s&" % > - (core_mask, port_mask, str(npools)), = "reading queues", > 120) > + self.dut.send_expect("./examples/vmdq/build/vmdq_app -c %s -n 4 = -- - > p %s --nb-pools %s --enable-rss" % > + (core_mask, port_mask, str(npools)), > + "reading queues", 120) >=20 > - # Transmit traffic > + def get_tgen_input(self, prios): > + """ > + create streams for ports. > + """ > tx_port =3D self.tester.get_local_port(self.dut_ports[0]) > rx_port =3D self.tester.get_local_port(self.dut_ports[1]) > - tx_mac =3D self.tester.get_mac(tx_port) > - > - self.vlan_repeat =3D npools > - self.da_repeat =3D npools > tgen_input =3D [] > - for p in range(8): > - self.tester.scapy_append('dmac=3D"%s"' % self.destmac_port0) > - self.tester.scapy_append('smac=3D"%s"' % tx_mac) > - self.tester.scapy_append( > - 'flows =3D [Ether(src=3Dsmac, dst=3Ddmac)/Dot1Q(vlan=3D0= ,prio=3D%d)]'%p) > + for prio in prios: > + pcap =3D os.sep.join([self.output_path, "%s%d.pcap" % > (self.suite_name, prio)]) > + tgen_input.append((tx_port, rx_port, "%s" % pcap)) > + return tgen_input >=20 > - pcap =3D os.sep.join([self.output_path, "test%d.pcap" % p]) > - self.tester.scapy_append('wrpcap("%s", flows)' %pcap) > - > - self.tester.scapy_execute() > - tgen_input.append((tx_port, rx_port, "%s" %pcap)) > - > - self.tester.pktgen.clear_streams() > - vm_config =3D self.set_fields() > - # run packet generator > - streams =3D self.pktgen_helper.prepare_stream_from_tginput(tgen_= input, > 10, > - vm_config, self.= tester.pktgen) > - loss =3D self.tester.pktgen.measure_loss(stream_ids=3Dstreams) > - self.logger.info("loss is {}!".format(loss)) > + def create_pcaps(self, prios): > + """ > + create traffic flows to pcap files > + """ > + payload =3D self.frame_size - self.header_size > + for prio in prios: > + self.tester.scapy_append( > + 'flows =3D [Ether(dst=3D"%s")/Dot1Q(vlan=3D0,prio=3D%d)/= IP(src=3D"1.2.3.4", > dst=3D"1.1.1.1")/("X"*%d)]' > + % (self.destmac_port[0], prio, payload)) > + pcap =3D os.sep.join([self.output_path, "%s%d.pcap" % > (self.suite_name, prio)]) > + self.tester.scapy_append('wrpcap("%s", flows)' % pcap) > + self.tester.scapy_execute() >=20 > - # Verify the accurate > - self.verify(loss[0]/100 < 0.001, "Excessive packet loss") > + def verify_all_vmdq_stats(self): > + """ > + Every RX queue should have received approximately (+/-15%) the s= ame > number of incoming packets. > + """ > out =3D self.get_vmdq_stats() > - self.validateApproxEqual(out.split("\r\n")) > + lines_list =3D out.split("\r\n") > + nb_packets =3D [] > + for pool_info in lines_list: > + if pool_info.startswith('Pool'): > + nb_packets +=3D pool_info.split()[2:] > + nb_packets =3D list(map(int, nb_packets)) > + self.verify(min(nb_packets) > 0, "Some queues don't get any pack= et!") > + self.verify(float((max(nb_packets) - min(nb_packets))/max(nb_pac= kets)) > <=3D 0.15, > + "Too wide variation in queue stats") >=20 > def get_vmdq_stats(self): > - vmdq_dcb_session =3D self.dut.new_session() > - vmdq_dcb_session.send_expect("kill -s SIGHUP `pgrep -fl vmdq_ap= p | > awk '{print $1}'`", "#", 20) > + vmdq_session =3D self.dut.new_session() > + vmdq_session.send_expect("kill -s SIGHUP `pgrep -fl vmdq_app | > + awk '{print $1}'`", "#", 20) > out =3D self.dut.get_session_output() > self.logger.info(out) > - vmdq_dcb_session.close() > + vmdq_session.close() > return out >=20 > - def set_up(self): > + def test_perf_vmdq_max_queues(self): > """ > - Run before each test case. > + Every RX queue should have received approximately (+/-15%) the s= ame > number of > + incoming packets. > """ > - self.dut.kill_all() > - > - def test_perf_vmdq_64pools_queues(self): > - """ > - This function call "Npools_128queues" with different number > - of pools. Details see below. If not sure, set it as 8 pools. > - """ > - if self.nic in ("niantic", "springfountain"): > - self.Npools_128queues(64) > - elif self.nic in ("fortville_spirit", "fortville_spirit_single")= : > - self.Npools_128queues(63) > - elif self.nic in ("fortville_eagle"): > - self.Npools_128queues(34) > - else: > - self.Npools_128queues(8) > + # Run the application > + self.start_application(self.pools, "1S/4C/1T") > + # Transmit traffic > + self.create_pcaps(self.prios) > + tgen_input =3D self.get_tgen_input(self.prios) > + vm_config =3D self.set_fields(self.pools, self.pools) > + # Start traffic transmission using approx 10% of line rate. > + ratePercent =3D 10 > + # run packet generator > + streams =3D > self.pktgen_helper.prepare_stream_from_tginput(tgen_input, ratePercent, > vm_config, self.tester.pktgen) > + # set traffic option > + options =3D {'duration': 15} > + loss =3D self.tester.pktgen.measure_loss(stream_ids=3Dstreams, > options=3Doptions) > + self.logger.info("loss is [loss rate, SendNumbers, > ReceNumbers]{}!".format(loss)) > + # Verify there is no packet loss > + self.verify(loss[1] =3D=3D loss[2], "Packet Loss! Send: %d, but = only > Receive: %d!".format(loss[1], loss[2])) > + self.verify_all_vmdq_stats() > + > + def create_throughput_traffic(self, frame_size): > + payload =3D frame_size - self.header_size > + tgen_Input =3D [] > + for _port in self.dut_ports: > + if _port % len(self.dut_ports) =3D=3D 0 or len(self.dut_port= s) % _port =3D=3D 2: > + txIntf =3D self.tester.get_local_port(self.dut_ports[_po= rt + 1]) > + else: > + txIntf =3D self.tester.get_local_port(self.dut_ports[_po= rt - 1]) > + rxIntf =3D self.tester.get_local_port(self.dut_ports[_port]) > + self.tester.scapy_append('flows =3D > [Ether(dst=3D"%s")/Dot1Q(vlan=3D0)/("X"*%d)]' > + % (self.destmac_port[txIntf], paylo= ad)) > + pcap =3D os.sep.join([self.output_path, "%s-%d.pcap" % > (self.suite_name, _port)]) > + self.tester.scapy_append('wrpcap("%s", flows)' % pcap) > + self.tester.scapy_execute() > + tgen_Input.append((txIntf, rxIntf, pcap)) > + return tgen_Input >=20 > def test_perf_vmdq_performance(self): > """ > Try different configuration and different packet size > """ > - self.tester.get_interface( > - self.tester.get_local_port(self.dut_ports[0])) > - > frame_sizes =3D [64, 128, 256, 512, 1024, 1280, 1518] > for config in self.core_configs: > - > self.logger.info(config["cores"]) > self.dut.kill_all() > - > core_config =3D config['cores'] > - core_list =3D self.dut.get_core_list(core_config,socket=3Dse= lf.ports_socket) > - core_mask =3D utils.create_mask(core_list) > - portmask =3D utils.create_mask(self.dut.get_ports()) > - if self.nic in ("niantic", "springfountain"): > - self.queues =3D 64 > - self.dut.send_expect( > - "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s -= -nb- > pools 64&" % > - (self.dut.get_memory_channels(), core_mask, portmask= ), > "reading queues", 30) > - elif self.nic in ("fortville_spirit", "fortville_spirit_sing= le"): > - self.queues =3D 63 > - self.dut.send_expect( > - "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s -= -nb- > pools 63&" % > - (self.dut.get_memory_channels(), core_mask, portmask= ), > "reading queues", 30) > - elif self.nic in ("fortville_eagle"): > - self.queues =3D 34 > - self.dut.send_expect( > - "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s -= -nb- > pools 34&" % > - (self.dut.get_memory_channels(), core_mask, portmask= ), > "reading queues", 30) > - else: > - self.queues =3D 8 > - self.dut.send_expect( > - "examples/vmdq/build/vmdq_app -n %d -c %s -- -p %s -= -nb- > pools 8&" % > - (self.dut.get_memory_channels(), core_mask, portmask= ), > "reading queues", 30) > - > - tx_port =3D self.tester.get_local_port(self.dut_ports[0]) > - rx_port =3D self.tester.get_local_port(self.dut_ports[1]) > - > + self.start_application(self.pools, core_config) > self.logger.info("Waiting for application to initialize") > sleep(5) > - > for frame_size in frame_sizes: > - TestVmdq.current_frame_size =3D frame_size > self.logger.info(str(frame_size)) > - > - self.tester.scapy_append('dstmac=3D"%s"' % self.destmac_= port0) > - tx_mac =3D self.tester.get_mac(tx_port) > - self.tester.scapy_append('srcmac=3D"%s"' % tx_mac) > - self.tester.scapy_append( > - 'flows =3D > [Ether(src=3Dsrcmac,dst=3Ddstmac)/Dot1Q(vlan=3D0)/("X"*%d)]' % > - (frame_size - TestVmdq.ip_dot1q_header_size)) > - > - pcap =3D os.sep.join([self.output_path, "test1.pcap"]) > - self.tester.scapy_append('wrpcap("%s", flows)' %pcap) > - > - self.tester.scapy_execute() > - > - self.tester.scapy_append('dstmac=3D"%s"' % self.destmac_= port1) > - tx_mac =3D self.tester.get_mac(rx_port) > - self.tester.scapy_append('srcmac=3D"%s"' % tx_mac) > - self.tester.scapy_append( > - 'flows =3D > [Ether(src=3Dsrcmac,dst=3Ddstmac)/Dot1Q(vlan=3D0)/("X"*%d)]' % > - (frame_size - TestVmdq.ip_dot1q_header_size)) > - > - pcap =3D os.sep.join([self.output_path, "test2.pcap"]) > - self.tester.scapy_append('wrpcap("%s", flows)' % pcap) > - > - self.tester.scapy_execute() > - > - self.vlan_repeat =3D self.queues > - self.da_repeat =3D self.queues > - > - tgen_input =3D [] > - > - pcap1 =3D os.sep.join([self.output_path, "test1.pcap"]) > - pcap2 =3D os.sep.join([self.output_path, "test2.pcap"]) > - > - tgen_input.append((tx_port, rx_port, pcap1)) > - tgen_input.append((rx_port, tx_port, pcap2)) > - > + tgen_input =3D self.create_throughput_traffic(frame_size= ) > # clear streams before add new streams > self.tester.pktgen.clear_streams() > - vm_config =3D self.set_fields() > + vm_config =3D self.set_fields(self.pools, self.pools) > # run packet generator > - streams =3D > self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, > - vm_config, self.test= er.pktgen) > + streams =3D > + self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, > + vm_config, self.tester.pktgen) > _, pps =3D > self.tester.pktgen.measure_throughput(stream_ids=3Dstreams) > - > - config['mpps'][frame_size] =3D pps/1000000.0 > - > - for n in range(len(self.core_configs)): > - for size in frame_sizes: > - self.verify( > - self.core_configs[n]['mpps'][size] is not 0, "No tra= ffic detected") > - > + self.verify(pps > 0, "No traffic detected") > + config['mpps'][frame_size] =3D pps / 1000000.0 > # Print results > self.result_table_create( > ['Frame size'] + [n['cores'] for n in self.core_configs]) @@= -271,12 > +208,31 @@ class TestVmdq(TestCase): > self.result_table_print() >=20 > # Override etgen.dot1q function > - def set_fields(self): > - ''' set ip protocol field behavior ''' > + def set_fields(self, vid_range, dmac_range): > + """ > + set ip protocol field behavior > + """ > fields_config =3D { > - 'vlan': { > - 0: {'range': self.vlan_repeat, 'action': 'inc'}}, > - 'mac': { > - 'dst': {'range': self.da_repeat, 'action': 'inc'}},} > - > + 'vlan': { > + 0: {'range': vid_range, 'action': 'inc'}}, > + 'mac': { > + 'dst': {'range': dmac_range, 'action': 'inc'}}, > + 'ip': {'src': {'action': 'random'}}, > + } > return fields_config > + > + def tear_down(self): > + """ > + Run after each test case. > + """ > + self.dut.kill_all() > + > + def tear_down_all(self): > + """ > + Run after each test suite. > + """ > + # resume setting > + self.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_MAX_QUEUES_PER_PORT=3D1024/CONFIG_RTE_MAX_QUEUES > _PER_PORT=3D256/' ./config/common_base", > + "# ", 5) > + self.dut.build_install_dpdk(self.target) > -- > 2.17.1