From patchwork Fri Dec 23 08:55:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 121351 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CFDB5A0093; Fri, 23 Dec 2022 09:56:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9A2F42686; Fri, 23 Dec 2022 09:56:58 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id F417442686 for ; Fri, 23 Dec 2022 09:56:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671785816; x=1703321816; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Py4iHdmOLRNCtl+0EfL31wIblIWCMTaiVjJ0fpJjaXU=; b=akTf0uA6TMXhxbnwAWS3Bt2+4IvZ5yMb46oBU1fqcw8EYBf++QKGMYPH ieJmYoR1xETaPAUqaZS9ehSN/vT5y1EKiu9hKiOXNfstDaIsl/AFZ3jTd R+jiUkS457PvUcr3mHCtuu3lOGHdwsF3lwVyeZ7or2xo8QRIlqGvzFxIx rE9/XP/UjejEw1kS9hqMQrkU2WB8FVEJaOVtTzeFN+zsFV5a0DX28RBAS oUxSEAv2uL99LfjjVrB6hjpcIIZ4TFzoTdF4azA7TX8kLsfhmWEOM6gPP zZ/QCBzXWbj53ROetRpIcMPf+J3YTucUl5Cj+aPmry66z9gj2EYHk+6hs A==; X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="303773483" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="303773483" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2022 00:56:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="776304466" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="776304466" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by orsmga004.jf.intel.com with ESMTP; 23 Dec 2022 00:56:54 -0800 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, weiyuanx.li@intel.com, qi.fu@intel.com, lijuan.tu@intel.com Subject: [DTS][PATCH V6 1/5] tests/vf_offload: fix 2 typos and a bug. Date: Fri, 23 Dec 2022 16:55:23 +0800 Message-Id: <20221223085527.29760-2-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221223085527.29760-1-ke1.xu@intel.com> References: <20221223085527.29760-1-ke1.xu@intel.com> MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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 Checksum is wrongly spelled as checksup. Finally is wrongly spelled as fially. String formating is wrongly put out side of the function call. Signed-off-by: Ke Xu --- tests/TestSuite_vf_offload.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index 26fad2b8..3fb6f9c8 100644 --- a/tests/TestSuite_vf_offload.py +++ b/tests/TestSuite_vf_offload.py @@ -265,7 +265,7 @@ class TestVfOffload(TestCase): ( ip_checksum, tcp_checksum, - udp_checksup, + udp_checksum, sctp_checksum, ) = packet_received.split(";") print( @@ -273,8 +273,8 @@ class TestVfOffload(TestCase): ip_checksum, "tcp_checksum:, ", tcp_checksum, - "udp_checksup: ", - udp_checksup, + "udp_checksum: ", + udp_checksum, "sctp_checksum: ", sctp_checksum, ) @@ -284,9 +284,9 @@ class TestVfOffload(TestCase): if tcp_checksum != "??": packet_type = "TCP" l4_checksum = tcp_checksum - elif udp_checksup != "??": + elif udp_checksum != "??": packet_type = "UDP" - l4_checksum = udp_checksup + l4_checksum = udp_checksum elif sctp_checksum != "??": packet_type = "SCTP" l4_checksum = sctp_checksum @@ -439,7 +439,7 @@ class TestVfOffload(TestCase): command = ("tcpdump -w tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &").format( iface ) - self.tester.send_expect("rm -f tcpdump_{0}.pcap", "#").format(iface) + self.tester.send_expect("rm -f tcpdump_{0}.pcap".format(iface), "#") self.tester.send_expect(command, "#") def tcpdump_stop_sniff(self): @@ -478,8 +478,8 @@ class TestVfOffload(TestCase): Execute scanner to return results """ scanner_result = self.tester.send_expect(scanner, "#") - fially_result = re.findall(r"length( \d+)", scanner_result) - return list(fially_result) + finally_result = re.findall(r"length( \d+)", scanner_result) + return list(finally_result) def number_of_bytes(self, iface): """ From patchwork Fri Dec 23 08:55:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 121352 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2CCECA00C4; Fri, 23 Dec 2022 09:57:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24B0742D16; Fri, 23 Dec 2022 09:57:00 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id E8D1140698 for ; Fri, 23 Dec 2022 09:56:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671785818; x=1703321818; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LUbP9JXBMcdIQozm3TOSf22f57MoX/wyhYf72uJzwgI=; b=V3SmohtFchPf5B4zfDaICWu5LV8Nu05+yFLll060IBATkXEEev9q1vE1 UhuwpvHUE9j9zuK7YAmIDoTssypcUzuugL/oFUB/V+YMwqhzhqk9z40G3 pNSbwVd/GrBqfK56ni0IjAg5/2g155W9q9GXk+/6M2EzH4wUa5mh6eMJr hLVbDDAnZb5P8jL7M+Wu1bSeSFA2Nja7mfP7UlngdBhM7JHhaWqG+QyEz qEdW1qrHk3BYRVGYoBlkEJhiUqi1lbfmk60jqOqEXCnndC71Eb/SBD5ep WiU/M2A/YmvlYf14pJ8XmqsTA7jFluwnKked6N8+rt60OS27XWD7fweNa A==; X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="303773487" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="303773487" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2022 00:56:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="776304469" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="776304469" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by orsmga004.jf.intel.com with ESMTP; 23 Dec 2022 00:56:55 -0800 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, weiyuanx.li@intel.com, qi.fu@intel.com, lijuan.tu@intel.com Subject: [DTS][PATCH V6 2/5] tests/vf_offload: add vf checksum hw offload case for tunneling packets. Date: Fri, 23 Dec 2022 16:55:24 +0800 Message-Id: <20221223085527.29760-3-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221223085527.29760-1-ke1.xu@intel.com> References: <20221223085527.29760-1-ke1.xu@intel.com> MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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 In DPDK 22.11, tunneling packets checksum offload for inner and outer checksum is supported. This case supporting validation these packets. Signed-off-by: Weiyuan Li Signed-off-by: Ke Xu --- tests/TestSuite_vf_offload.py | 214 +++++++++++++++++++++++++++++++++- 1 file changed, 212 insertions(+), 2 deletions(-) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index 3fb6f9c8..bab4f39e 100644 --- a/tests/TestSuite_vf_offload.py +++ b/tests/TestSuite_vf_offload.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2020 Intel Corporation +# Copyright(c) 2020-2022 Intel Corporation # import re @@ -10,7 +10,7 @@ import framework.utils as utils from framework.crb import Crb from framework.pmd_output import PmdOutput from framework.settings import DPDK_DCFMODE_SETTING, HEADER_SIZE, load_global_setting -from framework.test_case import TestCase +from framework.test_case import TestCase, check_supported_nic, skip_unsupported_pkg from framework.utils import GREEN, RED from framework.virt_common import VM from nics.net_device import NetDevice @@ -196,6 +196,18 @@ class TestVfOffload(TestCase): dut.send_expect("csum set sctp hw %d" % port, "testpmd>") dut.send_expect("port start all", "testpmd>") + def checksum_enablehw_tunnel(self, port, dut): + dut.send_expect("port stop %d" % port, "testpmd>") + dut.send_expect("csum set ip hw %d" % port, "testpmd>") + dut.send_expect("csum set udp hw %d" % port, "testpmd>") + dut.send_expect("csum set tcp hw %d" % port, "testpmd>") + dut.send_expect("csum set sctp hw %d" % port, "testpmd>") + dut.send_expect("csum set outer-ip hw %d" % port, "testpmd>") + dut.send_expect("csum set outer-udp hw %d" % port, "testpmd>") + dut.send_expect("csum parse-tunnel on %d" % port, "testpmd>") + dut.send_expect("rx_vxlan_port add 4789 %d" % port, "testpmd>") + dut.send_expect("port start %d" % port, "testpmd>") + def checksum_enablesw(self, port, dut): dut.send_expect("port stop all", "testpmd>") dut.send_expect("csum set ip sw %d" % port, "testpmd>") @@ -367,6 +379,204 @@ class TestVfOffload(TestCase): self.verify(len(result) == 0, ",".join(list(result.values()))) + def checksum_validate_tunnel(self, packets_sent, packets_expected): + """ + Validate the checksum. + """ + tx_interface = self.tester.get_interface( + self.tester.get_local_port(self.dut_ports[0]) + ) + rx_interface = self.tester.get_interface( + self.tester.get_local_port(self.dut_ports[1]) + ) + sniff_src = self.vm0_testpmd.get_port_mac(0) + checksum_pattern = re.compile("chksum.*=.*(0x[0-9a-z]+)") + sniff_src = "52:00:00:00:00:00" + chksum = dict() + # self.tester.send_expect("scapy", ">>> ") + + for packet_type in list(packets_expected.keys()): + self.tester.send_expect("scapy", ">>> ") + self.tester.send_expect("p = %s" % packets_expected[packet_type], ">>>") + out = self.tester.send_expect("p.show2()", ">>>") + chksums = checksum_pattern.findall(out) + expected_chksum = chksums + chksum[packet_type] = chksums + print(packet_type, ": ", chksums) + + self.tester.send_expect("exit()", "#") + + self.tester.scapy_background() + inst = self.tester.tcpdump_sniff_packets( + intf=rx_interface, + count=len(packets_sent), + filters=[{"layer": "ether", "config": {"src": sniff_src}}], + ) + + # Send packet. + self.tester.scapy_foreground() + + self.tester.scapy_append( + 'sendp([%s], iface="%s")' % (packets_sent[packet_type], tx_interface) + ) + self.tester.scapy_execute() + out = self.tester.scapy_get_result() + p = self.tester.load_tcpdump_sniff_packets(inst) + nr_packets = len(p) + print(p) + packets_received = [ + p[i].sprintf( + "%IP.chksum%;%UDP.chksum%;%IP:2.chksum%;%UDP:2.chksum%;%TCP.chksum%;%SCTP.chksum%" + ) + for i in range(nr_packets) + ] + + packets_received = [ + item + for item in packets_received[0].replace("??", "").split(";") + if item != "" + ] + self.logger.debug(f"packets_received=>{packets_received}") + self.logger.debug(f"expected_chksum=>{expected_chksum}") + self.verify( + len(expected_chksum) == len(packets_received), + f"The chksum type {packet_type} length of the actual result is inconsistent with the expected length!", + ) + self.verify( + packets_received == expected_chksum, + f"The actually received chksum {packet_type} is inconsistent with the expectation", + ) + + @check_supported_nic( + ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"] + ) + @skip_unsupported_pkg(["os default"]) + def test_checksum_offload_tunnel_enable(self): + """ + Enable HW checksum offload. + Send packet with inner and outer incorrect checksum, + can rx it and report the checksum error, + verify forwarded packets have correct checksum. + """ + self.launch_testpmd( + dcf_flag=self.dcf_mode, + param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "", + ) + self.vm0_testpmd.execute_cmd("set fwd csum") + self.vm0_testpmd.execute_cmd("set promisc 1 on") + self.vm0_testpmd.execute_cmd("set promisc 0 on") + self.vm0_testpmd.execute_cmd("csum mac-swap off 0", "testpmd>") + self.vm0_testpmd.execute_cmd("csum mac-swap off 1", "testpmd>") + time.sleep(2) + port_id_0 = 0 + mac = self.vm0_testpmd.get_port_mac(0) + sndIP = "10.0.0.1" + sndIPv6 = "::1" + expIP = sndIP + expIPv6 = sndIPv6 + + pkts_outer = { + "IP/UDP/VXLAN-GPE": f'IP(src = "{sndIP}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN()', + "IP/UDP/VXLAN-GPE/ETH": f'IP(src = "{sndIP}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN() / Ether()', + "IPv6/UDP/VXLAN-GPE": f'IPv6(src = "{sndIPv6}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN()', + "IPv6/UDP/VXLAN-GPE/ETH": f'IPv6(src = "{sndIPv6}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN() / Ether()', + "IP/GRE": f'IP(src = "{sndIP}", proto = 47, chksum = 0xff) / GRE()', + "IP/GRE/ETH": f'IP(src = "{sndIP}", proto = 47, chksum = 0xff) / GRE() / Ether()', + "IP/NVGRE/ETH": f'IP(src = "{sndIP}", proto = 47, chksum = 0xff) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()', + "IPv6/GRE": f'IPv6(src = "{sndIPv6}", nh = 47) / GRE()', + "IPv6/GRE/ETH": f'IPv6(src = "{sndIPv6}", nh = 47) / GRE() / Ether()', + "IPv6/NVGRE/ETH": f'IPv6(src = "{sndIPv6}", nh = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()', + "IP/UDP/GTPU": f'IP(src = "{sndIP}", chksum = 0xff) / UDP(dport = 2152, chksum = 0xff) / GTP_U_Header(gtp_type=255, teid=0x123456)', + "IPv6/UDP/GTPU": f'IPv6(src = "{sndIPv6}") / UDP(dport = 2152, chksum = 0xff) / GTP_U_Header(gtp_type=255, teid=0x123456)', + } + pkts_inner = { + "IP/UDP": f'IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 29999, dport = 30000, chksum = 0xff) / Raw("x" * 100)', + "IP/TCP": f'IP(src = "{sndIP}", chksum = 0xff) / TCP(sport = 29999, dport = 30000, chksum = 0xff) / Raw("x" * 100)', + "IP/SCTP": f'IP(src = "{sndIP}", chksum = 0xff) / SCTP(sport = 29999, dport = 30000, chksum = 0x0) / Raw("x" * 128)', + "IPv6/UDP": f'IPv6(src = "{sndIPv6}") / UDP(sport = 29999, dport = 30000, chksum = 0xff) / Raw("x" * 100)', + "IPv6/TCP": f'IPv6(src = "{sndIPv6}") / TCP(sport = 29999, dport = 30000, chksum = 0xff) / Raw("x" * 100)', + "IPv6/SCTP": f'IPv6(src = "{sndIPv6}") / SCTP(sport = 29999, dport = 30000, chksum = 0x0) / Raw("x" * 128)', + } + + if self.dcf_mode == "enable": + pkts_outer[ + "IP/UDP/VXLAN/ETH" + ] = f'IP(src = "{sndIP}") / UDP(sport = 4789, dport = 4789, chksum = 0xff) / VXLAN() / Ether()' + pkts_outer[ + "IPv6/UDP/VXLAN/ETH" + ] = f'IPv6(src = "{sndIPv6}") / UDP(sport = 4789, dport = 4789, chksum = 0xff) / VXLAN() / Ether()' + + pkts = { + key_outer + + "/" + + key_inner: f'Ether(dst="{mac}", src="52:00:00:00:00:00") / ' + + p_outer + + " / " + + p_inner + for key_outer, p_outer in pkts_outer.items() + for key_inner, p_inner in pkts_inner.items() + } + + pkts_outer_ref = { + "IP/UDP/VXLAN-GPE": f'IP(src = "{expIP}") / UDP(sport = 4790, dport = 4790) / VXLAN()', + "IP/UDP/VXLAN-GPE/ETH": f'IP(src = "{expIP}") / UDP(sport = 4790, dport = 4790) / VXLAN() / Ether()', + "IPv6/UDP/VXLAN-GPE": f'IPv6(src = "{expIPv6}") / UDP(sport = 4790, dport = 4790) / VXLAN()', + "IPv6/UDP/VXLAN-GPE/ETH": f'IPv6(src = "{expIPv6}") / UDP(sport = 4790, dport = 4790) / VXLAN() / Ether()', + "IP/GRE": f'IP(src = "{expIP}", proto = 47) / GRE()', + "IP/GRE/ETH": f'IP(src = "{expIP}", proto = 47) / GRE() / Ether()', + "IP/NVGRE/ETH": f'IP(src = "{expIP}", proto = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()', + "IPv6/GRE": f'IPv6(src = "{expIPv6}", nh = 47) / GRE()', + "IPv6/GRE/ETH": f'IPv6(src = "{expIPv6}", nh = 47) / GRE() / Ether()', + "IPv6/NVGRE/ETH": f'IPv6(src = "{expIPv6}", nh = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()', + "IP/UDP/GTPU": f'IP(src = "{expIP}") / UDP(dport = 2152) / GTP_U_Header(gtp_type=255, teid=0x123456)', + "IPv6/UDP/GTPU": f'IPv6(src = "{expIPv6}") / UDP(dport = 2152) / GTP_U_Header(gtp_type=255, teid=0x123456)', + } + pkts_inner_ref = { + "IP/UDP": f'IP(src = "{expIP}") / UDP(sport = 29999, dport = 30000) / Raw("x" * 100)', + "IP/TCP": f'IP(src = "{expIP}") / TCP(sport = 29999, dport = 30000) / Raw("x" * 100)', + "IP/SCTP": f'IP(src = "{expIP}") / SCTP(sport = 29999, dport = 30000) / Raw("x" * 128)', + "IPv6/UDP": f'IPv6(src = "{expIPv6}") / UDP(sport = 29999, dport = 30000) / Raw("x" * 100)', + "IPv6/TCP": f'IPv6(src = "{expIPv6}") / TCP(sport = 29999, dport = 30000) / Raw("x" * 100)', + "IPv6/SCTP": f'IPv6(src = "{expIPv6}") / SCTP(sport = 29999, dport = 30000) / Raw("x" * 128)', + } + + if self.dcf_mode == "enable": + pkts_outer_ref[ + "IP/UDP/VXLAN/ETH" + ] = f'IP(src = "{sndIP}") / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()' + pkts_outer_ref[ + "IPv6/UDP/VXLAN/ETH" + ] = f'IPv6(src = "{sndIPv6}") / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()' + + pkts_ref = { + key_outer + + "/" + + key_inner: f'Ether(dst="{mac}", src="52:00:00:00:00:00") / ' + + p_outer + + " / " + + p_inner + for key_outer, p_outer in pkts_outer_ref.items() + for key_inner, p_inner in pkts_inner_ref.items() + } + + self.checksum_enablehw_tunnel(0, self.vm_dut_0) + self.checksum_enablehw_tunnel(1, self.vm_dut_0) + + self.vm0_testpmd.execute_cmd("start") + self.vm0_testpmd.wait_link_status_up(0) + self.vm0_testpmd.wait_link_status_up(1) + self.checksum_validate_tunnel(pkts, pkts_ref) + # Validate checksum on the receive packet + out = self.vm0_testpmd.execute_cmd("stop") + bad_outer_ipcsum = self.vm0_testpmd.get_pmd_value("Bad-outer-ipcsum:", out) + bad_outer_l4csum = self.vm0_testpmd.get_pmd_value("Bad-outer-l4csum:", out) + bad_inner_ipcsum = self.vm0_testpmd.get_pmd_value("Bad-ipcsum:", out) + bad_inner_l4csum = self.vm0_testpmd.get_pmd_value("Bad-l4csum:", out) + self.verify(bad_outer_ipcsum == 42, "Bad-outer-ipcsum check error") + self.verify(bad_outer_l4csum == 66, "Bad-outer-l4csum check error") + self.verify(bad_inner_ipcsum == 42, "Bad-ipcsum check error") + self.verify(bad_inner_l4csum == 84, "Bad-l4csum check error") + def test_checksum_offload_disable(self): """ Enable SW checksum offload. From patchwork Fri Dec 23 08:55:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 121353 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 49357A0093; Fri, 23 Dec 2022 09:57:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 450C942D0D; Fri, 23 Dec 2022 09:57:02 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 2238042D0D for ; Fri, 23 Dec 2022 09:56:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671785820; x=1703321820; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nRkxm8br8Z4wOj6vwWbw/SXIqKSkE/1H+rx+3BE2e80=; b=ZNSGy6g6JMgJ+WbJ0pGyxBcU2jlGCxLGKDFauCv4Oqpd41Hjl3puAPNr kVtKtjr+eq9V9TL6JWdHCubgUrwh2mvEAoaLSExe1A5YvGThn+UfqirCl jjhyUkY8f8rxeii+fKSke0yZjkbfCmituO+/emJoxqN30Q1QkUndwJ55V xmpe3LXeJQ/hcgOWqj7HB0+Gyi2EPRTxUIDgQwBkz4PEWrLTGIjQ5ssLt JUajhC31Lsi+PHuU8Z+iBHQiaaYipf5+BQQFMNcCwErJY28oI2qgNMLWS ICSabc9xqmtXIZpgGs5DoQ/s1zvPuqdAnVGD+pT7zgZXoVucHMqKxgYRl w==; X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="303773490" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="303773490" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2022 00:56:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="776304472" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="776304472" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by orsmga004.jf.intel.com with ESMTP; 23 Dec 2022 00:56:57 -0800 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, weiyuanx.li@intel.com, qi.fu@intel.com, lijuan.tu@intel.com Subject: [DTS][PATCH V6 3/5] tests/vf_offload: add vf tso case for tunneling packets. Date: Fri, 23 Dec 2022 16:55:25 +0800 Message-Id: <20221223085527.29760-4-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221223085527.29760-1-ke1.xu@intel.com> References: <20221223085527.29760-1-ke1.xu@intel.com> MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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 In DPDK 22.11, tunneling tso is supported. This case supporting validation these packets. Signed-off-by: Weiyuan Li Signed-off-by: Ke Xu --- tests/TestSuite_vf_offload.py | 186 ++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index bab4f39e..3d89729d 100644 --- a/tests/TestSuite_vf_offload.py +++ b/tests/TestSuite_vf_offload.py @@ -216,6 +216,32 @@ class TestVfOffload(TestCase): dut.send_expect("csum set sctp sw %d" % port, "testpmd>") dut.send_expect("port start all", "testpmd>") + def tso_enable(self, port, dut): + dut.send_expect("port stop %d" % port, "testpmd>") + dut.send_expect("csum set ip hw %d" % port, "testpmd>") + dut.send_expect("csum set udp hw %d" % port, "testpmd>") + dut.send_expect("csum set tcp hw %d" % port, "testpmd>") + dut.send_expect("csum set sctp hw %d" % port, "testpmd>") + dut.send_expect("csum set outer-ip hw %d" % port, "testpmd>") + dut.send_expect("csum set outer-udp hw %d" % port, "testpmd>") + dut.send_expect("csum parse-tunnel on %d" % port, "testpmd>") + dut.send_expect("tso set 800 %d" % port, "testpmd>") + dut.send_expect("port start %d" % port, "testpmd>") + + def tso_enable_tunnel(self, port, dut): + dut.send_expect("port stop %d" % port, "testpmd>") + dut.send_expect("csum set ip hw %d" % port, "testpmd>") + dut.send_expect("csum set udp hw %d" % port, "testpmd>") + dut.send_expect("csum set tcp hw %d" % port, "testpmd>") + dut.send_expect("csum set sctp hw %d" % port, "testpmd>") + dut.send_expect("csum set outer-ip hw %d" % port, "testpmd>") + dut.send_expect("csum set outer-udp hw %d" % port, "testpmd>") + dut.send_expect("csum parse-tunnel on %d" % port, "testpmd>") + dut.send_expect("rx_vxlan_port add 4789 %d" % port, "testpmd>") + dut.send_expect("tso set 800 %d" % port, "testpmd>") + dut.send_expect("tunnel_tso set 800 %d" % port, "testpmd>") + dut.send_expect("port start %d" % port, "testpmd>") + def checksum_validate(self, packets_sent, packets_expected): """ Validate the checksum. @@ -853,6 +879,166 @@ class TestVfOffload(TestCase): "the packet segmentation incorrect, %s" % tx_outlist, ) + @check_supported_nic( + ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"] + ) + @skip_unsupported_pkg(["os default"]) + def test_tso_tunnel(self): + """ + TSO tunneled IPv4 TCP, IPv6 TCP testing. + """ + tx_interface = self.tester.get_interface( + self.tester.get_local_port(self.vm0_dut_ports[0]) + ) + rx_interface = self.tester.get_interface( + self.tester.get_local_port(self.vm0_dut_ports[1]) + ) + + self.loading_sizes = [128, 800, 801, 1700, 2500] + + self.tester.send_expect( + "ethtool -K %s rx off tx off tso off gso off gro off lro off" + % tx_interface, + "# ", + ) + self.tester.send_expect("ip l set %s up" % tx_interface, "# ") + self.dut.send_expect( + "ifconfig %s mtu %s" % (self.dut.ports_info[0]["intf"], TSO_MTU), "# " + ) + self.dut.send_expect( + "ifconfig %s mtu %s" % (self.dut.ports_info[1]["intf"], TSO_MTU), "# " + ) + + self.portMask = utils.create_mask([self.vm0_dut_ports[0]]) + self.launch_testpmd( + dcf_flag=self.dcf_mode, + param="--portmask=0x3 " + + "--enable-rx-cksum " + + "--max-pkt-len=%s" % TSO_MTU, + ) + + mac = self.vm0_testpmd.get_port_mac(0) + self.vm0_testpmd.execute_cmd("set verbose 1", "testpmd> ", 120) + self.vm0_testpmd.execute_cmd("set fwd csum", "testpmd>", 120) + self.vm0_testpmd.execute_cmd("set promisc 0 on", "testpmd> ", 120) + self.vm0_testpmd.execute_cmd("set promisc 1 on", "testpmd> ", 120) + self.vm0_testpmd.execute_cmd("csum mac-swap off 0", "testpmd>") + self.vm0_testpmd.execute_cmd("csum mac-swap off 1", "testpmd>") + self.tso_enable_tunnel(self.vm0_dut_ports[0], self.vm_dut_0) + self.tso_enable_tunnel(self.vm0_dut_ports[1], self.vm_dut_0) + self.vm0_testpmd.execute_cmd("start") + self.vm0_testpmd.wait_link_status_up(self.vm0_dut_ports[0]) + self.vm0_testpmd.wait_link_status_up(self.vm0_dut_ports[1]) + + pkts_outer = { + "IP/UDP/VXLAN/ETH": 'IP(src = "192.168.1.1", dst = "192.168.1.2") / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()', + "IP/UDP/VXLAN-GPE": 'IP(src = "192.168.1.1", dst = "192.168.1.2") / UDP(sport = 4790, dport = 4790) / VXLAN()', + "IP/UDP/VXLAN-GPE/ETH": 'IP(src = "192.168.1.1", dst = "192.168.1.2") / UDP(sport = 4790, dport = 4790) / VXLAN() / Ether()', + "IPv6/UDP/VXLAN/ETH": 'IPv6(src = "FE80:0:0:0:200:1FF:FE00:200", dst = "3555:5555:6666:6666:7777:7777:8888:8888") / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()', + "IPv6/UDP/VXLAN-GPE": 'IPv6(src = "FE80:0:0:0:200:1FF:FE00:200", dst = "3555:5555:6666:6666:7777:7777:8888:8888") / UDP(sport = 4790, dport = 4790) / VXLAN()', + "IPv6/UDP/VXLAN-GPE/ETH": 'IPv6(src = "FE80:0:0:0:200:1FF:FE00:200", dst = "3555:5555:6666:6666:7777:7777:8888:8888") / UDP(sport = 4790, dport = 4790) / VXLAN() / Ether()', + "IP/GRE": 'IP(src = "192.168.1.1", dst = "192.168.1.2", proto = 47) / GRE()', + "IP/GRE/ETH": 'IP(src = "192.168.1.1", dst = "192.168.1.2", proto = 47) / GRE() / Ether()', + "IP/NVGRE/ETH": 'IP(src = "192.168.1.1", dst = "192.168.1.2", proto = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()', + "IPv6/GRE": 'IPv6(src = "FE80:0:0:0:200:1FF:FE00:200", dst = "3555:5555:6666:6666:7777:7777:8888:8888", nh = 47) / GRE()', + "IPv6/GRE/ETH": 'IPv6(src = "FE80:0:0:0:200:1FF:FE00:200", dst = "3555:5555:6666:6666:7777:7777:8888:8888", nh = 47) / GRE() / Ether()', + "IPv6/NVGRE/ETH": 'IPv6(src = "FE80:0:0:0:200:1FF:FE00:200", dst = "3555:5555:6666:6666:7777:7777:8888:8888", nh = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()', + "IP/UDP/GTPU": 'IP(src = "192.168.1.1", dst = "192.168.1.2") / UDP(dport = 2152) / GTP_U_Header(gtp_type=255, teid=0x123456)', + "IPv6/UDP/GTPU": 'IPv6(src = "FE80:0:0:0:200:1FF:FE00:200", dst = "3555:5555:6666:6666:7777:7777:8888:8888") / UDP(dport = 2152) / GTP_U_Header(gtp_type=255, teid=0x123456)', + } + + self.tester.scapy_foreground() + time.sleep(5) + + for key_outer in pkts_outer: + for loading_size in self.loading_sizes: + # IPv4 tcp test + out = self.vm0_testpmd.execute_cmd( + "clear port info all", "testpmd> ", 120 + ) + self.tcpdump_start_sniffing([tx_interface, rx_interface]) + if "GTPU" in key_outer: + self.tester.scapy_append( + "from scapy.contrib.gtp import GTP_U_Header" + ) + self.tester.scapy_append( + ( + 'sendp([Ether(dst="%s",src="52:00:00:00:00:00")/' + + pkts_outer[key_outer] + + '/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' + ) + % (mac, loading_size, tx_interface) + ) + out = self.tester.scapy_execute() + out = self.vm0_testpmd.execute_cmd("show port stats all") + print(out) + self.tcpdump_stop_sniff() + rx_stats = self.number_of_packets(rx_interface) + tx_stats = self.number_of_packets(tx_interface) + tx_outlist = self.number_of_bytes(rx_interface) + self.logger.info(tx_outlist) + if loading_size <= 800: + self.verify( + rx_stats == tx_stats and int(tx_outlist[0]) == loading_size, + f"{key_outer} tunnel IPV4 RX or TX packet number not correct", + ) + else: + num = loading_size // 800 + for i in range(num): + self.verify( + int(tx_outlist[i]) == 800, + "the packet segmentation incorrect, %s" % tx_outlist, + ) + if loading_size % 800 != 0: + self.verify( + int(tx_outlist[num]) == loading_size % 800, + "the packet segmentation incorrect, %s" % tx_outlist, + ) + + for loading_size in self.loading_sizes: + # IPv6 tcp test + out = self.vm0_testpmd.execute_cmd( + "clear port info all", "testpmd> ", 120 + ) + self.tcpdump_start_sniffing([tx_interface, rx_interface]) + if "GTPU" in key_outer: + self.tester.scapy_append( + "from scapy.contrib.gtp import GTP_U_Header" + ) + self.tester.scapy_append( + ( + 'sendp([Ether(dst="%s", src="52:00:00:00:00:00")/' + + pkts_outer[key_outer] + + '/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' + ) + % (mac, loading_size, tx_interface) + ) + out = self.tester.scapy_execute() + out = self.vm0_testpmd.execute_cmd("show port stats all") + print(out) + self.tcpdump_stop_sniff() + rx_stats = self.number_of_packets(rx_interface) + tx_stats = self.number_of_packets(tx_interface) + tx_outlist = self.number_of_bytes(rx_interface) + self.logger.info(tx_outlist) + if loading_size <= 800: + self.verify( + rx_stats == tx_stats and int(tx_outlist[0]) == loading_size, + f"{key_outer} tunnel IPV6 RX or TX packet number not correct", + ) + else: + num = loading_size // 800 + for i in range(num): + self.verify( + int(tx_outlist[i]) == 800, + "the packet segmentation incorrect, %s" % tx_outlist, + ) + if loading_size % 800 != 0: + self.verify( + int(tx_outlist[num]) == loading_size % 800, + "the packet segmentation incorrect, %s" % tx_outlist, + ) + def tear_down(self): self.vm0_testpmd.execute_cmd("quit", "# ") self.dut.send_expect( From patchwork Fri Dec 23 08:55:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 121354 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6512AA0093; Fri, 23 Dec 2022 09:57:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60B904282D; Fri, 23 Dec 2022 09:57:03 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id D4ECB40698 for ; Fri, 23 Dec 2022 09:57:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671785822; x=1703321822; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2DqAhc9qM416mDMeeXmdR5erlATuWYcw5HBmBzjWWzI=; b=L8PcEcV9qOcGijs1e5zz8g4s8zLaspj3OcPeWHefmqDKtF+hJ5MyPB5u y5ndzItS4Y+VHrqD1PpE6FfePzJjVP9vVd6JNbAphvpPto7mekXmbH1ZD jbd7DWdw3XWGNWZ3H0Uu0mrpuAcfqx5vxzoJLhr525uphwmyOZizzvQtC YBqnUJ5GCnNdZpeXC3JxDPdvScMPYHHkvVtFhW4J1O9AJNPB6s0/SaQYR AvNGoruYMPmDTeEP1nOQnUMOt37a8G3ScBmE6DNtC6oWhJbdp0rMmTlkL NNA0PvLxpH++/hxav8bX7IORqfmKDDKYTcpo/0YMuri5Fa6ZsvETXAdwt w==; X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="303773493" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="303773493" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2022 00:57:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="776304479" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="776304479" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by orsmga004.jf.intel.com with ESMTP; 23 Dec 2022 00:56:59 -0800 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, weiyuanx.li@intel.com, qi.fu@intel.com, lijuan.tu@intel.com Subject: [DTS][PATCH V6 4/5] tests/vf_offload: add new method to anayse tunnel packets. Date: Fri, 23 Dec 2022 16:55:26 +0800 Message-Id: <20221223085527.29760-5-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221223085527.29760-1-ke1.xu@intel.com> References: <20221223085527.29760-1-ke1.xu@intel.com> MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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 As tcpdump not supporting some of the packet organizations we are to cover, a newly implemented function is introduced to replace number_of_packets and number_of_bytes in tunnel cases. Signed-off-by: Ke Xu --- tests/TestSuite_vf_offload.py | 64 +++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index 3d89729d..6765fcc5 100644 --- a/tests/TestSuite_vf_offload.py +++ b/tests/TestSuite_vf_offload.py @@ -6,8 +6,19 @@ import re import string import time +from scapy.contrib.lldp import LLDPDU, LLDPDUManagementAddress +from scapy.contrib.mpls import MPLS +from scapy.contrib.nsh import NSH +from scapy.layers.inet import ICMP, IP, TCP, UDP +from scapy.layers.inet6 import IPv6, IPv6ExtHdrFragment, IPv6ExtHdrRouting +from scapy.layers.l2 import ARP, GRE, Dot1Q, Ether +from scapy.layers.sctp import SCTP +from scapy.layers.vxlan import VXLAN +from scapy.packet import Raw + import framework.utils as utils from framework.crb import Crb +from framework.packet import Packet from framework.pmd_output import PmdOutput from framework.settings import DPDK_DCFMODE_SETTING, HEADER_SIZE, load_global_setting from framework.test_case import TestCase, check_supported_nic, skip_unsupported_pkg @@ -687,6 +698,25 @@ class TestVfOffload(TestCase): self.tester.send_expect('echo "Cleaning buffer"', "#") time.sleep(1) + def tcpdump_analyse_sniff(self, iface): + """ + Analyse the tcpdump captured packets. Returning the number of + packets and the bytes of packets payload. + """ + packet = Packet() + pkts = packet.read_pcapfile("tcpdump_{0}.pcap".format(iface), self.tester) + pkts = [ + p + for p in pkts + if len(p.layers()) >= 3 + and p.layers()[1] in {IP, IPv6} + and p.layers()[2] in {IP, IPv6, UDP, TCP, SCTP, GRE, MPLS} + and Raw in p + ] + rx_packet_count = len(pkts) + rx_packet_size = [len(p[Raw]) for p in pkts] + return rx_packet_count, rx_packet_size + def tcpdump_command(self, command): """ Send a tcpdump related command and return an integer from the output. @@ -973,26 +1003,25 @@ class TestVfOffload(TestCase): out = self.vm0_testpmd.execute_cmd("show port stats all") print(out) self.tcpdump_stop_sniff() - rx_stats = self.number_of_packets(rx_interface) - tx_stats = self.number_of_packets(tx_interface) - tx_outlist = self.number_of_bytes(rx_interface) - self.logger.info(tx_outlist) + rx_stats, payload_size_list = self.tcpdump_analyse_sniff(rx_interface) + tx_stats, _ = self.tcpdump_analyse_sniff(tx_interface) + self.logger.info(payload_size_list) if loading_size <= 800: self.verify( - rx_stats == tx_stats and int(tx_outlist[0]) == loading_size, + rx_stats == tx_stats and payload_size_list[0] == loading_size, f"{key_outer} tunnel IPV4 RX or TX packet number not correct", ) else: num = loading_size // 800 for i in range(num): self.verify( - int(tx_outlist[i]) == 800, - "the packet segmentation incorrect, %s" % tx_outlist, + payload_size_list[i] == 800, + "the packet segmentation incorrect, %s" % payload_size_list, ) if loading_size % 800 != 0: self.verify( - int(tx_outlist[num]) == loading_size % 800, - "the packet segmentation incorrect, %s" % tx_outlist, + payload_size_list[num] == loading_size % 800, + "the packet segmentation incorrect, %s" % payload_size_list, ) for loading_size in self.loading_sizes: @@ -1017,26 +1046,25 @@ class TestVfOffload(TestCase): out = self.vm0_testpmd.execute_cmd("show port stats all") print(out) self.tcpdump_stop_sniff() - rx_stats = self.number_of_packets(rx_interface) - tx_stats = self.number_of_packets(tx_interface) - tx_outlist = self.number_of_bytes(rx_interface) - self.logger.info(tx_outlist) + rx_stats, payload_size_list = self.tcpdump_analyse_sniff(rx_interface) + tx_stats, _ = self.tcpdump_analyse_sniff(tx_interface) + self.logger.info(payload_size_list) if loading_size <= 800: self.verify( - rx_stats == tx_stats and int(tx_outlist[0]) == loading_size, + rx_stats == tx_stats and payload_size_list[0] == loading_size, f"{key_outer} tunnel IPV6 RX or TX packet number not correct", ) else: num = loading_size // 800 for i in range(num): self.verify( - int(tx_outlist[i]) == 800, - "the packet segmentation incorrect, %s" % tx_outlist, + payload_size_list[i] == 800, + "the packet segmentation incorrect, %s" % payload_size_list, ) if loading_size % 800 != 0: self.verify( - int(tx_outlist[num]) == loading_size % 800, - "the packet segmentation incorrect, %s" % tx_outlist, + payload_size_list[num] == loading_size % 800, + "the packet segmentation incorrect, %s" % payload_size_list, ) def tear_down(self): From patchwork Fri Dec 23 08:55:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 121355 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 83DEDA0093; Fri, 23 Dec 2022 09:57:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7FAE341156; Fri, 23 Dec 2022 09:57:05 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id D7A9040698 for ; Fri, 23 Dec 2022 09:57:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671785824; x=1703321824; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B8ThAocNX9gA0wDFYR2gUarAQUgtRDjWQNXQGvG4ZWs=; b=oIuf4SIVkqVpeMJXJXitKAf4XLYvm6noPwD4gnH4uzVVuDVRsqCVAWcL rVARP6jwZnhEMK0lLa2Fyjdvf8pnqac5lMOgkXFqI6gfLJ1qbqocqL6Qy +fhuQQSjvL9rO5tawVnfJP7iwftS7lkCFlvA05JuzIf5eS4Su8sTUdKdx oin5/iEtt+LJEAaQmT4MN0OlrXe6rJUx/isau/lItI9hJzjDTvxlzGf/a WjS5YXB1S51R8DNio5yeZ4MTspqq0UL0j/9aNB2J0PeHN/iJ1rULvjL68 On8gjfmIkDskfEbs5J7Y36NnXrN/L7bScVOGPgQF7lP5evrodH09WxVfX A==; X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="303773496" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="303773496" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2022 00:57:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="776304486" X-IronPort-AV: E=Sophos;i="5.96,268,1665471600"; d="scan'208";a="776304486" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by orsmga004.jf.intel.com with ESMTP; 23 Dec 2022 00:57:01 -0800 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, weiyuanx.li@intel.com, qi.fu@intel.com, lijuan.tu@intel.com Subject: [DTS][PATCH V6 5/5] tests/vf_offload: fix and improve unstable implementations. Date: Fri, 23 Dec 2022 16:55:27 +0800 Message-Id: <20221223085527.29760-6-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221223085527.29760-1-ke1.xu@intel.com> References: <20221223085527.29760-1-ke1.xu@intel.com> MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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 Improved checksum validation part for tunnel cases, ensuring correctness under different scenarios. Abandoned the using of packet sprintf method in validation, fixing the possible wrong output under certain packet organizations. Branched bad checksum counting, ensuring the correctness under DCF enabled scenario. Signed-off-by: Weiyuan Li Signed-off-by: Ke Xu Tested-by: Weiyuan Li --- tests/TestSuite_vf_offload.py | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index 6765fcc5..62e74c33 100644 --- a/tests/TestSuite_vf_offload.py +++ b/tests/TestSuite_vf_offload.py @@ -461,20 +461,10 @@ class TestVfOffload(TestCase): p = self.tester.load_tcpdump_sniff_packets(inst) nr_packets = len(p) print(p) - packets_received = [ - p[i].sprintf( - "%IP.chksum%;%UDP.chksum%;%IP:2.chksum%;%UDP:2.chksum%;%TCP.chksum%;%SCTP.chksum%" - ) - for i in range(nr_packets) - ] - - packets_received = [ - item - for item in packets_received[0].replace("??", "").split(";") - if item != "" - ] - self.logger.debug(f"packets_received=>{packets_received}") - self.logger.debug(f"expected_chksum=>{expected_chksum}") + chksums = checksum_pattern.findall(p[0].show2(dump=True)) + packets_received = chksums + self.logger.debug(f"packets_received: {packets_received}") + self.logger.debug(f"expected_chksum: {expected_chksum}") self.verify( len(expected_chksum) == len(packets_received), f"The chksum type {packet_type} length of the actual result is inconsistent with the expected length!", @@ -609,10 +599,16 @@ class TestVfOffload(TestCase): bad_outer_l4csum = self.vm0_testpmd.get_pmd_value("Bad-outer-l4csum:", out) bad_inner_ipcsum = self.vm0_testpmd.get_pmd_value("Bad-ipcsum:", out) bad_inner_l4csum = self.vm0_testpmd.get_pmd_value("Bad-l4csum:", out) - self.verify(bad_outer_ipcsum == 42, "Bad-outer-ipcsum check error") - self.verify(bad_outer_l4csum == 66, "Bad-outer-l4csum check error") - self.verify(bad_inner_ipcsum == 42, "Bad-ipcsum check error") - self.verify(bad_inner_l4csum == 84, "Bad-l4csum check error") + if self.dcf_mode == "enable": + self.verify(bad_outer_ipcsum == 24, "Bad-outer-ipcsum check error") + self.verify(bad_outer_l4csum == 48, "Bad-outer-l4csum check error") + self.verify(bad_inner_ipcsum == 42, "Bad-ipcsum check error") + self.verify(bad_inner_l4csum == 84, "Bad-l4csum check error") + else: + self.verify(bad_outer_ipcsum == 24, "Bad-outer-ipcsum check error") + self.verify(bad_outer_l4csum == 36, "Bad-outer-l4csum check error") + self.verify(bad_inner_ipcsum == 36, "Bad-ipcsum check error") + self.verify(bad_inner_l4csum == 72, "Bad-l4csum check error") def test_checksum_offload_disable(self): """