From patchwork Wed Dec 21 06:08:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 121149 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 C80EFA0093; Wed, 21 Dec 2022 07:10:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B49B442D10; Wed, 21 Dec 2022 07:10:33 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 9AF6C40684 for ; Wed, 21 Dec 2022 07:10:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671603031; x=1703139031; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=skV/zDr077r+BD38qt/1hA6ITgURdpxPI+wd3a1NBTU=; b=gCq0Y6FGuEPI68nfdFtGs6th/3Sfe4yuVus4T7NijtuAbSX2ue2kNd6K cvepVIl6Tah847gqjSMdUZy1IYBFceScANfxwDD7GyFWtaKpmJ7CCu4x3 onI3+Hsjw6RR7KZZzGrQl56HYZztpX6VmKooT/u9oBRKyhjo4wWsArJy1 +BYaVqxrGKCLXm3FcDHsbBkN8MvlCLQR0XL995TXqayXp/HOLwa4m8XzO L1LEPpBPTtn/4NEuvNTIW6A9J4vrs3dkx9TmynXcZ29WqdQD2x7Cil5Xd PrnQW3abg/SfD81lBsrjZlpSSPjCCEZBCkcpKaIsO5HWZduajGFyY/r+b g==; X-IronPort-AV: E=McAfee;i="6500,9779,10567"; a="303222028" X-IronPort-AV: E=Sophos;i="5.96,261,1665471600"; d="scan'208";a="303222028" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2022 22:10:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10567"; a="775570291" X-IronPort-AV: E=Sophos;i="5.96,261,1665471600"; d="scan'208";a="775570291" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2022 22:10:29 -0800 From: Ke Xu To: dts@dpdk.org Cc: lijuan.tu@intel.com, qi.fu@intel.com, weiyuanx.li@intel.com, Ke Xu Subject: [DTS][PATCH V3 1/4] tests/vf_offload: fix a typo. Date: Wed, 21 Dec 2022 14:08:59 +0800 Message-Id: <20221221060902.8269-2-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221221060902.8269-1-ke1.xu@intel.com> References: <20221221060902.8269-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. Signed-off-by: Ke Xu --- tests/TestSuite_vf_offload.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index 75c75f05..c7f618e3 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 From patchwork Wed Dec 21 06:09:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 121150 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 F1C61A0093; Wed, 21 Dec 2022 07:10:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED9D94114A; Wed, 21 Dec 2022 07:10:34 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 97FE740684 for ; Wed, 21 Dec 2022 07:10:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671603033; x=1703139033; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XuoYad/z4YyIelZVnd4k1DUWDMJGlKWluwOVkerX2Fg=; b=jUtoSUAIfgkZqr//hbXCwcxHOrop3uSmhQ8NuG9h8Pp1Ckg+eHaLegYK rOdZoP/7kAnCuDt0r3JrWnCpr7qhpTkToRc8aUnAhz9s9U0psDIsEQDS+ phjo8zxwdegayrH9Vh7UHoTYmmFF4eMC8vhRtEDeLCMxCVMcNULxRls/1 kksL9PXgiAyxBB5Ot9YRNtnyRWPCfdWr4zdiUWGGTWKTtbZMRgRaUKIcW muuiKk7BBH2jWZLv6YV7+WCj8W+ZIRI5kE81Tv238G75Y1KlzMpTy0uq+ XuN+V7lnyblNT0OBjIWZLhL8mT2YlwxmyYhik3Q5RVCFTknVr8qsg+iEl A==; X-IronPort-AV: E=McAfee;i="6500,9779,10567"; a="303222033" X-IronPort-AV: E=Sophos;i="5.96,261,1665471600"; d="scan'208";a="303222033" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2022 22:10:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10567"; a="775570304" X-IronPort-AV: E=Sophos;i="5.96,261,1665471600"; d="scan'208";a="775570304" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2022 22:10:31 -0800 From: Ke Xu To: dts@dpdk.org Cc: lijuan.tu@intel.com, qi.fu@intel.com, weiyuanx.li@intel.com, Ke Xu Subject: [DTS][PATCH V3 2/4] tests/vf_offload: add vf checksum hw offload case for tunneling packets. Date: Wed, 21 Dec 2022 14:09:00 +0800 Message-Id: <20221221060902.8269-3-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221221060902.8269-1-ke1.xu@intel.com> References: <20221221060902.8269-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 | 217 +++++++++++++++++++++++++++++++++- 1 file changed, 215 insertions(+), 2 deletions(-) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index c7f618e3..4a32084c 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>") @@ -365,6 +377,207 @@ 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()", ">>>") + import pdb + + pdb.set_trace() + 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", + ) + + @skip_unsupported_pkg(["os default"]) + @check_supported_nic( + ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"] + ) + 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 = 0xff) / 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 = 0xff) / 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 Wed Dec 21 06:09:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 121151 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 1ED9BA0093; Wed, 21 Dec 2022 07:10:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1404A40FDF; Wed, 21 Dec 2022 07:10:37 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id A1F8A40684 for ; Wed, 21 Dec 2022 07:10:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671603035; x=1703139035; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+rJ9am7L2NgRgwjFO8TPpiSgvIAByTSVpxJTywIPxoo=; b=Y0pxQkimhTuaULv9G/oIKCHy3wMlqDDxjWExxcGOQendDsHh9FV0T9KI Vkw79YIWW0nZE0PvRcDUM6UV3baIrkT3/hB139MBH7cppUAv9sigU/xu9 IrEzAPfYZaCQ3jdesYK7UVv70SDvvsqTPFzF3a3i1Dnrus5ax36wJnzcj iTQXKURiJox8egX0otGzXhmmMcMjz0NsjSmgPmoJpelgOgAixO0koPuKK FG8vxBb8fFfugtdkCKlWz3Ptt2u07aegLRsYi/+n3rfm/P/Ajzv9Q/qBt KwChJjKcyAVIXiqPL4s/6aHFlLod20t03BPG+2Z6Pq+NvPDvHQ26PIzdS w==; X-IronPort-AV: E=McAfee;i="6500,9779,10567"; a="303222040" X-IronPort-AV: E=Sophos;i="5.96,261,1665471600"; d="scan'208";a="303222040" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2022 22:10:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10567"; a="775570316" X-IronPort-AV: E=Sophos;i="5.96,261,1665471600"; d="scan'208";a="775570316" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2022 22:10:33 -0800 From: Ke Xu To: dts@dpdk.org Cc: lijuan.tu@intel.com, qi.fu@intel.com, weiyuanx.li@intel.com, Ke Xu Subject: [DTS][PATCH V3 3/4] tests/vf_offload: add vf tso case for tunneling packets. Date: Wed, 21 Dec 2022 14:09:01 +0800 Message-Id: <20221221060902.8269-4-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221221060902.8269-1-ke1.xu@intel.com> References: <20221221060902.8269-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 | 178 ++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index 4a32084c..a2edec47 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. @@ -852,6 +878,158 @@ class TestVfOffload(TestCase): "the packet segmentation incorrect, %s" % tx_outlist, ) + @skip_unsupported_pkg(["os default"]) + @check_supported_nic( + ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"] + ) + 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]) + 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]) + 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 Wed Dec 21 06:09:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 121152 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 3CDF3A0093; Wed, 21 Dec 2022 07:10:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 387CD42D1A; Wed, 21 Dec 2022 07:10:38 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 3299D42D1A for ; Wed, 21 Dec 2022 07:10:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671603037; x=1703139037; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dt9eFUxh6LTxovk9q+XgaI4lMJgtKQWxBLT7NhZDEPg=; b=iU4BsA2MHLnp8FLsvIhsfbELZBAMHwRTGriHwbhtIXsvGxgu0mDLBE2b BWFk5TdLEshbk45GIpRGXEFJexU0tNWfTtzNaXvnBxLlb5SUSGzxa9lbM 7HBo2LKZqHa/s9r16jTkHCFyVEnOi/p2/ohL4Jyg+HK5fLnt6u8j0IgX8 pYYGyWM7Ct3GV5/pQ7SYb+eBUBvueaIPUZHQDBmpTJ7krCO7/qTTQhLmI gm8+BD2XljELUhJCBHYvuK7hObjykzE6bRdGe5niKaksgWgTKprfl0lt0 yB6cVds+WCy6zBR0vXERDsotXXBqSLQy1opm8654hYi5UGDt6z9VgSgI2 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10567"; a="303222055" X-IronPort-AV: E=Sophos;i="5.96,261,1665471600"; d="scan'208";a="303222055" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2022 22:10:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10567"; a="775570326" X-IronPort-AV: E=Sophos;i="5.96,261,1665471600"; d="scan'208";a="775570326" Received: from dpdk-xuke-lab.sh.intel.com ([10.67.119.8]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2022 22:10:35 -0800 From: Ke Xu To: dts@dpdk.org Cc: lijuan.tu@intel.com, qi.fu@intel.com, weiyuanx.li@intel.com, Ke Xu Subject: [DTS][PATCH V3 4/4] tests/vf_offload: dts adaptation DPDK checksum function changes Date: Wed, 21 Dec 2022 14:09:02 +0800 Message-Id: <20221221060902.8269-5-ke1.xu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221221060902.8269-1-ke1.xu@intel.com> References: <20221221060902.8269-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 DPDK22.11 236bc417e2da(app/testpmd: fix MAC header in checksum forward engine) changes the checksum functions adds switches to control whether to exchange MAC address. Modify DTS code to adapt to this change. Signed-off-by: Weiyuan Li --- tests/TestSuite_vf_offload.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index a2edec47..07e150cf 100644 --- a/tests/TestSuite_vf_offload.py +++ b/tests/TestSuite_vf_offload.py @@ -352,6 +352,8 @@ class TestVfOffload(TestCase): param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "", ) self.vm0_testpmd.execute_cmd("set fwd csum") + self.vm0_testpmd.execute_cmd("csum mac-swap off 0", "testpmd>") + self.vm0_testpmd.execute_cmd("csum mac-swap off 1", "testpmd>") self.vm0_testpmd.execute_cmd("set promisc 1 on") self.vm0_testpmd.execute_cmd("set promisc 0 on") @@ -615,6 +617,8 @@ class TestVfOffload(TestCase): param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "", ) self.vm0_testpmd.execute_cmd("set fwd csum") + self.vm0_testpmd.execute_cmd("csum mac-swap off 0", "testpmd>") + self.vm0_testpmd.execute_cmd("csum mac-swap off 1", "testpmd>") self.vm0_testpmd.execute_cmd("set promisc 1 on") self.vm0_testpmd.execute_cmd("set promisc 0 on")