From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id D31982BFF for ; Thu, 7 Sep 2017 04:32:19 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 06 Sep 2017 19:32:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,356,1500966000"; d="scan'208";a="149047761" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 06 Sep 2017 19:32:18 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 6 Sep 2017 19:32:17 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 6 Sep 2017 19:32:16 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.219]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.98]) with mapi id 14.03.0319.002; Thu, 7 Sep 2017 10:31:56 +0800 From: "Liu, Yong" To: "Xu, GangX" , "dts@dpdk.org" CC: "Xu, GangX" Thread-Topic: [dts] [PATCH V2] fix ipfrag failed on freebsd Thread-Index: AQHTJu9URTyqjTuhik6MlanCu33xCKKos8Nw Date: Thu, 7 Sep 2017 02:31:55 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E62E9DAB7@SHSMSX103.ccr.corp.intel.com> References: <1504688779-5677-1-git-send-email-gangx.xu@intel.com> In-Reply-To: <1504688779-5677-1-git-send-email-gangx.xu@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.0.116 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] fix ipfrag failed on freebsd 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, 07 Sep 2017 02:32:20 -0000 Gang, one comment below. I knowing that you are fixing all PEP issues in th= e suite.=20 But for some one line commands, it will be more readable to keep its origin= al format. You can skip this error by adding "--ignore E501" between pep8 command. Thanks, Marvin > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xu,gang > Sent: Wednesday, September 06, 2017 5:06 PM > To: dts@dpdk.org > Cc: Xu, GangX > Subject: [dts] [PATCH V2] fix ipfrag failed on freebsd >=20 > modify command can;t work on freebsd, so do it on tester >=20 > Signed-off-by: xu,gang > --- > tests/TestSuite_ipfrag.py | 125 +++++++++++++++++++++++++++++++---------= - > ----- > 1 file changed, 86 insertions(+), 39 deletions(-) >=20 > diff --git a/tests/TestSuite_ipfrag.py b/tests/TestSuite_ipfrag.py > index f23dbe1..c80594a 100644 > --- a/tests/TestSuite_ipfrag.py > +++ b/tests/TestSuite_ipfrag.py > @@ -84,7 +84,6 @@ class TestIpfrag(TestCase): >=20 > # Based on h/w type, choose how many ports to use > ports =3D self.dut.get_ports() > - print ports >=20 > # Verify that enough ports are available > self.verify(len(ports) >=3D 2, "Insufficient ports for testing") > @@ -109,16 +108,28 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > rtLpmTbl[idx] =3D pat.sub(self.portRepl, rtLpmTbl[idx]) > lpmStr_ipv4 =3D lpmStr_ipv4 + ' ' * 4 + rtLpmTbl[idx] + ",\\= \n" > lpmStr_ipv4 =3D lpmStr_ipv4 + "};" > - print lpmStr_ipv4 > lpmStr_ipv6 =3D "static struct l3fwd_ipv6_route > l3fwd_ipv6_route_array[] =3D {\\\n" > rtLpmTbl =3D list(lpm_table_ipv6) > for idx in range(len(rtLpmTbl)): > rtLpmTbl[idx] =3D pat.sub(self.portRepl, rtLpmTbl[idx]) > lpmStr_ipv6 =3D lpmStr_ipv6 + ' ' * 4 + rtLpmTbl[idx] + ",\\= \n" > lpmStr_ipv6 =3D lpmStr_ipv6 + "};" > - print lpmStr_ipv6 > - self.dut.send_expect(r"sed -i > '/l3fwd_ipv4_route_array\[\].*{/,/^\}\;/c\\%s' > examples/ip_fragmentation/main.c" % lpmStr_ipv4, "# ") > - self.dut.send_expect(r"sed -i > '/l3fwd_ipv6_route_array\[\].*{/,/^\}\;/c\\%s' > examples/ip_fragmentation/main.c" % lpmStr_ipv6, "# ") > + if self.dut.get_os_type() =3D=3D 'freebsd': > + self.dut.session.copy_file_from( > + '/root/dpdk/examples/ip_fragmentation/main.c', '/tmp') > + self.tester.send_expect( > + r"sed -i '/l3fwd_ipv4_route_array\[\].*{/,/^\}\;/c\\%s' > /tmp/main.c" % lpmStr_ipv4, "# ") > + self.tester.send_expect( > + r"sed -i '/l3fwd_ipv6_route_array\[\].*{/,/^\}\;/c\\%s' > /tmp/main.c" % lpmStr_ipv6, "# ") > + self.dut.session.copy_file_to( > + '/tmp/main.c', '/root/dpdk/examples/ip_fragmentation/') > + Gang, why not just do it in DUT? > + else: > + self.dut.send_expect( > + r"sed -i '/l3fwd_ipv4_route_array\[\].*{/,/^\}\;/c\\%s' > examples/ip_fragmentation/main.c" % lpmStr_ipv4, "# ") > + self.dut.send_expect( > + r"sed -i '/l3fwd_ipv6_route_array\[\].*{/,/^\}\;/c\\%s' > examples/ip_fragmentation/main.c" % lpmStr_ipv6, "# ") > + > # make application > out =3D self.dut.build_dpdk_apps("examples/ip_fragmentation") > self.verify("Error" not in out, "compilation error 1") > @@ -148,7 +159,8 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > # simulate to set TG properties > if flag =3D=3D 'frag': > # do fragment, each packet max length 1518 - 18 - 20 =3D > 1480 > - expPkts =3D (size - HEADER_SIZE['eth'] - HEADER_SIZE['ip= ']) > / 1480 > + expPkts =3D ( > + size - HEADER_SIZE['eth'] - HEADER_SIZE['ip']) / 148= 0 > if (size - HEADER_SIZE['eth'] - HEADER_SIZE['ip']) % 148= 0: > expPkts +=3D 1 > val =3D 0 > @@ -165,12 +177,15 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > pkt_size =3D pkt_sizes[pkt_sizes.index(size) + times] > pkt =3D Packet(pkt_type=3D'UDP', pkt_len=3Dpkt_size) > pkt.config_layer('ether', {'dst': self.dmac}) > - pkt.config_layer('ipv4', {'dst': '100.10.0.1', 'src': > '1.2.3.4', 'flags': val}) > + pkt.config_layer( > + 'ipv4', {'dst': '100.10.0.1', 'src': '1.2.3.4', > 'flags': val}) > pkt.send_pkt(tx_port=3Dself.txItf) >=20 > - # verify normal packet just by number, verify fragment packe= t > by all elements > + # verify normal packet just by number, verify fragment packe= t > by > + # all elements > pkts =3D load_sniff_packets(inst) > - self.verify(len(pkts) =3D=3D expPkts, "Failed on forward pac= ket > size " + str(size)) > + self.verify( > + len(pkts) =3D=3D expPkts, "Failed on forward packet size= " + > str(size)) > if flag =3D=3D 'frag': > idx =3D 1 > for pkt in pkts: > @@ -178,19 +193,23 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > pkt_id =3D pkt.strip_element_layer3("id") > if idx =3D=3D 1: > prev_idx =3D pkt_id > - self.verify(prev_idx =3D=3D pkt_id, "Fragmented pack= ets > index not match") > + self.verify( > + prev_idx =3D=3D pkt_id, "Fragmented packets inde= x not > match") > prev_idx =3D pkt_id >=20 > # last flags should be 0 > flags =3D pkt.strip_element_layer3("flags") > if idx =3D=3D expPkts: > - self.verify(flags =3D=3D 0, "Fragmented last pac= ket > flags not match") > + self.verify( > + flags =3D=3D 0, "Fragmented last packet flag= s not > match") > else: > - self.verify(flags =3D=3D 1, "Fragmented packets = flags > not match") > + self.verify( > + flags =3D=3D 1, "Fragmented packets flags no= t > match") >=20 > # fragment offset should be correct > frag =3D pkt.strip_element_layer3("frag") > - self.verify((frag =3D=3D ((idx - 1) * 185)), "Fragme= nt > packet frag not match") > + self.verify( > + (frag =3D=3D ((idx - 1) * 185)), "Fragment packe= t > frag not match") > idx +=3D 1 >=20 > def functional_check_ipv6(self, pkt_sizes, burst=3D1, flag=3DNone, > funtion=3DNone): > @@ -200,8 +219,10 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > for size in pkt_sizes[::burst]: > # simulate to set TG properties > if flag =3D=3D 'frag': > - # each packet max len: 1518 - 18 (eth) - 40 (ipv6) - 8 > (ipv6 ext hdr) =3D 1452 > - expPkts =3D (size - HEADER_SIZE['eth'] - > HEADER_SIZE['ipv6']) / 1452 > + # each packet max len: 1518 - 18 (eth) - 40 (ipv6) - 8 > (ipv6 > + # ext hdr) =3D 1452 > + expPkts =3D ( > + size - HEADER_SIZE['eth'] - HEADER_SIZE['ipv6']) / > 1452 > if (size - HEADER_SIZE['eth'] - HEADER_SIZE['ipv6']) % > 1452: > expPkts +=3D 1 > val =3D 0 > @@ -215,12 +236,15 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > pkt_size =3D pkt_sizes[pkt_sizes.index(size) + times] > pkt =3D Packet(pkt_type=3D'IPv6_UDP', pkt_len=3Dpkt_size= ) > pkt.config_layer('ether', {'dst': self.dmac}) > - pkt.config_layer('ipv6', {'dst': > '101:101:101:101:101:101:101:101', 'src': > 'ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80'}) > + pkt.config_layer( > + 'ipv6', {'dst': '101:101:101:101:101:101:101:101', > 'src': 'ee80:ee80:ee80:ee80:ee80:ee80:ee80:ee80'}) > pkt.send_pkt(tx_port=3Dself.txItf) >=20 > - # verify normal packet just by number, verify fragment packe= t > by all elements > + # verify normal packet just by number, verify fragment packe= t > by > + # all elements > pkts =3D load_sniff_packets(inst) > - self.verify(len(pkts) =3D=3D expPkts, "Failed on forward pac= ket > size " + str(size)) > + self.verify( > + len(pkts) =3D=3D expPkts, "Failed on forward packet size= " + > str(size)) > if flag =3D=3D 'frag': > idx =3D 1 > for pkt in pkts: > @@ -228,27 +252,33 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > pkt_id =3D pkt.strip_element_layer4("id") > if idx =3D=3D 1: > prev_idx =3D pkt_id > - self.verify(prev_idx =3D=3D pkt_id, "Fragmented pack= ets > index not match") > + self.verify( > + prev_idx =3D=3D pkt_id, "Fragmented packets inde= x not > match") > prev_idx =3D pkt_id >=20 > # last flags should be 0 > flags =3D pkt.strip_element_layer4("m") > if idx =3D=3D expPkts: > - self.verify(flags =3D=3D 0, "Fragmented last pac= ket > flags not match") > + self.verify( > + flags =3D=3D 0, "Fragmented last packet flag= s not > match") > else: > - self.verify(flags =3D=3D 1, "Fragmented packets = flags > not match") > + self.verify( > + flags =3D=3D 1, "Fragmented packets flags no= t > match") >=20 > # fragment offset should be correct > frag =3D pkt.strip_element_layer4("offset") > - self.verify((frag =3D=3D int((idx - 1) * 181.5)), > "Fragment packet frag not match") > + self.verify( > + (frag =3D=3D int((idx - 1) * 181.5)), "Fragment > packet frag not match") > idx +=3D 1 >=20 > def set_up(self): > """ > Run before each test case. > """ > - self.tester.send_expect("ifconfig %s mtu 9200" % > self.tester.get_interface(self.tester.get_local_port(P0)), "#") > - self.tester.send_expect("ifconfig %s mtu 9200" % > self.tester.get_interface(self.tester.get_local_port(P1)), "#") > + self.tester.send_expect("ifconfig %s mtu 9200" % > + > self.tester.get_interface(self.tester.get_local_port(P0)), "#") > + self.tester.send_expect("ifconfig %s mtu 9200" % > + > self.tester.get_interface(self.tester.get_local_port(P1)), "#") >=20 > def test_ipfrag_normalfwd(self): > """ > @@ -290,7 +320,8 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > Pct =3D dict() >=20 > if int(lcore[0]) =3D=3D 1: > - core_mask =3D utils.create_mask(self.dut.get_core_list(lcore= , > socket=3Dself.ports_socket)) > + core_mask =3D utils.create_mask( > + self.dut.get_core_list(lcore, socket=3Dself.ports_socket= )) > else: > core_mask =3D utils.create_mask(self.dut.get_core_list(lcore= )) >=20 > @@ -302,29 +333,42 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > result =3D [2, lcore, num_pthreads] > for size in size_list: > dmac =3D self.dut.get_mac_address(P0) > - flows =3D ['Ether(dst=3D"%s")/IP(src=3D"1.2.3.4", dst=3D"100= .10.0.1", > flags=3D0)/("X"*%d)' % (dmac, size - 38), > - 'Ether(dst=3D"%s")/IP(src=3D"1.2.3.4", dst=3D"100.2= 0.0.1", > flags=3D0)/("X"*%d)' % (dmac, size - 38), > - > 'Ether(dst=3D"%s")/IPv6(dst=3D"101:101:101:101:101:101:101:101",src=3D"ee= 80:ee80 > :ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load=3D"X"*%d)' % (dmac, size - 58), > + flows =3D [ > + 'Ether(dst=3D"%s")/IP(src=3D"1.2.3.4", dst=3D"100.10.0.1= ", > flags=3D0)/("X"*%d)' % ( > + dmac, size - 38), > + 'Ether(dst=3D"%s")/IP(src=3D"1.2.3.4", dst=3D"100.2= 0.0.1", > flags=3D0)/("X"*%d)' % ( > + dmac, size - 38), > + > 'Ether(dst=3D"%s")/IPv6(dst=3D"101:101:101:101:101:101:101:101",src=3D"ee= 80:ee80 > :ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load=3D"X"*%d)' % ( > + dmac, size - 58), >=20 > 'Ether(dst=3D"%s")/IPv6(dst=3D"201:101:101:101:101:101:101:101",src=3D"ee= 80:ee80 > :ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load=3D"X"*%d)' % (dmac, size - 58)] > - self.tester.scapy_append('wrpcap("test1.pcap", [%s])' % > string.join(flows, ',')) > + self.tester.scapy_append( > + 'wrpcap("test1.pcap", [%s])' % string.join(flows, ',')) >=20 > # reserved for rx/tx bidirection test > dmac =3D self.dut.get_mac_address(P1) > - flows =3D ['Ether(dst=3D"%s")/IP(src=3D"1.2.3.4", dst=3D"100= .30.0.1", > flags=3D0)/("X"*%d)' % (dmac, size - 38), > - 'Ether(dst=3D"%s")/IP(src=3D"1.2.3.4", dst=3D"100.4= 0.0.1", > flags=3D0)/("X"*%d)' % (dmac, size - 38), > - > 'Ether(dst=3D"%s")/IPv6(dst=3D"301:101:101:101:101:101:101:101",src=3D"ee= 80:ee80 > :ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load=3D"X"*%d)' % (dmac, size - 58), > + flows =3D [ > + 'Ether(dst=3D"%s")/IP(src=3D"1.2.3.4", dst=3D"100.30.0.1= ", > flags=3D0)/("X"*%d)' % ( > + dmac, size - 38), > + 'Ether(dst=3D"%s")/IP(src=3D"1.2.3.4", dst=3D"100.4= 0.0.1", > flags=3D0)/("X"*%d)' % ( > + dmac, size - 38), > + > 'Ether(dst=3D"%s")/IPv6(dst=3D"301:101:101:101:101:101:101:101",src=3D"ee= 80:ee80 > :ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load=3D"X"*%d)' % ( > + dmac, size - 58), >=20 > 'Ether(dst=3D"%s")/IPv6(dst=3D"401:101:101:101:101:101:101:101",src=3D"ee= 80:ee80 > :ee80:ee80:ee80:ee80:ee80:ee80")/Raw(load=3D"X"*%d)' % (dmac, size - 58)] > - self.tester.scapy_append('wrpcap("test2.pcap", [%s])' % > string.join(flows, ',')) > + self.tester.scapy_append( > + 'wrpcap("test2.pcap", [%s])' % string.join(flows, ',')) >=20 > self.tester.scapy_execute() >=20 > tgenInput =3D [] > - tgenInput.append((self.tester.get_local_port(P0), > self.tester.get_local_port(P1), "test1.pcap")) > - tgenInput.append((self.tester.get_local_port(P1), > self.tester.get_local_port(P0), "test2.pcap")) > + tgenInput.append( > + (self.tester.get_local_port(P0), > self.tester.get_local_port(P1), "test1.pcap")) > + tgenInput.append( > + (self.tester.get_local_port(P1), > self.tester.get_local_port(P0), "test2.pcap")) >=20 > factor =3D (size + 1517) / 1518 > # wireSpd =3D 2 * 10000.0 / ((20 + size) * 8) > - Bps[str(size)], Pps[str(size)] =3D > self.tester.traffic_generator_throughput(tgenInput) > + Bps[str(size)], Pps[ > + str(size)] =3D > self.tester.traffic_generator_throughput(tgenInput) > self.verify(Pps[str(size)] > 0, "No traffic detected") > Pps[str(size)] *=3D 1.0 / factor / 1000000 > Pct[str(size)] =3D (1.0 * Bps[str(size)] * 100) / (2 * > 10000000000) > @@ -349,7 +393,8 @@ l3fwd_ipv4_route_array[] =3D {\\\n" >=20 > self.result_table_create(tblheader) >=20 > - lcores =3D [("1S/1C/1T", 2), ("1S/1C/2T", 2), ("1S/2C/1T", 2), > ("2S/1C/1T", 2)] > + lcores =3D [("1S/1C/1T", 2), ("1S/1C/2T", 2), > + ("1S/2C/1T", 2), ("2S/1C/1T", 2)] > index =3D 1 > for (lcore, numThr) in lcores: > self.benchmark(index, lcore, numThr, sizes) > @@ -361,8 +406,10 @@ l3fwd_ipv4_route_array[] =3D {\\\n" > """ > Run after each test case. > """ > - self.tester.send_expect("ifconfig %s mtu 1500" % > self.tester.get_interface(self.tester.get_local_port(P0)), "#") > - self.tester.send_expect("ifconfig %s mtu 1500" % > self.tester.get_interface(self.tester.get_local_port(P1)), "#") > + self.tester.send_expect("ifconfig %s mtu 1500" % > + > self.tester.get_interface(self.tester.get_local_port(P0)), "#") > + self.tester.send_expect("ifconfig %s mtu 1500" % > + > self.tester.get_interface(self.tester.get_local_port(P1)), "#") >=20 > def tear_down_all(self): > """ > -- > 1.9.3