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 164E1A0613 for ; Wed, 28 Aug 2019 08:13:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0C73D1C1EE; Wed, 28 Aug 2019 08:13:27 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 300661C1ED for ; Wed, 28 Aug 2019 08:13:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Aug 2019 23:13:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,440,1559545200"; d="scan'208";a="171437234" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga007.jf.intel.com with ESMTP; 27 Aug 2019 23:13:24 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 27 Aug 2019 23:13:23 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 27 Aug 2019 23:13:23 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.80]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.215]) with mapi id 14.03.0439.000; Wed, 28 Aug 2019 14:13:21 +0800 From: "Tu, Lijuan" To: "Peng, Yuan" , "dts@dpdk.org" CC: "Peng, Yuan" Thread-Topic: [dts] [PATCH v2]tests: add tx checksum case to TestSuite_rxtx_offload.py Thread-Index: AQHVUn1XIpMUQKYA9kS/kz9dxomfUKcQKlpA Date: Wed, 28 Aug 2019 06:13:21 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB0688B@SHSMSX101.ccr.corp.intel.com> References: <1565772881-91873-1-git-send-email-yuan.peng@intel.com> In-Reply-To: <1565772881-91873-1-git-send-email-yuan.peng@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-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGQwMTZiYjktODczNy00OTljLWFkZGMtNmQ3MmJjMWMyYjI1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWXErT2plZVJTbWdRQnpFb0lhZXRKZFUxbTc3bGpoMWgranpcL2dRMWRQa2Q5c2s3OWttQXNKQ0dVSnljZEJQaGgifQ== 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: add tx checksum case to TestSuite_rxtx_offload.py 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 Peng Yuan > Sent: Wednesday, August 14, 2019 4:55 PM > To: dts@dpdk.org > Cc: Peng, Yuan > Subject: [dts] [PATCH v2]tests: add tx checksum case to > TestSuite_rxtx_offload.py >=20 > Add tx checksum case to TestSuite_rxtx_offload.py >=20 > Signed-off-by: Peng Yuan >=20 > diff --git a/tests/TestSuite_rxtx_offload.py b/tests/TestSuite_rxtx_offlo= ad.py > index 77d4f3f..2166c16 100644 > --- a/tests/TestSuite_rxtx_offload.py > +++ b/tests/TestSuite_rxtx_offload.py > @@ -107,10 +107,6 @@ class TestRxTx_Offload(TestCase): > self.pf_pci =3D self.dut.ports_info[self.dut_ports[0]]['pci'] > self.pmdout =3D PmdOutput(self.dut) > self.cores =3D "1S/4C/1T" > - self.jumbo_pkt1 =3D > r'sendp([Ether(dst=3D"%s")/IP(dst=3D"192.168.0.1",src=3D"192.168.0.2", > len=3D8981)/Raw(load=3D"P"*8961)], iface=3D"%s")' % (self.pf_mac, self.te= ster_itf0) > - self.jumbo_pkt2 =3D > r'sendp([Ether(dst=3D"%s")/IP(dst=3D"192.168.0.1",src=3D"192.168.0.3", > len=3D8981)/Raw(load=3D"P"*8961)], iface=3D"%s")' % (self.pf_mac, self.te= ster_itf0) > - self.vlan_pkt1 =3D > r'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IP(src=3D"192.168.0.1",dst=3D"= 192.168.0. > 3")/UDP(sport=3D33, dport=3D34)/Raw("x"*20)], iface=3D"%s")' % (self.pf_m= ac, > self.tester_itf0) > - self.vlan_pkt2 =3D > r'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IP(src=3D"192.168.0.2",dst=3D"= 192.168.0. > 3")/UDP(sport=3D33, dport=3D34)/Raw("x"*20)], iface=3D"%s")' % (self.pf_m= ac, > self.tester_itf0) >=20 > def set_up(self): > """ > @@ -118,7 +114,6 @@ class TestRxTx_Offload(TestCase): > """ > pass >=20 > - > def verify_link_up(self, max_delay=3D10): > ports =3D self.dut.get_ports(self.nic) > for port_id in range(len(ports)): > @@ -153,20 +148,20 @@ class TestRxTx_Offload(TestCase): > i =3D i + 1 > return offload_keys >=20 > - def check_port_config(self, rxtx, offload): > + def check_port_config(self, rxtx, offload, port_id=3D0): > """ > Check configuration per port. > """ > global offloads >=20 > - result_config =3D self.dut.send_expect("port start 0", "testpmd>= ") > + result_config =3D self.dut.send_expect("port start %d" % port_id= , > + "testpmd> ") > self.verify("Fail" not in result_config, "Fail to configure port= ") > self.verify_link_up(20) >=20 > if rxtx =3D=3D "rx": > - outstring =3D self.dut.send_expect("show port 0 rx_offload > configuration", "testpmd> ") > + outstring =3D self.dut.send_expect("show port %d rx_offload > + configuration" % port_id, "testpmd> ") > elif rxtx =3D=3D "tx": > - outstring =3D self.dut.send_expect("show port 0 tx_offload > configuration", "testpmd> ") > + outstring =3D self.dut.send_expect("show port %d tx_offload > + configuration" % port_id, "testpmd> ") >=20 > result_scanner =3D r"Port : (.*?)\n" > scanner =3D re.compile(result_scanner, re.DOTALL) @@ -255,6 +250= ,47 > @@ class TestRxTx_Offload(TestCase): > self.verify("PKT_RX_VLAN_STRIPPED" not in outstring, "Fail t= o > configure offload by queue.") > self.dut.send_expect("stop", "testpmd>") >=20 > + def checksum_valid_flags(self, packet, direction, flags): > + """ > + Sends packets and check the checksum valid-flags. > + """ > + self.dut.send_expect("start", "testpmd>") > + self.tester.scapy_foreground() > + self.tester.scapy_append(packet) > + self.tester.scapy_execute() > + out =3D self.dut.get_session_output(timeout=3D1) > + lines =3D out.split("\r\n") > + > + # collect the rx checksum result > + if (direction =3D=3D "rx"): > + for line in lines: > + line =3D line.strip() > + if len(line) !=3D 0 and line.startswith("rx") and ("flag= s" in line): > + if ("ipv4" in flags): > + self.verify("PKT_RX_IP_CKSUM_BAD" in line, "ipv4= checksum > flag is wrong!") > + else: > + self.verify("PKT_RX_IP_CKSUM_GOOD" in line, "ipv= 4 checksum > flag is wrong!") > + if ("udp" in flags) or ("tcp" in flags): > + self.verify("PKT_RX_L4_CKSUM_BAD" in line, "L4 c= hecksum > flag is wrong!") > + else: > + self.verify(("PKT_RX_L4_CKSUM_GOOD" in line) or > ("PKT_RX_L4_CKSUM_UNKNOWN" in line), "L4 checksum flag is wrong!") > + # collect the tx checksum result > + if (direction =3D=3D "tx"): > + for line in lines: > + line =3D line.strip() > + if len(line) !=3D 0 and line.startswith("tx") and ("flag= s" in line): > + if ("ipv4" in flags): > + self.verify("PKT_TX_IP_CKSUM" in line, "There is= no ipv4 tx > checksum flag!") > + if ("udp" in flags): > + self.verify("PKT_TX_UDP_CKSUM" in line, "There i= s no udp tx > checksum flag!") > + if ("tcp") in flags: > + self.verify("PKT_TX_TCP_CKSUM" in line, "There i= s no tcp tx > checksum flag!") > + if ("sctp") in flags: > + self.verify("PKT_TX_SCTP_CKSUM" in line, "There = is no sctp tx > checksum flag!") > + if (flags =3D=3D []): > + self.verify(("PKT_TX_L4_NO_CKSUM" in line) and > ("PKT_TX_IP_CKSUM" not in line), "The tx checksum flag is wrong!") > + self.dut.send_expect("stop", "testpmd>") > + > def verify_result(self, packet, expect_rxpkts, expect_queue): > """ > verify if the packet is to the expected queue @@ -294,6 +330,10 = @@ > class TestRxTx_Offload(TestCase): > """ > Set Rx offload by port. > """ > + # Define jumboframe packets > + self.jumbo_pkt1 =3D > r'sendp([Ether(dst=3D"%s")/IP(dst=3D"192.168.0.1",src=3D"192.168.0.2", > len=3D8981)/Raw(load=3D"P"*8961)], iface=3D"%s")' % (self.pf_mac, self.te= ster_itf0) > + self.jumbo_pkt2 =3D > + r'sendp([Ether(dst=3D"%s")/IP(dst=3D"192.168.0.1",src=3D"192.168.0.3", > + len=3D8981)/Raw(load=3D"P"*8961)], iface=3D"%s")' % (self.pf_mac, > + self.tester_itf0) > + > self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D4 --txq=3D= 4 --max- > pkt-len=3D9000") > self.dut.send_expect("set fwd rxonly", "testpmd> ") > self.dut.send_expect("set verbose 1", "testpmd> ") @@ -337,10 +3= 77,25 > @@ class TestRxTx_Offload(TestCase): > """ > Set Rx offload by port in cmdline. > """ > + # Define rx checksum packets > + self.rxcksum_pkt1 =3D > r'sendp([Ether(dst=3D"%s")/IP(dst=3D"192.168.0.1")/TCP(sport=3D33, > dport=3D34)/Raw("x"*20)], iface=3D"%s")' % (self.pf_mac, self.tester_itf0= ) > + self.rxcksum_pkt2 =3D > r'sendp([Ether(dst=3D"%s")/IP(chksum=3D0x0)/TCP(chksum=3D0xf)/Raw("x"*20)= ], > iface=3D"%s")' % (self.pf_mac, self.tester_itf0) > + self.rxcksum_pkt3 =3D > r'sendp([Ether(dst=3D"%s")/IP(dst=3D"192.168.0.1")/UDP(chksum=3D0xf)/Raw(= "x"*20 > )], iface=3D"%s")' % (self.pf_mac, self.tester_itf0) > + self.rxcksum_pkt4 =3D > r'sendp([Ether(dst=3D"%s")/IP(chksum=3D0x0)/UDP(sport=3D33, > dport=3D34)/Raw("x"*20)], iface=3D"%s")' % (self.pf_mac, self.tester_itf0= ) > + flags =3D [] > + > self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D4 --txq=3D= 4 --enable- > rx-cksum") > + self.dut.send_expect("set fwd csum", "testpmd> ") > + self.dut.send_expect("set verbose 1", "testpmd> ") > offload =3D ['ipv4_cksum', 'udp_cksum', 'tcp_cksum'] > self.check_port_config("rx", offload) >=20 > + # Check the rx checksum flags > + self.checksum_valid_flags(self.rxcksum_pkt1, "rx", []) > + self.checksum_valid_flags(self.rxcksum_pkt2, "rx", ["ipv4","tcp"= ]) > + self.checksum_valid_flags(self.rxcksum_pkt3, "rx", ["udp"]) > + self.checksum_valid_flags(self.rxcksum_pkt4, "rx", ["ipv4"]) > + > # Disable the rx cksum per_port > self.dut.send_expect("port stop 0", "testpmd> ") > self.dut.send_expect("port config 0 rx_offload udp_cksum off", > "testpmd> ") @@ -390,6 +445,9 @@ class TestRxTx_Offload(TestCase): > """ > # Only support ixgbe NICs > self.verify(self.nic in ["niantic", "twinpond", "sagepond", "sag= eville"], > "%s nic not support rx offload setting by queue." % self.nic) > + # Define the vlan packets > + self.vlan_pkt1 =3D > r'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IP(src=3D"192.168.0.1",dst=3D"= 192.168.0. > 3")/UDP(sport=3D33, dport=3D34)/Raw("x"*20)], iface=3D"%s")' % (self.pf_m= ac, > self.tester_itf0) > + self.vlan_pkt2 =3D > + r'sendp([Ether(dst=3D"%s")/Dot1Q(vlan=3D1)/IP(src=3D"192.168.0.2",dst= =3D"192.1 > + 68.0.3")/UDP(sport=3D33, dport=3D34)/Raw("x"*20)], iface=3D"%s")' % > + (self.pf_mac, self.tester_itf0) >=20 > self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D4 --txq=3D= 4") > self.dut.send_expect("set fwd rxonly", "testpmd> ") @@ -543,6 +6= 01,54 > @@ class TestRxTx_Offload(TestCase): > out =3D self.get_tcpdump_package() > self.verify("vlan 1" in out, "There is no vlan insert.") >=20 > + def test_txoffload_port_checksum(self): > + """ > + Set Tx offload cksum. > + """ > + # Define tx checksum packets > + self.txcksum_ipv4 =3D > r'sendp([Ether(dst=3D"%s")/IP(dst=3D"192.168.0.1")/Raw("x"*20)], iface=3D= "%s")' % > (self.pf_mac, self.tester_itf0) > + self.txcksum_tcp =3D > r'sendp([Ether(dst=3D"%s")/IP(dst=3D"192.168.0.1")/TCP(sport=3D33, > dport=3D34)/Raw("x"*20)], iface=3D"%s")' % (self.pf_mac, self.tester_itf0= ) > + self.txcksum_udp =3D > r'sendp([Ether(dst=3D"%s")/IP(dst=3D"192.168.0.1")/UDP(sport=3D33, > dport=3D34)/Raw("x"*20)], iface=3D"%s")' % (self.pf_mac, self.tester_itf0= ) > + self.txcksum_sctp =3D > + r'sendp([Ether(dst=3D"%s")/IP(dst=3D"192.168.0.1")/SCTP(sport=3D33, > + dport=3D34)/Raw("x"*20)], iface=3D"%s")' % (self.pf_mac, self.tester_it= f0) > + > + flags =3D [] > + self.pmdout.start_testpmd("%s" % self.cores, "--rxq=3D4 --txq=3D= 4") > + self.dut.send_expect("set fwd csum", "testpmd> ") > + self.dut.send_expect("set verbose 1", "testpmd> ") > + > + # Check the tx checksum flags > + self.checksum_valid_flags(self.txcksum_ipv4, "tx", []) > + self.checksum_valid_flags(self.txcksum_tcp, "tx", []) > + self.checksum_valid_flags(self.txcksum_udp, "tx", []) > + self.checksum_valid_flags(self.txcksum_sctp, "tx", []) > + > + # Disable the tx cksum per_port > + self.dut.send_expect("port stop 1", "testpmd> ") > + self.dut.send_expect("port config 1 tx_offload ipv4_cksum on", > "testpmd> ") > + self.dut.send_expect("port start 1", "testpmd> ") > + offload =3D ['ipv4_cksum'] > + self.check_port_config("tx", offload, 1) > + self.checksum_valid_flags(self.txcksum_ipv4, "tx", ["ipv4"]) > + > + self.dut.send_expect("port stop 1", "testpmd> ") > + self.dut.send_expect("port config 1 tx_offload tcp_cksum on", > "testpmd> ") > + self.dut.send_expect("port start 1", "testpmd> ") > + offload =3D ['ipv4_cksum', 'tcp_cksum'] > + self.check_port_config("tx", offload, 1) > + self.checksum_valid_flags(self.txcksum_tcp, "tx", > + ["ipv4","tcp"]) > + > + self.dut.send_expect("port stop 1", "testpmd> ") > + self.dut.send_expect("port config 1 tx_offload udp_cksum on", > "testpmd> ") > + offload =3D ['ipv4_cksum', 'tcp_cksum', 'udp_cksum'] > + self.check_port_config("tx", offload, 1) > + self.checksum_valid_flags(self.txcksum_udp, "tx", > + ["ipv4","udp"]) > + > + self.dut.send_expect("port stop 1", "testpmd> ") > + self.dut.send_expect("port config 1 tx_offload sctp_cksum on", > "testpmd> ") > + offload =3D ['ipv4_cksum', 'tcp_cksum', 'udp_cksum', 'sctp_cksum= '] > + self.check_port_config("tx", offload, 1) > + self.checksum_valid_flags(self.txcksum_sctp, "tx", > + ["ipv4","sctp"]) > + > def test_txoffload_port_all(self): > """ > Set all Tx offload capabilities by port. > -- > 2.7.4