From patchwork Tue Jul 18 01:26:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 129595 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 60B3A42E9F; Tue, 18 Jul 2023 03:26:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58B75427E9; Tue, 18 Jul 2023 03:26:43 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id AE4F240223 for ; Tue, 18 Jul 2023 03:26:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689643601; x=1721179601; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jFn62wrmbv6GNoD2O15sL2QNvbGJDAXOsWzLd7CuF70=; b=j9cctd5gzKg9fKnSkRnAdK1ejR+Dxg7kaofrjunCVtj8Y8pXafoc/XJA cHWyPa8zwDC3BejCTDvYLygrGLIx0HVVmEu6iL9cNbEY+Zkuqvh94R2GY A9MOkikTfxV97gDYcMcbWFIsrLxJNonXqDgHFWw7A1lr0kpsfeqgUL4Fn LAkcs9HVXxVvhWVDH3VS0N6yMdNkz23OCjG4sPt1m8UPg9t8kItnLQRiR 9FWhC2GlTucn5nm81ewVMhyLOcxhaqeGB/iGy+xv+Gu22Hg5j8R34TqRH mZr1EOngYoOIZvAytbLeNExR4t+D/EONGrZAfMy+1Mw4KamPid5s+9MGo g==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="366119549" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="366119549" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2023 18:26:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="837089841" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="837089841" Received: from dpdk-xuke-host.sh.intel.com ([10.67.114.220]) by fmsmga002.fm.intel.com with ESMTP; 17 Jul 2023 18:26:39 -0700 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, tarcadia@qq.com Subject: [DTS][Patch V2 6/6] tests/vf_offload: Refactor vf_offload cases. Date: Tue, 18 Jul 2023 01:26:29 +0000 Message-Id: <20230718012629.2471811-7-ke1.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230718012629.2471811-1-ke1.xu@intel.com> References: <20230712203334.2032445-3-ke1.xu@intel.com> <20230718012629.2471811-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 Update vf_offload testplan. Synced with PF checksum and TSO testplans. 1. Using common test method from offload_common ot update test cases and test scopes. Using HW and SW to describe checksum configuration. Add cases for enabling HW IP UDP TCP SCTP seperately. Add cases for inner HW enabled with enabling HW outer IP UDP seperately. Add cases for tunnel, non-tunnel and combined TSO seperately. 2. Update cases for NIC comaptibility. Add description for VLAN, DCF VxLAN and AVX512 to fit specific testing scenarios required by several NICs. 3. RX scopes and offload flags are combined with varied packet type TX cases for better covering and more common validation. Signed-off-by: Ke Xu --- tests/TestSuite_vf_offload.py | 3053 ++++++++++++++++++++------------- 1 file changed, 1899 insertions(+), 1154 deletions(-) diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py index d53f336b..e4e3c232 100644 --- a/tests/TestSuite_vf_offload.py +++ b/tests/TestSuite_vf_offload.py @@ -1,34 +1,644 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2020-2022 Intel Corporation +# Copyright(c) 2020-2023 Intel Corporation # -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 +import tests.offload_common as offload from framework.crb import Crb -from framework.packet import Packet +from framework.packet import Packet, Raw, randstring 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 +from framework.test_case import ( + TestCase, + check_supported_nic, + skip_unsupported, + skip_unsupported_host_driver, + skip_unsupported_nic, + skip_unsupported_pkg, +) from framework.utils import GREEN, RED from framework.virt_common import VM from nics.net_device import NetDevice VM_CORES_MASK = "all" DEFAULT_MTU = 1500 -TSO_MTU = 9000 + +CSUM_NON_TUNNEL_PACKETS = [ + func(offload.CSUM_INNER_PACKET_PART[_type]) + for _type in [ + "IP/UDP", + "IP/TCP", + "IP/SCTP", + "IPv6/UDP", + "IPv6/TCP", + "IPv6/SCTP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_ip_checksum, + offload.get_packet_with_bad_l4_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _ in range(offload.TX_REPEAT) +] + +CSUM_TUNNEL_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] / offload.CSUM_INNER_PACKET_PART[_i_type] + if _o_type + else offload.CSUM_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "IP/NVGRE", + "IPv6/NVGRE", + ] + for _i_type in [ + "IP/UDP", + "IP/TCP", + "IP/SCTP", + "IPv6/UDP", + "IPv6/TCP", + "IPv6/SCTP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_ip_checksum, + offload.get_packet_with_bad_l4_checksum, + offload.get_packet_with_bad_outer_ip_checksum, + offload.get_packet_with_bad_outer_l4_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _ in range(offload.TX_REPEAT) +] + +CSUM_TUNNEL_COMMONPKG_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] / offload.CSUM_INNER_PACKET_PART[_i_type] + if _o_type + else offload.CSUM_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "IP/VXLAN-GPE", + "IPv6/VXLAN-GPE", + "IP/VXLAN-GPE/Ether", + "IPv6/VXLAN-GPE/Ether", + "IP/GRE", + "IPv6/GRE", + "IP/GRE/Ether", + "IPv6/GRE/Ether", + "IP/NVGRE", + "IPv6/NVGRE", + "IP/GTPU", + "IPv6/GTPU", + ] + for _i_type in [ + "IP/UDP", + "IP/TCP", + "IP/SCTP", + "IPv6/UDP", + "IPv6/TCP", + "IPv6/SCTP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_ip_checksum, + offload.get_packet_with_bad_l4_checksum, + offload.get_packet_with_bad_outer_ip_checksum, + offload.get_packet_with_bad_outer_l4_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _ in range(offload.TX_REPEAT) +] + +CSUM_VLAN_NON_TUNNEL_PACKETS = [ + func(offload.CSUM_INNER_PACKET_PART[_type]) + for _type in [ + "VLAN/IP/UDP", + "VLAN/IP/TCP", + "VLAN/IP/SCTP", + "VLAN/IPv6/UDP", + "VLAN/IPv6/TCP", + "VLAN/IPv6/SCTP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_ip_checksum, + offload.get_packet_with_bad_l4_checksum, + offload.get_packet_with_bad_all_checksum, + ] +] + +CSUM_VLAN_TUNNEL_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] / offload.CSUM_INNER_PACKET_PART[_i_type] + if _o_type + else offload.CSUM_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "VLAN/IP/NVGRE", + "VLAN/IPv6/NVGRE", + ] + for _i_type in [ + "IP/UDP", + "IP/TCP", + "IP/SCTP", + "IPv6/UDP", + "IPv6/TCP", + "IPv6/SCTP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_ip_checksum, + offload.get_packet_with_bad_l4_checksum, + offload.get_packet_with_bad_outer_ip_checksum, + offload.get_packet_with_bad_outer_l4_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _ in range(offload.TX_REPEAT) +] + +CSUM_VLAN_TUNNEL_COMMONPKG_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] / offload.CSUM_INNER_PACKET_PART[_i_type] + if _o_type + else offload.CSUM_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "VLAN/IP/VXLAN-GPE", + "VLAN/IPv6/VXLAN-GPE", + "VLAN/IP/VXLAN-GPE/Ether", + "VLAN/IPv6/VXLAN-GPE/Ether", + "VLAN/IP/GRE", + "VLAN/IPv6/GRE", + "VLAN/IP/GRE/Ether", + "VLAN/IPv6/GRE/Ether", + "VLAN/IP/NVGRE", + "VLAN/IPv6/NVGRE", + "VLAN/IP/GTPU", + "VLAN/IPv6/GTPU", + ] + for _i_type in [ + "IP/UDP", + "IP/TCP", + "IP/SCTP", + "IPv6/UDP", + "IPv6/TCP", + "IPv6/SCTP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_ip_checksum, + offload.get_packet_with_bad_l4_checksum, + offload.get_packet_with_bad_outer_ip_checksum, + offload.get_packet_with_bad_outer_l4_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _ in range(offload.TX_REPEAT) +] + +CSUM_VXLAN_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] / offload.CSUM_INNER_PACKET_PART[_i_type] + if _o_type + else offload.CSUM_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "IP/VXLAN", + "IPv6/VXLAN", + ] + for _i_type in [ + "IP/UDP", + "IP/TCP", + "IP/SCTP", + "IPv6/UDP", + "IPv6/TCP", + "IPv6/SCTP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_ip_checksum, + offload.get_packet_with_bad_l4_checksum, + offload.get_packet_with_bad_outer_ip_checksum, + offload.get_packet_with_bad_outer_l4_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _ in range(offload.TX_REPEAT) +] + +CSUM_VLAN_VXLAN_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] / offload.CSUM_INNER_PACKET_PART[_i_type] + if _o_type + else offload.CSUM_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "VLAN/IP/VXLAN", + "VLAN/IPv6/VXLAN", + ] + for _i_type in [ + "IP/UDP", + "IP/TCP", + "IP/SCTP", + "IPv6/UDP", + "IPv6/TCP", + "IPv6/SCTP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_ip_checksum, + offload.get_packet_with_bad_l4_checksum, + offload.get_packet_with_bad_outer_ip_checksum, + offload.get_packet_with_bad_outer_l4_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _ in range(offload.TX_REPEAT) +] + +TSO_NON_TUNNEL_PACKETS = [ + func(offload.TSO_INNER_PACKET_PART[_type] / Raw(randstring(_payload_size))) + for _type in [ + "IP/TCP", + "IPv6/TCP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +TSO_TUNNEL_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "IP/NVGRE", + "IPv6/NVGRE", + ] + for _i_type in [ + "IP/TCP", + "IPv6/TCP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +TSO_TUNNEL_COMMONPKG_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "IP/VXLAN-GPE", + "IPv6/VXLAN-GPE", + "IP/VXLAN-GPE/Ether", + "IPv6/VXLAN-GPE/Ether", + "IP/GRE", + "IPv6/GRE", + "IP/GRE/Ether", + "IPv6/GRE/Ether", + "IP/NVGRE", + "IPv6/NVGRE", + "IP/GTPU", + "IPv6/GTPU", + ] + for _i_type in [ + "IP/TCP", + "IPv6/TCP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +TSO_VXLAN_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "IP/VXLAN", + "IPv6/VXLAN", + ] + for _i_type in [ + "IP/TCP", + "IPv6/TCP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +UFO_NON_TUNNEL_PACKETS = [ + func(offload.TSO_INNER_PACKET_PART[_type] / Raw(randstring(_payload_size))) + for _type in [ + "IP/UDP", + "IPv6/UDP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +UFO_TUNNEL_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "IP/NVGRE", + "IPv6/NVGRE", + ] + for _i_type in [ + "IP/UDP", + "IPv6/UDP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +UFO_TUNNEL_COMMONPKG_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "IP/VXLAN-GPE", + "IPv6/VXLAN-GPE", + "IP/VXLAN-GPE/Ether", + "IPv6/VXLAN-GPE/Ether", + "IP/GRE", + "IPv6/GRE", + "IP/GRE/Ether", + "IPv6/GRE/Ether", + "IP/NVGRE", + "IPv6/NVGRE", + "IP/GTPU", + "IPv6/GTPU", + ] + for _i_type in [ + "IP/UDP", + "IPv6/UDP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +UFO_VXLAN_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "IP/VXLAN", + "IPv6/VXLAN", + ] + for _i_type in [ + "IP/UDP", + "IPv6/UDP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +TSO_VLAN_NON_TUNNEL_PACKETS = [ + func(offload.TSO_INNER_PACKET_PART[_type] / Raw(randstring(_payload_size))) + for _type in [ + "VLAN/IP/TCP", + "VLAN/IPv6/TCP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +TSO_VLAN_TUNNEL_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "VLAN/IP/NVGRE", + "VLAN/IPv6/NVGRE", + ] + for _i_type in [ + "IP/TCP", + "IPv6/TCP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +TSO_VLAN_TUNNEL_COMMONPKG_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "VLAN/IP/VXLAN-GPE", + "VLAN/IPv6/VXLAN-GPE", + "VLAN/IP/VXLAN-GPE/Ether", + "VLAN/IPv6/VXLAN-GPE/Ether", + "VLAN/IP/GRE", + "VLAN/IPv6/GRE", + "VLAN/IP/GRE/Ether", + "VLAN/IPv6/GRE/Ether", + "VLAN/IP/NVGRE", + "VLAN/IPv6/NVGRE", + "VLAN/IP/GTPU", + "VLAN/IPv6/GTPU", + ] + for _i_type in [ + "IP/TCP", + "IPv6/TCP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +TSO_VLAN_VXLAN_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "VLAN/IP/VXLAN", + "VLAN/IPv6/VXLAN", + ] + for _i_type in [ + "IP/TCP", + "IPv6/TCP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +UFO_VLAN_NON_TUNNEL_PACKETS = [ + func(offload.TSO_INNER_PACKET_PART[_type] / Raw(randstring(_payload_size))) + for _type in [ + "VLAN/IP/UDP", + "VLAN/IPv6/UDP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +UFO_VLAN_TUNNEL_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "VLAN/IP/NVGRE", + "VLAN/IPv6/NVGRE", + ] + for _i_type in [ + "IP/UDP", + "IPv6/UDP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +UFO_VLAN_TUNNEL_COMMONPKG_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "VLAN/IP/VXLAN-GPE", + "VLAN/IPv6/VXLAN-GPE", + "VLAN/IP/VXLAN-GPE/Ether", + "VLAN/IPv6/VXLAN-GPE/Ether", + "VLAN/IP/GRE", + "VLAN/IPv6/GRE", + "VLAN/IP/GRE/Ether", + "VLAN/IPv6/GRE/Ether", + "VLAN/IP/NVGRE", + "VLAN/IPv6/NVGRE", + "VLAN/IP/GTPU", + "VLAN/IPv6/GTPU", + ] + for _i_type in [ + "IP/UDP", + "IPv6/UDP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] + +UFO_VLAN_VXLAN_PACKETS = [ + func( + offload.OUTER_PACKET_PART[_o_type] + / offload.TSO_INNER_PACKET_PART[_i_type] + / Raw(randstring(_payload_size)) + if _o_type + else offload.TSO_INNER_PACKET_PART[_i_type] + ) + for _o_type in [ + "VLAN/IP/VXLAN", + "VLAN/IPv6/VXLAN", + ] + for _i_type in [ + "IP/UDP", + "IPv6/UDP", + ] + for func in [ + offload.get_packet_with_bad_no_checksum, + offload.get_packet_with_bad_all_checksum, + ] + for _payload_size in offload.TSO_PAYLOAD_SIZE_LIST + for _ in range(offload.TX_REPEAT) +] class TestVfOffload(TestCase): @@ -38,6 +648,14 @@ class TestVfOffload(TestCase): def set_up_all(self): self.dut_ports = self.dut.get_ports(self.nic) self.verify(len(self.dut_ports) > 1, "Insufficient ports") + self.tester_ports = [ + self.tester.get_local_port(self.dut_ports[0]), + self.tester.get_local_port(self.dut_ports[1]), + ] + self.tester_intf = [ + self.tester.get_interface(self.tester_ports[0]), + self.tester.get_interface(self.tester_ports[1]), + ] self.vm0 = None # set vf assign method and vf driver @@ -52,6 +670,61 @@ class TestVfOffload(TestCase): self.dut.send_expect("modprobe vfio-pci", "#") self.dcf_mode = load_global_setting(DPDK_DCFMODE_SETTING) + # supported packets + self.packets_csum_non_tunnel = [] + self.packets_csum_tunnel = [] + self.packets_tso_non_tunnel = [] + self.packets_tso_tunnel = [] + self.support_rx_tunnel = False + if self.kdriver in {"ice"}: + self.packets_csum_non_tunnel.extend(CSUM_NON_TUNNEL_PACKETS) + self.packets_csum_non_tunnel.extend(CSUM_VLAN_NON_TUNNEL_PACKETS) + self.packets_tso_non_tunnel.extend(TSO_NON_TUNNEL_PACKETS) + self.packets_tso_non_tunnel.extend(UFO_NON_TUNNEL_PACKETS) + self.packets_tso_non_tunnel.extend(TSO_VLAN_NON_TUNNEL_PACKETS) + self.packets_tso_non_tunnel.extend(UFO_VLAN_NON_TUNNEL_PACKETS) + elif self.kdriver in {"i40e"}: + self.packets_csum_non_tunnel.extend(CSUM_NON_TUNNEL_PACKETS) + self.packets_csum_non_tunnel.extend(CSUM_VLAN_NON_TUNNEL_PACKETS) + self.packets_tso_non_tunnel.extend(TSO_NON_TUNNEL_PACKETS) + self.packets_tso_non_tunnel.extend(TSO_VLAN_NON_TUNNEL_PACKETS) + else: + self.packets_csum_non_tunnel.extend(CSUM_NON_TUNNEL_PACKETS) + self.packets_tso_non_tunnel.extend(TSO_NON_TUNNEL_PACKETS) + if ( + self.kdriver in {"ice"} + and self.pkg + and self.pkg.get("type") + and "comm" in self.pkg.get("type") + ): + self.packets_csum_tunnel.extend(CSUM_TUNNEL_COMMONPKG_PACKETS) + self.packets_csum_tunnel.extend(CSUM_VLAN_TUNNEL_COMMONPKG_PACKETS) + self.packets_tso_tunnel.extend(TSO_TUNNEL_COMMONPKG_PACKETS) + self.packets_tso_tunnel.extend(UFO_TUNNEL_COMMONPKG_PACKETS) + self.packets_tso_tunnel.extend(TSO_VLAN_TUNNEL_COMMONPKG_PACKETS) + self.packets_tso_tunnel.extend(UFO_VLAN_TUNNEL_COMMONPKG_PACKETS) + self.support_rx_tunnel = True + elif self.kdriver in {"ice"}: + self.packets_csum_tunnel.extend(CSUM_TUNNEL_PACKETS) + self.packets_csum_tunnel.extend(CSUM_VLAN_TUNNEL_PACKETS) + self.packets_tso_tunnel.extend(TSO_TUNNEL_PACKETS) + self.packets_tso_tunnel.extend(UFO_TUNNEL_PACKETS) + self.packets_tso_tunnel.extend(TSO_VLAN_TUNNEL_PACKETS) + self.packets_tso_tunnel.extend(UFO_VLAN_TUNNEL_PACKETS) + self.support_rx_tunnel = True + elif self.kdriver in {"i40e"}: + self.packets_csum_tunnel.extend(CSUM_TUNNEL_PACKETS) + self.packets_csum_tunnel.extend(CSUM_VLAN_TUNNEL_PACKETS) + self.packets_tso_tunnel.extend(TSO_TUNNEL_PACKETS) + self.packets_tso_tunnel.extend(TSO_VLAN_TUNNEL_PACKETS) + self.support_rx_tunnel = True + else: + self.packets_csum_tunnel.extend(CSUM_TUNNEL_PACKETS) + self.packets_tso_tunnel.extend(TSO_TUNNEL_PACKETS) + self.support_rx_tunnel = True + self.is_ice = self.kdriver == "ice" + self.is_i40e = self.kdriver == "i40e" + self.setup_2pf_2vf_1vm_env_flag = 0 self.setup_2pf_2vf_1vm_env(driver="") self.vm0_dut_ports = self.vm_dut_0.get_ports("any") @@ -60,10 +733,8 @@ class TestVfOffload(TestCase): self.tester.send_expect( "ifconfig %s mtu %s" % ( - self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[0]) - ), - TSO_MTU, + self.tester_intf[0], + offload.TSO_MTU, ), "# ", ) @@ -91,21 +762,20 @@ class TestVfOffload(TestCase): self.host_intf_0 = self.dut.ports_info[self.used_dut_port_0]["intf"] self.host_intf_1 = self.dut.ports_info[self.used_dut_port_1]["intf"] - if self.dcf_mode: - self.ip_link_set( - host_intf=self.host_intf_0, - cmd="vf", - port=0, - types="trust", - value="on", - ) - self.ip_link_set( - host_intf=self.host_intf_1, - cmd="vf", - port=0, - types="trust", - value="on", - ) + self.ip_link_set( + host_intf=self.host_intf_0, + cmd="vf", + port=0, + types="trust", + value="on", + ) + self.ip_link_set( + host_intf=self.host_intf_1, + cmd="vf", + port=0, + types="trust", + value="on", + ) self.ip_link_set( host_intf=self.host_intf_0, cmd="vf", @@ -184,1172 +854,1247 @@ class TestVfOffload(TestCase): self.setup_2pf_2vf_1vm_env_flag = 0 - def launch_testpmd(self, **kwargs): - dcf_flag = kwargs.get("dcf_flag") - eal_param = kwargs.get("eal_param") if kwargs.get("eal_param") else "" - param = kwargs.get("param") if kwargs.get("param") else "" - if dcf_flag == "enable": - self.vm0_testpmd.start_testpmd( - VM_CORES_MASK, - param=param, - eal_param=eal_param, - ports=[self.vf0_guest_pci, self.vf1_guest_pci], - port_options={ - self.vf0_guest_pci: "cap=dcf", - self.vf1_guest_pci: "cap=dcf", - }, - ) - else: - self.vm0_testpmd.start_testpmd( - VM_CORES_MASK, - param=param, - eal_param=eal_param, - ) - - def checksum_enablehw(self, port, dut): - dut.send_expect("port stop all", "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("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>") - dut.send_expect("csum set udp sw %d" % port, "testpmd>") - dut.send_expect("csum set tcp sw %d" % port, "testpmd>") - 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 filter_packets(self, packets): - return [ - p - for p in (packets if packets else []) - if len(p.layers()) >= 3 - and p.layers()[1] in {IP, IPv6, Dot1Q} - and p.layers()[2] in {IP, IPv6, Dot1Q, UDP, TCP, SCTP, GRE, MPLS} - and Raw in p - ] + def test_checksum_hw_ip(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), + ) + + def test_checksum_hw_udp(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set udp hw 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), + ) + + def test_checksum_hw_tcp(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set tcp hw 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), + ) - def checksum_validate(self, packets_sent, packets_expected): - """ - Validate the checksum. - """ - tx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[0]) + def test_checksum_hw_sctp(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set sctp hw 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - rx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[1]) + + def test_checksum_hw_all(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - 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" - expected_chksum_list = dict() - result = dict() - self.tester.send_expect("scapy", ">>> ") - self.tester.send_expect("from scapy.contrib.gtp import GTP_U_Header", ">>>") - for packet_type in list(packets_expected.keys()): - self.tester.send_expect("p = %s" % packets_expected[packet_type], ">>>") - out = self.tester.send_expect("p.show2()", ">>>") - chksum = checksum_pattern.findall(out) - expected_chksum_list[packet_type] = chksum - print(packet_type, ": ", chksum) - - 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}}], + + def test_checksum_tunnel_hw_outer_ip(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum parse-tunnel on 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel + self.packets_csum_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_outer_udp=True, + allow_tx_bad_outer_udp=True, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - # Send packet. - self.tester.scapy_foreground() - self.tester.scapy_append("from scapy.contrib.gtp import GTP_U_Header") - for packet_type in list(packets_sent.keys()): - self.tester.scapy_append( - 'sendp([%s], iface="%s")' % (packets_sent[packet_type], tx_interface) - ) - - self.tester.scapy_execute() - out = self.tester.scapy_get_result() - packets_received = self.filter_packets( - self.tester.load_tcpdump_sniff_packets(inst) + def test_checksum_tunnel_hw_outer_udp(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel + self.packets_csum_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - print(list(packets_received)) - self.verify( - len(packets_sent) == len(packets_received), "Unexpected Packets Drop" + def test_checksum_tunnel_hw_outer_sw_inner(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel + self.packets_csum_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - for i in range(len(packets_sent)): - packet_type = list(packets_sent.keys())[i] - checksum_received = checksum_pattern.findall( - packets_received[i].show2(dump=True) - ) - checksum_expected = expected_chksum_list[list(packets_sent.keys())[i]] - self.logger.debug(f"checksum_received: {checksum_received}") - self.logger.debug(f"checksum_expected: {checksum_expected}") - if not len(checksum_expected) == len(checksum_received): - result[packet_type] = ( - packet_type - + " Failed:" - + f"The chksum type {packet_type} length of the actual result is inconsistent with the expected length!" - ) - elif not (checksum_received == checksum_expected): - result[packet_type] = ( - packet_type - + " Failed:" - + f"The actually received chksum {packet_type} is inconsistent with the expectation" - ) - return result - - def exec_checksum_offload_enable(self, specific_bitwidth=None): - """ - Enable HW checksum offload. - Send packet with 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 " + "", - eal_param=( - "--force-max-simd-bitwidth=%d " % specific_bitwidth - + "--log-level='iavf,7' " - + "--log-level='dcf,7' " - ) - if (not specific_bitwidth is None) - else "", + + def test_checksum_tunnel_hw_all(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel + self.packets_csum_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - 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") - - time.sleep(2) - mac = self.vm0_testpmd.get_port_mac(0) - sndIP = "10.0.0.1" - sndIPv6 = "::1" - pkts = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s", chksum=0xf)/UDP(chksum=0xf)/("X"*46)' - % (mac, sndIP), - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s", chksum=0xf)/TCP(chksum=0xf)/("X"*46)' - % (mac, sndIP), - "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s", chksum=0xf)/SCTP(chksum=0x0)/("X"*48)' - % (mac, sndIP), - "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/UDP(chksum=0xf)/("X"*46)' - % (mac, sndIPv6), - "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/TCP(chksum=0xf)/("X"*46)' - % (mac, sndIPv6), - } - - expIP = sndIP - expIPv6 = sndIPv6 - pkts_ref = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s")/UDP()/("X"*46)' - % (mac, expIP), - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s")/TCP()/("X"*46)' - % (mac, expIP), - "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s")/SCTP()/("X"*48)' - % (mac, expIP), - "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/UDP()/("X"*46)' - % (mac, expIPv6), - "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/TCP()/("X"*46)' - % (mac, expIPv6), - } - - self.checksum_enablehw(0, self.vm_dut_0) - self.checksum_enablehw(1, self.vm_dut_0) - - self.vm0_testpmd.execute_cmd("start") - result = self.checksum_validate(pkts, pkts_ref) - - # Validate checksum on the receive packet - out = self.vm0_testpmd.execute_cmd("stop") - bad_ipcsum = self.vm0_testpmd.get_pmd_value("Bad-ipcsum:", out) - bad_l4csum = self.vm0_testpmd.get_pmd_value("Bad-l4csum:", out) - self.verify(bad_ipcsum == 3, "Bad-ipcsum check error") - self.verify(bad_l4csum == 5, "Bad-l4csum check error") - - self.verify(len(result) == 0, ",".join(list(result.values()))) - - def exec_checksum_offload_vlan_enable(self, specific_bitwidth=None): - """ - Enable HW checksum offload. - Send packet with 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 " + "", - eal_param=( - "--force-max-simd-bitwidth=%d " % specific_bitwidth - + "--log-level='iavf,7' " - + "--log-level='dcf,7' " - ) - if (not specific_bitwidth is None) - else "", + + def test_checksum_tunnel_hw_all_avx512(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=512, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel + self.packets_csum_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - 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") - - # ixgbe kernel drvier has vlan filter enabled by default. - # so set vlan filter and vlan id on dpdk. - if self.kdriver == "ixgbe": - self.vm0_testpmd.execute_cmd("vlan set filter on 0") - self.vm0_testpmd.execute_cmd("rx_vlan add 100 0") - - time.sleep(2) - mac = self.vm0_testpmd.get_port_mac(0) - sndIP = "10.0.0.1" - sndIPv6 = "::1" - pkts = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s", chksum=0xf)/UDP(chksum=0xf)/("X"*46)' - % (mac, sndIP), - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s", chksum=0xf)/TCP(chksum=0xf)/("X"*46)' - % (mac, sndIP), - "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s", chksum=0xf)/SCTP(chksum=0x0)/("X"*48)' - % (mac, sndIP), - "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IPv6(src="%s")/UDP(chksum=0xf)/("X"*46)' - % (mac, sndIPv6), - "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IPv6(src="%s")/TCP(chksum=0xf)/("X"*46)' - % (mac, sndIPv6), - } - - expIP = sndIP - expIPv6 = sndIPv6 - pkts_ref = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s")/UDP()/("X"*46)' - % (mac, expIP), - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s")/TCP()/("X"*46)' - % (mac, expIP), - "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IP(src="%s")/SCTP()/("X"*48)' - % (mac, expIP), - "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IPv6(src="%s")/UDP()/("X"*46)' - % (mac, expIPv6), - "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=100)/IPv6(src="%s")/TCP()/("X"*46)' - % (mac, expIPv6), - } - - self.checksum_enablehw(0, self.vm_dut_0) - self.checksum_enablehw(1, self.vm_dut_0) - - self.vm0_testpmd.execute_cmd("start") - result = self.checksum_validate(pkts, pkts_ref) - - # Validate checksum on the receive packet - out = self.vm0_testpmd.execute_cmd("stop") - bad_ipcsum = self.vm0_testpmd.get_pmd_value("Bad-ipcsum:", out) - bad_l4csum = self.vm0_testpmd.get_pmd_value("Bad-l4csum:", out) - self.verify(bad_ipcsum == 3, "Bad-ipcsum check error") - self.verify(bad_l4csum == 5, "Bad-l4csum check error") - - self.verify(len(result) == 0, ",".join(list(result.values()))) @check_supported_nic( - ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"] + [ + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", + ] ) @skip_unsupported_pkg(["os default"]) - def exec_checksum_offload_tunnel_enable(self, specific_bitwidth=None): - """ - 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 " + "", - eal_param=( - "--force-max-simd-bitwidth=%d " % specific_bitwidth - + "--log-level='iavf,7' " - + "--log-level='dcf,7' " - ) - if (not specific_bitwidth is None) - else "", + def test_checksum_tunnel_hw_all_dcf_vxlan(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=True, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7, "dcf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "rx_vxlan_port add 4789 0", + "port start all", + ], + packets=(CSUM_VXLAN_PACKETS + CSUM_VLAN_VXLAN_PACKETS), + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - 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}", chksum = 0xff) / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN()', - "IP/UDP/VXLAN-GPE/ETH": f'IP(src = "{sndIP}", chksum = 0xff) / 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.update( - { - "IP/UDP/VXLAN/ETH": f'IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4789, dport = 4789, chksum = 0xff) / VXLAN() / Ether()', - "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.update( - { - "IP/UDP/VXLAN/ETH": f'IP(src = "{sndIP}") / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()', - "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) - result = self.checksum_validate(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) - if self.dcf_mode == "enable": - # Outer IP checksum error = 7 (outer-ip) * 6 (inner packet) - self.verify(bad_outer_ipcsum == 42, "Bad-outer-ipcsum check error") - # Outer IP checksum error = 8 (outer-UDP) * 6 (inner packet) - self.verify(bad_outer_l4csum == 48, "Bad-outer-l4csum check error") - # Outer L4 checksum error = 14 (outer packets) * 3 (inner-IP) - self.verify(bad_inner_ipcsum == 42, "Bad-ipcsum check error") - # Outer L4 checksum error = 14 (outer packets) * 6 (inner-L4) - self.verify(bad_inner_l4csum == 84, "Bad-l4csum check error") - else: - # Outer IP checksum error = 6 (outer-ip) * 6 (inner packet) - self.verify(bad_outer_ipcsum == 36, "Bad-outer-ipcsum check error") - # Outer IP checksum error = 6 (outer-UDP) * 6 (inner packet) - self.verify(bad_outer_l4csum == 36, "Bad-outer-l4csum check error") - # Outer L4 checksum error = 12 (outer packets) * 3 (inner-IP) - self.verify(bad_inner_ipcsum == 36, "Bad-ipcsum check error") - # Outer L4 checksum error = 12 (outer packets) * 6 (inner-L4) - self.verify(bad_inner_l4csum == 72, "Bad-l4csum check error") - - self.verify(len(result) == 0, ",".join(list(result.values()))) @check_supported_nic( - ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"] + [ + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", + ] ) @skip_unsupported_pkg(["os default"]) - def exec_checksum_offload_vlan_tunnel_enable(self, specific_bitwidth=None): - """ - 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 " + "", - eal_param=( - "--force-max-simd-bitwidth=%d " % specific_bitwidth - + "--log-level='iavf,7' " - + "--log-level='dcf,7' " - ) - if (not specific_bitwidth is None) - else "", - ) - 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 = { - "VLAN/IP/UDP/VXLAN-GPE": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN()', - "VLAN/IP/UDP/VXLAN-GPE/ETH": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN() / Ether()', - "VLAN/IPv6/UDP/VXLAN-GPE": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN()', - "VLAN/IPv6/UDP/VXLAN-GPE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}") / UDP(sport = 4790, dport = 4790, chksum = 0xff) / VXLAN() / Ether()', - "VLAN/IP/GRE": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", proto = 47, chksum = 0xff) / GRE()', - "VLAN/IP/GRE/ETH": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", proto = 47, chksum = 0xff) / GRE() / Ether()', - "VLAN/IP/NVGRE/ETH": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", proto = 47, chksum = 0xff) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()', - "VLAN/IPv6/GRE": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}", nh = 47) / GRE()', - "VLAN/IPv6/GRE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}", nh = 47) / GRE() / Ether()', - "VLAN/IPv6/NVGRE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{sndIPv6}", nh = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()', - "VLAN/IP/UDP/GTPU": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", chksum = 0xff) / UDP(dport = 2152, chksum = 0xff) / GTP_U_Header(gtp_type=255, teid=0x123456)', - "VLAN/IPv6/UDP/GTPU": f'Dot1Q(vlan=100) / 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.update( - { - "VLAN/IP/UDP/VXLAN/ETH": f'Dot1Q(vlan=100) / IP(src = "{sndIP}", chksum = 0xff) / UDP(sport = 4789, dport = 4789, chksum = 0xff) / VXLAN() / Ether()', - "VLAN/IPv6/UDP/VXLAN/ETH": f'Dot1Q(vlan=100) / 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 = { - "VLAN/IP/UDP/VXLAN-GPE": f'Dot1Q(vlan=100) / IP(src = "{expIP}") / UDP(sport = 4790, dport = 4790) / VXLAN()', - "VLAN/IP/UDP/VXLAN-GPE/ETH": f'Dot1Q(vlan=100) / IP(src = "{expIP}") / UDP(sport = 4790, dport = 4790) / VXLAN() / Ether()', - "VLAN/IPv6/UDP/VXLAN-GPE": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}") / UDP(sport = 4790, dport = 4790) / VXLAN()', - "VLAN/IPv6/UDP/VXLAN-GPE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}") / UDP(sport = 4790, dport = 4790) / VXLAN() / Ether()', - "VLAN/IP/GRE": f'Dot1Q(vlan=100) / IP(src = "{expIP}", proto = 47) / GRE()', - "VLAN/IP/GRE/ETH": f'Dot1Q(vlan=100) / IP(src = "{expIP}", proto = 47) / GRE() / Ether()', - "VLAN/IP/NVGRE/ETH": f'Dot1Q(vlan=100) / IP(src = "{expIP}", proto = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()', - "VLAN/IPv6/GRE": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}", nh = 47) / GRE()', - "VLAN/IPv6/GRE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}", nh = 47) / GRE() / Ether()', - "VLAN/IPv6/NVGRE/ETH": f'Dot1Q(vlan=100) / IPv6(src = "{expIPv6}", nh = 47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether()', - "VLAN/IP/UDP/GTPU": f'Dot1Q(vlan=100) / IP(src = "{expIP}") / UDP(dport = 2152) / GTP_U_Header(gtp_type=255, teid=0x123456)', - "VLAN/IPv6/UDP/GTPU": f'Dot1Q(vlan=100) / 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.update( - { - "VLAN/IP/UDP/VXLAN/ETH": f'Dot1Q(vlan=100) / IP(src = "{sndIP}") / UDP(sport = 4789, dport = 4789) / VXLAN() / Ether()', - "VLAN/IPv6/UDP/VXLAN/ETH": f'Dot1Q(vlan=100) / 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) - result = self.checksum_validate(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) - if self.dcf_mode == "enable": - # Outer IP checksum error = 7 (outer-ip) * 6 (inner packet) - self.verify(bad_outer_ipcsum == 42, "Bad-outer-ipcsum check error") - # Outer IP checksum error = 8 (outer-UDP) * 6 (inner packet) - self.verify(bad_outer_l4csum == 48, "Bad-outer-l4csum check error") - # Outer L4 checksum error = 14 (outer packets) * 3 (inner-IP) - self.verify(bad_inner_ipcsum == 42, "Bad-ipcsum check error") - # Outer L4 checksum error = 14 (outer packets) * 6 (inner-L4) - self.verify(bad_inner_l4csum == 84, "Bad-l4csum check error") - else: - # Outer IP checksum error = 6 (outer-ip) * 6 (inner packet) - self.verify(bad_outer_ipcsum == 36, "Bad-outer-ipcsum check error") - # Outer IP checksum error = 6 (outer-UDP) * 6 (inner packet) - self.verify(bad_outer_l4csum == 36, "Bad-outer-l4csum check error") - # Outer L4 checksum error = 12 (outer packets) * 3 (inner-IP) - self.verify(bad_inner_ipcsum == 36, "Bad-ipcsum check error") - # Outer L4 checksum error = 12 (outer packets) * 6 (inner-L4) - self.verify(bad_inner_l4csum == 72, "Bad-l4csum check error") - - self.verify(len(result) == 0, ",".join(list(result.values()))) - - def exec_checksum_offload_disable(self, specific_bitwidth=None): - """ - Enable SW checksum offload. - Send same packet with incorrect checksum and verify checksum is valid. - """ - - self.launch_testpmd( - dcf_flag=self.dcf_mode, - param="--portmask=%s " % (self.portMask) + "--enable-rx-cksum " + "", - eal_param=( - "--force-max-simd-bitwidth=%d " % specific_bitwidth - + "--log-level='iavf,7' " - + "--log-level='dcf,7' " - ) - if (not specific_bitwidth is None) - else "", + def test_checksum_tunnel_hw_all_dcf_vxlan_avx512(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=True, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=512, + testpmd_log_level={"ice": 7, "iavf": 7, "dcf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "rx_vxlan_port add 4789 0", + "port start all", + ], + packets=(CSUM_VXLAN_PACKETS + CSUM_VLAN_VXLAN_PACKETS), + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - 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") - - time.sleep(2) - - mac = self.vm0_testpmd.get_port_mac(0) - sndIP = "10.0.0.1" - sndIPv6 = "::1" - sndPkts = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0xf)/UDP(chksum=0xf)/("X"*46)' - % (mac, sndIP), - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0xf)/TCP(chksum=0xf)/("X"*46)' - % (mac, sndIP), - "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/UDP(chksum=0xf)/("X"*46)' - % (mac, sndIPv6), - "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="%s")/TCP(chksum=0xf)/("X"*46)' - % (mac, sndIPv6), - } - - expIP = sndIP - expIPv6 = sndIPv6 - expPkts = { - "IP/UDP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/UDP()/("X"*46)' - % (mac, expIP), - "IP/TCP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="%s")/TCP()/("X"*46)' - % (mac, expIP), - "IPv6/UDP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/UDP()/("X"*46)' - % (mac, expIPv6), - "IPv6/TCP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="%s")/TCP()/("X"*46)' - % (mac, expIPv6), - } - - self.checksum_enablesw(0, self.vm_dut_0) - self.checksum_enablesw(1, self.vm_dut_0) - self.vm0_testpmd.execute_cmd("start") - result = self.checksum_validate(sndPkts, expPkts) - - # Validate checksum on the receive packet - out = self.vm0_testpmd.execute_cmd("stop") - bad_ipcsum = self.vm0_testpmd.get_pmd_value("Bad-ipcsum:", out) - bad_l4csum = self.vm0_testpmd.get_pmd_value("Bad-l4csum:", out) - self.verify(bad_ipcsum == 2, "Bad-ipcsum check error") - self.verify(bad_l4csum == 4, "Bad-l4csum check error") - - self.verify(len(result) == 0, ",".join(list(result.values()))) - - def test_checksum_offload_enable(self): - self.exec_checksum_offload_enable() - - def test_checksum_offload_enable_scalar(self): - self.exec_checksum_offload_enable(specific_bitwidth=64) - - def test_checksum_offload_enable_sse(self): - self.exec_checksum_offload_enable(specific_bitwidth=128) - - def test_checksum_offload_enable_avx2(self): - self.exec_checksum_offload_enable(specific_bitwidth=256) - - def test_checksum_offload_enable_avx512(self): - self.exec_checksum_offload_enable(specific_bitwidth=512) - - def test_checksum_offload_vlan_enable(self): - self.exec_checksum_offload_vlan_enable() - - def test_checksum_offload_vlan_enable_scalar(self): - self.exec_checksum_offload_vlan_enable(specific_bitwidth=64) - - def test_checksum_offload_vlan_enable_sse(self): - self.exec_checksum_offload_vlan_enable(specific_bitwidth=128) - - def test_checksum_offload_vlan_enable_avx2(self): - self.exec_checksum_offload_vlan_enable(specific_bitwidth=256) - - def test_checksum_offload_vlan_enable_avx512(self): - self.exec_checksum_offload_vlan_enable(specific_bitwidth=512) - - def test_checksum_offload_tunnel_enable(self): - self.exec_checksum_offload_tunnel_enable() - - def test_checksum_offload_tunnel_enable_scalar(self): - self.exec_checksum_offload_tunnel_enable(specific_bitwidth=64) - - def test_checksum_offload_tunnel_enable_sse(self): - self.exec_checksum_offload_tunnel_enable(specific_bitwidth=128) - - def test_checksum_offload_tunnel_enable_avx2(self): - self.exec_checksum_offload_tunnel_enable(specific_bitwidth=256) - - def test_checksum_offload_tunnel_enable_avx512(self): - self.exec_checksum_offload_tunnel_enable(specific_bitwidth=512) - - def test_checksum_offload_vlan_tunnel_enable(self): - self.exec_checksum_offload_vlan_tunnel_enable() - - def test_checksum_offload_vlan_tunnel_enable_scalar(self): - self.exec_checksum_offload_vlan_tunnel_enable(specific_bitwidth=64) - - def test_checksum_offload_vlan_tunnel_enable_sse(self): - self.exec_checksum_offload_vlan_tunnel_enable(specific_bitwidth=128) - - def test_checksum_offload_vlan_tunnel_enable_avx2(self): - self.exec_checksum_offload_vlan_tunnel_enable(specific_bitwidth=256) - - def test_checksum_offload_vlan_tunnel_enable_avx512(self): - self.exec_checksum_offload_vlan_tunnel_enable(specific_bitwidth=512) - - def test_checksum_offload_disable(self): - self.exec_checksum_offload_disable() - - def test_checksum_offload_disable_scalar(self): - self.exec_checksum_offload_disable(specific_bitwidth=64) - - def test_checksum_offload_disable_sse(self): - self.exec_checksum_offload_disable(specific_bitwidth=128) - - def test_checksum_offload_disable_avx2(self): - self.exec_checksum_offload_disable(specific_bitwidth=256) - - def test_checksum_offload_disable_avx512(self): - self.exec_checksum_offload_disable(specific_bitwidth=512) - - def tcpdump_start_sniffing(self, ifaces=[]): - """ - Start tcpdump in the background to sniff the tester interface where - the packets are transmitted to and from the self.dut. - All the captured packets are going to be stored in a file for a - post-analysis. - """ - - for iface in ifaces: - 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(command, "#") - - def tcpdump_stop_sniff(self): - """ - Stop the tcpdump process running in the background. - """ - self.tester.send_expect("killall tcpdump", "#") - time.sleep(1) - 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 = self.filter_packets( - packet.read_pcapfile("tcpdump_{0}.pcap".format(iface), self.tester) + def test_checksum_sw_all(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port start all", + ], + packets=self.packets_csum_non_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - rx_packet_count = len(pkts) - rx_packet_size = [len(p[Raw].load) for p in pkts] - return rx_packet_count, rx_packet_size - - def segment_validate( - self, - segment_size, - loading_size, - packet_count, - tx_stats, - rx_stats, - payload_size_list, - ): - """ - Validate the segmentation, checking if the result is segmented - as expected. - segment_size: segment size, - loading_size: tx payload size, - packet_count: tx packet count, - tx_stats: tx packets count sniffed, - rx_stats: rx packets count, - payload_size_list: rx packets payload size list, - Return a message of validate result. - """ - num_segs = (loading_size + segment_size - 1) // segment_size - num_segs_full = loading_size // segment_size - if not packet_count == tx_stats: - return "Failed: TX packet count is of inconsitent with sniffed TX packet count." - elif not packet_count * num_segs == rx_stats: - return "Failed: RX packet count is of inconsitent with expected RX packet count." - elif not ( - all( - [ - # i * packet_count + j is the i-th segmentation for j-th packet. - payload_size_list[i * packet_count + j] == segment_size - for j in range(packet_count) - for i in range(num_segs_full) - ] - + [ - # i * packet_count + j is i-th segmentation for j-th packet. - # i range from num_segs_full to num_segs, means the last - # segmentation if exists. - payload_size_list[i * packet_count + j] - == (loading_size % segment_size) - for j in range(packet_count) - for i in range(num_segs_full, num_segs) - ] - ) - ): - return ( - "Failed: RX packet segmentation size incorrect, %s." % payload_size_list - ) - return None - - def tso_validate( - self, - tx_interface, - rx_interface, - mac, - inet_type, - size_and_count, - outer_pkts=None, - ): - - validate_result = [] - - self.tester.scapy_foreground() - time.sleep(5) - - packet_l3 = { - "IP": 'IP(src="192.168.1.1",dst="192.168.1.2")', - "IPv6": 'IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")', - } - - if not outer_pkts is None: - for key_outer in outer_pkts: - for loading_size, packet_count in size_and_count: - 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")/' - + outer_pkts[key_outer] - + '/%s/TCP(sport=1021,dport=1021)/Raw(RandString(size=%s))], iface="%s", count=%s)' - ) - % ( - mac, - packet_l3[inet_type], - loading_size, - tx_interface, - packet_count, - ) - ) - out = self.tester.scapy_execute() - out = self.vm0_testpmd.execute_cmd("show port stats all") - print(out) - # In case tcpdump working slower than expected on very limited environments, - # an immediate stop sniffing causes a trimed pcap file, leading to wrong - # packet statistic. - # Uncommenting the following line helps resolving this problem. - # time.sleep(1) - self.tcpdump_stop_sniff() - rx_stats, payload_size_list = self.tcpdump_analyse_sniff( - rx_interface - ) - tx_stats, _ = self.tcpdump_analyse_sniff(tx_interface) - payload_size_list.sort(reverse=True) - self.logger.info(payload_size_list) - segment_result = self.segment_validate( - 800, - loading_size, - packet_count, - tx_stats, - rx_stats, - payload_size_list, - ) - if segment_result: - result_message = ( - f"Packet: {key_outer}, inet type: {inet_type}, loading size: {loading_size} packet count: {packet_count}: " - + segment_result - ) - self.logger.info(result_message) - validate_result.append(result_message) - else: - for loading_size, packet_count in size_and_count: - 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")/%s/TCP(sport=1021,dport=1021)/Raw(RandString(size=%s))], iface="%s", count=%s)' - % ( - mac, - packet_l3[inet_type], - loading_size, - tx_interface, - packet_count, - ) - ) - out = self.tester.scapy_execute() - out = self.vm0_testpmd.execute_cmd("show port stats all") - print(out) - self.tcpdump_stop_sniff() - rx_stats, payload_size_list = self.tcpdump_analyse_sniff(rx_interface) - tx_stats, _ = self.tcpdump_analyse_sniff(tx_interface) - payload_size_list.sort(reverse=True) - self.logger.info(payload_size_list) - segment_result = self.segment_validate( - 800, - loading_size, - packet_count, - tx_stats, - rx_stats, - payload_size_list, - ) - if segment_result: - result_message = ( - f"Inet type: {inet_type}, loading size: {loading_size} packet count: {packet_count}: " - + segment_result - ) - self.logger.info(result_message) - validate_result.append(result_message) - return validate_result - - def exec_tso(self, specific_bitwidth=None): - """ - TSO IPv4 TCP, IPv6 TCP testing. - """ - tx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[0]) + + def test_checksum_tunnel_sw_all(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "csum parse-tunnel on 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel + self.packets_csum_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - rx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[1]) + + def test_checksum_tunnel_sw_all_avx512(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=512, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "csum parse-tunnel on 1", + "port start all", + ], + packets=self.packets_csum_non_tunnel + self.packets_csum_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - # Here size_and_count is a list of tuples for the test scopes that - # in a tuple (size, count) means, sending packets for count times - # for TSO with a payload size of size. - size_and_count = [ - (128, 10), - (800, 10), - (801, 10), - (1700, 10), - (2500, 10), - (8500, 1000), + @skip_unsupported_nic( + [ + "I40E_10G-SFP_X710", + "I40E_40G-QSFP_A", + "I40E_40G-QSFP_B", + "I40E_25G-25G_SFP28", + "I40E_10G-SFP_X722", + "I40E_10G-10G_BASE_T_X722", + "I40E_10G-10G_BASE_T_BC", + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", ] - - 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), "# " + ) + def test_checksum_vlan_hw_all(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=CSUM_VLAN_NON_TUNNEL_PACKETS, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - self.dut.send_expect( - "ifconfig %s mtu %s" % (self.dut.ports_info[1]["intf"], TSO_MTU), "# " + + @skip_unsupported_nic( + [ + "I40E_10G-SFP_X710", + "I40E_40G-QSFP_A", + "I40E_40G-QSFP_B", + "I40E_25G-25G_SFP28", + "I40E_10G-SFP_X722", + "I40E_10G-10G_BASE_T_X722", + "I40E_10G-10G_BASE_T_BC", + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", + ] + ) + def test_checksum_vlan_sw_all(self): + offload.execute_test_checksum( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum ", + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=CSUM_VLAN_NON_TUNNEL_PACKETS, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + allow_rx_bad_outer_ip=(not self.is_ice), + allow_rx_bad_outer_l4=(not self.is_ice), + allow_rx_bad_inner_ip=(not self.is_ice), + allow_rx_bad_inner_l4=(not self.is_ice), ) - 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, - eal_param=( - "--force-max-simd-bitwidth=%d " % specific_bitwidth - + "--log-level='iavf,7' " - + "--log-level='dcf,7' " - ) - if (not specific_bitwidth is None) - else "", + def test_tso_non_tunnel(self): + offload.execute_test_tso( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum --max-pkt-len=%d " % offload.TSO_MTU, + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "port start all", + ], + packets=self.packets_tso_non_tunnel + self.packets_tso_tunnel, + packet_interval=offload.TX_INTERVAL, + packet_mtu=offload.TSO_MTU, + segment_length=offload.TSO_SEGMENT_LENGTH, + support_rx_tunnel=self.support_rx_tunnel, + support_seg_non_tunnel=True, + support_seg_tunnel=False, + support_tso=True, + support_ufo=True, ) - 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") - self.tso_enable(self.vm0_dut_ports[0], self.vm_dut_0) - self.tso_enable(self.vm0_dut_ports[1], self.vm_dut_0) - 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("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]) - - validate_result = [] - validate_result += self.tso_validate( - tx_interface=tx_interface, - rx_interface=rx_interface, - mac=mac, - inet_type="IP", - size_and_count=size_and_count, + def test_tso_tunnel(self): + offload.execute_test_tso( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum --max-pkt-len=%d " % offload.TSO_MTU, + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "tunnel_tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "port start all", + ], + packets=self.packets_tso_non_tunnel + self.packets_tso_tunnel, + packet_interval=offload.TX_INTERVAL, + packet_mtu=offload.TSO_MTU, + segment_length=offload.TSO_SEGMENT_LENGTH, + support_rx_tunnel=self.support_rx_tunnel, + support_seg_non_tunnel=False, + support_seg_tunnel=True, + support_tso=True, + support_ufo=True, ) - validate_result += self.tso_validate( - tx_interface=tx_interface, - rx_interface=rx_interface, - mac=mac, - inet_type="IPv6", - size_and_count=size_and_count, + + def test_tso_combine(self): + offload.execute_test_tso( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum --max-pkt-len=%d " % offload.TSO_MTU, + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "tunnel_tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "port start all", + ], + packets=self.packets_tso_non_tunnel + self.packets_tso_tunnel, + packet_interval=offload.TX_INTERVAL, + packet_mtu=offload.TSO_MTU, + segment_length=offload.TSO_SEGMENT_LENGTH, + support_rx_tunnel=self.support_rx_tunnel, + support_seg_non_tunnel=True, + support_seg_tunnel=True, + support_tso=True, + support_ufo=True, ) - self.verify(len(validate_result) == 0, ",".join(list(validate_result))) @check_supported_nic( - ["ICE_100G-E810C_QSFP", "ICE_25G-E810C_SFP", "ICE_25G-E810_XXV_SFP"] + [ + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", + ] ) - @skip_unsupported_pkg(["os default"]) - def exec_tso_tunnel(self, specific_bitwidth=None): - """ - 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]) + def test_tso_non_tunnel_dcf_vxlan(self): + offload.execute_test_tso( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=True, + testpmd_enable_dcf_1=True, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum --max-pkt-len=%d " % offload.TSO_MTU, + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "rx_vxlan_port add 4789 0", + "port start all", + ], + packets=TSO_VXLAN_PACKETS + + TSO_VLAN_VXLAN_PACKETS + + UFO_VXLAN_PACKETS + + UFO_VLAN_VXLAN_PACKETS, + packet_interval=offload.TX_INTERVAL, + packet_mtu=offload.TSO_MTU, + segment_length=offload.TSO_SEGMENT_LENGTH, + support_rx_tunnel=self.support_rx_tunnel, + support_seg_non_tunnel=True, + support_seg_tunnel=False, + support_tso=True, + support_ufo=True, ) - # Here size_and_count is a list of tuples for the test scopes that - # in a tuple (size, count) means, sending packets for count times - # for TSO with a payload size of size. - size_and_count = [ - (128, 10), - (800, 10), - (801, 10), - (1700, 10), - (2500, 10), - (8500, 1000), + @check_supported_nic( + [ + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", ] - - 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), "# " + ) + def test_tso_tunnel_dcf_vxlan(self): + offload.execute_test_tso( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=True, + testpmd_enable_dcf_1=True, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum --max-pkt-len=%d " % offload.TSO_MTU, + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "tunnel_tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "rx_vxlan_port add 4789 0", + "port start all", + ], + packets=TSO_VXLAN_PACKETS + + TSO_VLAN_VXLAN_PACKETS + + UFO_VXLAN_PACKETS + + UFO_VLAN_VXLAN_PACKETS, + packet_interval=offload.TX_INTERVAL, + packet_mtu=offload.TSO_MTU, + segment_length=offload.TSO_SEGMENT_LENGTH, + support_rx_tunnel=self.support_rx_tunnel, + support_seg_non_tunnel=False, + support_seg_tunnel=True, + support_tso=True, + support_ufo=True, ) - 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, - eal_param=( - "--force-max-simd-bitwidth=%d " % specific_bitwidth - + "--log-level='iavf,7' " - + "--log-level='dcf,7' " - ) - if (not specific_bitwidth is None) - else "", + @check_supported_nic( + [ + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", + ] + ) + def test_tso_combine_dcf_vxlan(self): + offload.execute_test_tso( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=True, + testpmd_enable_dcf_1=True, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum --max-pkt-len=%d " % offload.TSO_MTU, + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "tunnel_tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "rx_vxlan_port add 4789 0", + "port start all", + ], + packets=TSO_VXLAN_PACKETS + + TSO_VLAN_VXLAN_PACKETS + + UFO_VXLAN_PACKETS + + UFO_VLAN_VXLAN_PACKETS, + packet_interval=offload.TX_INTERVAL, + packet_mtu=offload.TSO_MTU, + segment_length=offload.TSO_SEGMENT_LENGTH, + support_rx_tunnel=self.support_rx_tunnel, + support_seg_non_tunnel=True, + support_seg_tunnel=True, + support_tso=True, + support_ufo=True, ) - mac = self.vm0_testpmd.get_port_mac(0) - self.vm0_testpmd.execute_cmd("set verbose 0", "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)', - } - - validate_result = [] - validate_result += self.tso_validate( - tx_interface=tx_interface, - rx_interface=rx_interface, - mac=mac, - inet_type="IP", - size_and_count=size_and_count, - outer_pkts=pkts_outer, - ) - validate_result += self.tso_validate( - tx_interface=tx_interface, - rx_interface=rx_interface, - mac=mac, - inet_type="IPv6", - size_and_count=size_and_count, - outer_pkts=pkts_outer, + @skip_unsupported_nic( + [ + "I40E_10G-SFP_X710", + "I40E_40G-QSFP_A", + "I40E_40G-QSFP_B", + "I40E_25G-25G_SFP28", + "I40E_10G-SFP_X722", + "I40E_10G-10G_BASE_T_X722", + "I40E_10G-10G_BASE_T_BC", + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", + ] + ) + def test_tso_vlan_non_tunnel(self): + offload.execute_test_tso( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum --max-pkt-len=%d " % offload.TSO_MTU, + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=TSO_VLAN_NON_TUNNEL_PACKETS + + TSO_VLAN_TUNNEL_PACKETS + + UFO_VLAN_NON_TUNNEL_PACKETS + + UFO_VLAN_TUNNEL_PACKETS, + packet_interval=offload.TX_INTERVAL, + packet_mtu=offload.TSO_MTU, + segment_length=offload.TSO_SEGMENT_LENGTH, + support_rx_tunnel=self.support_rx_tunnel, + support_seg_non_tunnel=True, + support_seg_tunnel=False, + support_tso=True, + support_ufo=True, ) - self.verify(len(validate_result) == 0, ",".join(list(validate_result))) - - def test_tso(self): - self.exec_tso() - - def test_tso_scalar(self): - self.exec_tso(specific_bitwidth=64) - - def test_tso_sse(self): - self.exec_tso(specific_bitwidth=128) - - def test_tso_avx2(self): - self.exec_tso(specific_bitwidth=256) - def test_tso_avx512(self): - self.exec_tso(specific_bitwidth=512) - - def test_tso_tunnel(self): - self.exec_tso_tunnel() - - def test_tso_tunnel_scalar(self): - self.exec_tso_tunnel(specific_bitwidth=64) - - def test_tso_tunnel_sse(self): - self.exec_tso_tunnel(specific_bitwidth=128) + @skip_unsupported_nic( + [ + "I40E_10G-SFP_X710", + "I40E_40G-QSFP_A", + "I40E_40G-QSFP_B", + "I40E_25G-25G_SFP28", + "I40E_10G-SFP_X722", + "I40E_10G-10G_BASE_T_X722", + "I40E_10G-10G_BASE_T_BC", + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", + ] + ) + def test_tso_vlan_tunnel(self): + offload.execute_test_tso( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum --max-pkt-len=%d " % offload.TSO_MTU, + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "tunnel_tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=TSO_VLAN_NON_TUNNEL_PACKETS + + TSO_VLAN_TUNNEL_PACKETS + + UFO_VLAN_NON_TUNNEL_PACKETS + + UFO_VLAN_TUNNEL_PACKETS, + packet_interval=offload.TX_INTERVAL, + packet_mtu=offload.TSO_MTU, + segment_length=offload.TSO_SEGMENT_LENGTH, + support_rx_tunnel=self.support_rx_tunnel, + support_seg_non_tunnel=False, + support_seg_tunnel=True, + support_tso=True, + support_ufo=True, + ) - def test_tso_tunnel_avx2(self): - self.exec_tso_tunnel(specific_bitwidth=256) + @skip_unsupported_nic( + [ + "I40E_10G-SFP_X710", + "I40E_40G-QSFP_A", + "I40E_40G-QSFP_B", + "I40E_25G-25G_SFP28", + "I40E_10G-SFP_X722", + "I40E_10G-10G_BASE_T_X722", + "I40E_10G-10G_BASE_T_BC", + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", + ] + ) + def test_tso_vlan_combine(self): + offload.execute_test_tso( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum --max-pkt-len=%d " % offload.TSO_MTU, + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "tunnel_tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=TSO_VLAN_NON_TUNNEL_PACKETS + + TSO_VLAN_TUNNEL_PACKETS + + UFO_VLAN_NON_TUNNEL_PACKETS + + UFO_VLAN_TUNNEL_PACKETS, + packet_interval=offload.TX_INTERVAL, + packet_mtu=offload.TSO_MTU, + segment_length=offload.TSO_SEGMENT_LENGTH, + support_rx_tunnel=self.support_rx_tunnel, + support_seg_non_tunnel=True, + support_seg_tunnel=True, + support_tso=True, + support_ufo=True, + ) - def test_tso_tunnel_avx512(self): - self.exec_tso_tunnel(specific_bitwidth=512) + @check_supported_nic( + [ + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", + ] + ) + def test_tso_combine_avx512(self): + offload.execute_test_tso( + case=self, + testpmd=self.vm0_testpmd, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.vf0_guest_pci, + testpmd_port_1=self.vf1_guest_pci, + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=512, + testpmd_log_level={"ice": 7, "iavf": 7}, + testpmd_other_eal_param="", + testpmd_param=" --enable-rx-cksum --max-pkt-len=%d " % offload.TSO_MTU, + testpmd_commands=[ + "set verbose 1", + "set fwd csum", + "csum mac-swap off 0", + "csum mac-swap off 1", + "set promisc 0 on", + "set promisc 1 on", + "port stop all", + "csum set ip hw 1", + "csum set udp hw 1", + "csum set tcp hw 1", + "csum set sctp hw 1", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "tunnel_tso set %d 1" % offload.TSO_SEGMENT_LENGTH, + "port start all", + ], + packets=self.packets_tso_non_tunnel + self.packets_tso_tunnel, + packet_interval=offload.TX_INTERVAL, + packet_mtu=offload.TSO_MTU, + segment_length=offload.TSO_SEGMENT_LENGTH, + support_rx_tunnel=self.support_rx_tunnel, + support_seg_non_tunnel=True, + support_seg_tunnel=True, + support_tso=True, + support_ufo=True, + ) def tear_down(self): self.vm0_testpmd.execute_cmd("quit", "# ")