From patchwork Tue Jul 18 01:26:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 129590 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 6AE2D42E9F; Tue, 18 Jul 2023 03:26:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 623F842B8E; Tue, 18 Jul 2023 03:26:34 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 4DF05427F5 for ; Tue, 18 Jul 2023 03:26:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689643592; x=1721179592; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=47MdeBddIPFx3MhPlUVxwgl5+jsvQU16HMUR6NikoCc=; b=a+j+2BfOmD6+4no8sGiBhywegj4/LonnI9jSO6csyEcE6WrcOXqC9iMk uw3qnkLVFhVw7/kWv3MnKceaWWLPCq6ZguUtWkz+j9JDf76EN9Iwik8Zh Hlylz3T/u8it4MQYyXCbdChslc/UYdQXSOP5e+bUkiYKM5xkEoNwHyrwK DQ3ZPLjaGri9YrE2sSLC3Z1iJfYgGnocPQPr6pNM/ajuCwu7rLZ44JhdH DxlveAmFp8p+aUNLXg5rvFhF8D7aSb+pP15F54TgIqkAM4rwr8QVyexyk Eqsr7GE8D3Pn8SIy7Gw0JM5fpMdXm/jJfwCQW6Qk9Wy4Vi3iNXijfFe8Y w==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="366119517" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="366119517" 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:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="837089798" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="837089798" Received: from dpdk-xuke-host.sh.intel.com ([10.67.114.220]) by fmsmga002.fm.intel.com with ESMTP; 17 Jul 2023 18:26:29 -0700 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, tarcadia@qq.com, Jin Ling Subject: [DTS][Patch V2 1/6] test_plans/checksum_offload: Refactor checksum_offload case. Date: Tue, 18 Jul 2023 01:26:24 +0000 Message-Id: <20230718012629.2471811-2-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 checksum_offload testplan. 1. Add description for tunnel scenario. 2. Add Common test steps and packet organization table to better show the test steps. 3. 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. 4. Update cases for NIC comaptibility. Add description for VLAN and AVX512 to fit specific testing scenarios required by several NICs. 5. RX scopes and offload flags are combined with varied packet type TX cases for better covering and more common validation. Co-authored-by: Ke Xu Co-authored-by: Jin Ling Signed-off-by: Ke Xu --- test_plans/checksum_offload_test_plan.rst | 1478 +++++++++------------ 1 file changed, 608 insertions(+), 870 deletions(-) diff --git a/test_plans/checksum_offload_test_plan.rst b/test_plans/checksum_offload_test_plan.rst index fab75857..57987b82 100644 --- a/test_plans/checksum_offload_test_plan.rst +++ b/test_plans/checksum_offload_test_plan.rst @@ -1,59 +1,71 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright(c) 2010-2017 Intel Corporation + Copyright(c) 2010-2023 Intel Corporation Copyright(c) 2018-2019 The University of New Hampshire -============================ -RX/TX Checksum Offload Tests -============================ +====================== +Checksum Offload Tests +====================== -The support of RX/TX L3/L4 Checksum offload features by Poll Mode Drivers consists in: +Description +=========== + +The support of RX/TX L3/L4 checksum offload features by Poll Mode Drivers consists in: On the RX side: - Verify IPv4 checksum by hardware for received packets. - Verify UDP/TCP/SCTP checksum by hardware for received packets. +- Verify tunneled outer IPv4 checksum by hardware for recieved packets. +- Verify tunneled outer UDP checksum by hardware for recieved packets. On the TX side: -- IPv4 checksum insertion by hardware in transmitted packets. -- IPv4/UDP checksum insertion by hardware in transmitted packets. -- IPv4/TCP checksum insertion by hardware in transmitted packets. -- IPv4/SCTP checksum insertion by hardware in transmitted packets (sctp - length in 4 bytes). -- IPv6/UDP checksum insertion by hardware in transmitted packets. -- IPv6/TCP checksum insertion by hardware in transmitted packets. -- IPv6/SCTP checksum insertion by hardware in transmitted packets (sctp - length in 4 bytes). - -RX/TX side, the insertion of a L3/L4 checksum by hardware can be enabled with the +- IPv4 checksum insertion by hardware/software in transmitted packets. +- UDP/TCP/SCTP checksum insertion by hardware/software in transmitted packets (sctp length in 4 bytes). +- Tunneled outer IPv4 checksum insertion by hardware/software in transmitted packets. +- Tunneled outer UDP checksum insertion by hardware/software in transmitted packets. + +RX/TX side, the insertion of a L3/L4 or tunneled outer L3/L4 checksum by hardware can be enabled with the following command of the ``testpmd`` application and running in a dedicated tx checksum mode:: - set fwd csum - csum set ip|tcp|udp|sctp|outer-ip|outer-udp hw|sw port_id + set fwd csum + csum set ip|tcp|udp|sctp|outer-ip|outer-udp hw|sw port_id The transmission of packet is done with the ``start`` command of the ``testpmd`` application that will receive packets and then transmit the packet out on all -configured ports. - +configured ports. Prerequisites ============= -If using vfio the kernel must be >= 3.6+ and VT-d must be enabled in bios.When +Topology +-------- + + dut_port_0 <---> tester_port_0 + + dut_port_1 <---> tester_port_1 + +Software +-------- + + - dpdk: http://dpdk.org/git/dpdk + - scapy: http://www.secdev.org/projects/scapy/ + +Configuration and Setup +----------------------- + +If using vfio the kernel must be >= 3.6+ and VT-d must be enabled in bios. When using vfio, use the following commands to load the vfio driver and bind it to the device under test:: modprobe vfio modprobe vfio-pci - usertools/dpdk-devbind.py --bind=vfio-pci device_bus_id + usertools/dpdk-devbind.py --bind=vfio-pci -Assuming that ports ``0`` and ``2`` are connected to a traffic generator, -launch the ``testpmd`` with the following arguments:: +Based on the topology, launch the ``testpmd`` with the following arguments:: - ./build/app/dpdk-testpmd -cffffff -n 1 -- -i --burst=1 --txpt=32 \ - --txht=8 --txwt=0 --txfreet=0 --rxfreet=64 --mbcache=250 --portmask=0x5 - enable-rx-cksum + ./build/app/dpdk-testpmd -c <...> -n <...> -- -i <...> --enable-rx-cksum Set the verbose level to 1 to display information for each received packet:: @@ -65,944 +77,670 @@ Currently, our test scripts are based on not exchanging MAC addresses, mac-swap testpmd> csum mac-swap off 0 -Test Case: Insert IPv4/IPv6 UDP/TCP/SCTP checksum on the transmit packet -======================================================================== - -Setup the ``csum`` forwarding mode:: - - testpmd> set fwd csum - Set csum packet forwarding mode - -Start the packet forwarding:: - - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set sctp hw 0 - testpmd> port start all - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 - -Start a packet capture on the tester in the background:: - - tcpdump -i -s 65535 -w /tmp/tester/test_checksum_capture.pcap & - -Send the following multiple packets from tester for with scapy -combination: IPv4/UDP, IPv4/TCP, IPv4/SCTP, IPv6/UDP, IPv6/TCP:: - - sendp([Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/IP(chksum=0x0)/SCTP(chksum=0x0)/("X"*48), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)], - iface="ens192f0",count=4,inter=0,verbose=False) - -Then verify that the same number of packet are correctly received on the tester. - -Inspect the pcap file from the packet capture and verify the checksums. - - -Test Case: Do not insert IPv4/IPv6 UDP/TCP checksum on the transmit packet -========================================================================== - -Setup the ``csum`` forwarding mode:: - - testpmd> set fwd csum - Set csum packet forwarding mode - -Start the packet forwarding:: - - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 - -Start a packet capture on the tester in the background:: - - tcpdump -i -s 65535 -w /tmp/tester/test_checksum_capture.pcap & - -Send the following multiple packets from tester for with scapy -combination: IPv4/UDP, IPv4/TCP, IPv6/UDP, IPv6/TCP:: - - sendp([Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/IP(src="10.0.0.1",chksum=0x0)/UDP(chksum=0xf)/("X"*46), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/IP(src="10.0.0.1",chksum=0x0)/TCP(chksum=0xf)/("X"*46), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)], - iface="ens192f0",count=4,inter=0,verbose=False) - -Then verify that the same number of packet are correctly received on the tester. - -Inspect the pcap file from the packet capture and verify the checksums. - -Test Case: Validate RX checksum valid flags on the receive packet -================================================================= - -Setup the ``csum`` forwarding mode:: - - testpmd> set fwd csum - Set csum packet forwarding mode - -Start the packet forwarding:: - - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set sctp hw 0 - testpmd> port start all - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 - -Configure the traffic generator to send the multiple packets with the following -combination: good/bad ip checksum + good/bad udp/tcp checksum. - -Send a packet ptypes is IP/UDP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=int(0x7ca0))/UDP(chksum=int(0x1126))/('X'*50), iface=iface) - - Check the Rx checksum flags consistent with expected flags. - - port=0, mbuf=0x168d06200, pkt_len=88, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=8 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/TCP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=int(0xf19f))/TCP(chksum=int(0x165f))/('X'*50), iface=iface) - - Check the Rx checksum flags consistent with expected flags. - - port=0, mbuf=0x168be5100, pkt_len=100, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/SCTP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=int(0xf127))/SCTP(chksum=int(0x2566b731))/('X'*50), iface=iface) - - Check the Rx checksum flags consistent with expected flags. - - port=0, mbuf=0x168be7600, pkt_len=94, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=132 l4_len=0 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=0 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_SCTP_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IPV6/UDP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPv6(src="::1")/UDP(chksum=int(0xf27))/('X'*50), iface=iface) - - Check the Rx checksum flags consistent with expected flags. - - port=0, mbuf=0x168d058c0, pkt_len=108, nb_segs=1: - rx: l2_len=14 ethertype=86dd l3_len=40 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=40 m->l4_len=8 - tx: flags=RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV6 - -Send a packet ptypes is IPV6/TCP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPv6(src="::1")/TCP(chksum=int(0x9f5f))/('X'*50), iface=iface) - - Check the Rx checksum flags consistent with expected flags. - - port=0, mbuf=0x168d033c0, pkt_len=120, nb_segs=1: - rx: l2_len=14 ethertype=86dd l3_len=40 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=40 m->l4_len=20 - tx: flags=RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV6 - -Send a packet ptypes is IP/UDP with a bad IP/UDP checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=0x0)/UDP(chksum=0xf)/('X'*50), iface=iface) - - Check the Rx checksum flags consistent with expected flags. - - port=0, mbuf=0x168d00ec0, pkt_len=88, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_BAD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=8 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/TCP with a bad IP/TCP checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=0x0)/TCP(chksum=0xf)/('X'*50), iface=iface) - - Check the Rx checksum flags consistent with expected flags. - - port=0, mbuf=0x168cfe9c0, pkt_len=100, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_BAD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/SCTP with a bad IP/SCTP checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=0x0)/SCTP(chksum=0xf)/('X'*50), iface=iface) - - Check the Rx checksum flags consistent with expected flags. - - port=0, mbuf=0x168cfc4c0, pkt_len=94, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=132 l4_len=0 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_BAD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=0 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_SCTP_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IPV6/UDP with a bad UDP checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPv6(src="::1")/UDP(chksum=0xf)/('X'*50), iface=iface) - - Check the Rx checksum flags consistent with expected flags. - - port=0, mbuf=0x168cf9fc0, pkt_len=108, nb_segs=1: - rx: l2_len=14 ethertype=86dd l3_len=40 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=40 m->l4_len=8 - tx: flags=RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV6 - -Send a packet ptypes is IPV6/TCP with a bad TCP checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPv6(src="::1")/TCP(chksum=0xf)/('X'*50), iface=iface) - - Check the Rx checksum flags consistent with expected flags. - - port=0, mbuf=0x168cf9fc0, pkt_len=108, nb_segs=1: - rx: l2_len=14 ethertype=86dd l3_len=40 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=40 m->l4_len=8 - tx: flags=RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV6 - -Test Case: Hardware Checksum Check L4 RX -=========================================== -This test involves testing many different scenarios with a L4 checksum. -A variety of tunneling protocols, L3 protocols and L4 protocols are combined -to test as many scenarios as possible. Currently, UDP, TCP and SCTP are used -as L4 protocols, with IP and IPv6 being used at level 3. The tested tunneling -protocols are VXLAN and GRE. - -Setup the ``csum`` forwarding mode:: - - testpmd> set fwd csum - Set csum packet forwarding mode - -Start the packet forwarding:: - - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set sctp hw 0 - testpmd> port start all - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 - -Send a packet ptypes is IP/UDP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP()/('X'*50), iface=iface) - - check the packet received, the flag RTE_MBUF_F_RX_L4_CKSUM_GOOD in the packet received - - port=0, mbuf=0x2269df8780, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/UDP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP(chksum=0xf)/('X'*50), iface=iface) - - check the packet received, the flag RTE_MBUF_F_RX_L4_CKSUM_BAD in the packet received - - port=0, mbuf=0x2269df7e40, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_BAD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/TCP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/TCP()/('X'*50), iface=iface) - - check the packet received, the flag RTE_MBUF_F_RX_L4_CKSUM_GOOD in the packet received - - port=0, mbuf=0x2269df8780, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/TCP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/TCP(chksum=0xf)/('X'*50), iface=iface) - - check the packet received, the flag RTE_MBUF_F_RX_L4_CKSUM_BAD in the packet received - - port=0, mbuf=0x2269df7e40, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_BAD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/SCTP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/SCTP()/('X'*50), iface=iface) - - check the packet received, the flag RTE_MBUF_F_RX_L4_CKSUM_GOOD in the packet received - - port=0, mbuf=0x2269df8780, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 +Common test steps +================= + +1. launch test-pmd to enable RX Checksum offload and for some NIC it enables a general set of RX Offloads:: + + ./dpdk/x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c <...> -n <...> -a <...> -- -i --enable-rx-cksum + +2. config testpmd:: + + set csum fwd mode and stop all port:: + + testpmd> set fwd csum + testpmd> port stop all + + Modify the following commands to configure checksum offload according to the test scenario of each case: + + testpmd> csum set ip|tcp|udp|sctp|outer-ip|outer-udp hw|sw port_id + + start all ports and fwd: + + testpmd> port start all + testpmd> set verbose 1 + testpmd> start + +3. start to capture packets on tester:: + + tester: tcpdump -i -Q in -e ether src 52:00:00:00:00:00 -w /tmp/ens10.pcap + +4. send packets with scapy:: + + Configure the packet generator to send multiple combinations of inner and outer packet parts + according to the test scenario of each case, refer to the following table: + ++------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| Packet Types | Packet Names | Packet organizations | ++==================+===========================+==============================================================================================================================+ +| | IP/UDP | IP(src="10.0.0.1") / UDP(sport=29999, dport=30000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IP/TCP | IP(src="10.0.0.1") / TCP(sport=29999, dport=30000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IP/SCTP | IP(src="10.0.0.1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IPv6/UDP | IPv6(src="::1") / UDP(sport=29999, dport=30000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IPv6/TCP | IPv6(src="::1") / TCP(sport=29999, dport=30000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| Inner Parts | IPv6/SCTP | IPv6(src="::1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IP/UDP | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(sport=29999, dport=30000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IP/TCP | Dot1Q(vlan=100) / IP(src="10.0.0.1") / TCP(sport=29999, dport=30000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IP/SCTP | Dot1Q(vlan=100) / IP(src="10.0.0.1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IPv6/UDP | Dot1Q(vlan=100) / IPv6(src="::1") / UDP(sport=29999, dport=30000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IPv6/TCP | Dot1Q(vlan=100) / IPv6(src="::1") / TCP(sport=29999, dport=30000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IPv6/SCTP | Dot1Q(vlan=100) / IPv6(src="::1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(CSUM_PAYLOAD_SIZE)) | ++------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/VXLAN | IP(src="10.0.0.1") / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/VXLAN | IPv6() / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/VXLAN-GPE | IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/VXLAN-GPE | IPv6() / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/VXLAN-GPE/Ether | IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/VXLAN-GPE/Ether | IPv6() / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GRE | IP(src="10.0.0.1", proto=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GRE | IPv6(nh=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GRE/Ether | IP(src="10.0.0.1", proto=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GRE/Ether | IPv6(nh=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/NVGRE | IP(src="10.0.0.1", proto=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/NVGRE | IPv6(nh=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GTPU | IP(src="10.0.0.1") / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GTPU | IPv6() / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GENEVE | IP(src="10.0.0.1") / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GENEVE | IPv6() / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP | IP(src="10.0.0.1") | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| Outer Parts |IPv6 | IPv6() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/VXLAN | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/VXLAN | Dot1Q(vlan=100) / IPv6() / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/VXLAN-GPE | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/VXLAN-GPE | Dot1Q(vlan=100) / IPv6() / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/VXLAN-GPE/Ether | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/VXLAN-GPE/Ether | Dot1Q(vlan=100) / IPv6() / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GRE | Dot1Q(vlan=100) / IP(src="10.0.0.1", proto=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GRE | Dot1Q(vlan=100) / IPv6(nh=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GRE/Ether | Dot1Q(vlan=100) / IP(src="10.0.0.1", proto=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GRE/Ether | Dot1Q(vlan=100) / IPv6(nh=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/NVGRE | Dot1Q(vlan=100) / IP(src="10.0.0.1", proto=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/NVGRE | Dot1Q(vlan=100) / IPv6(nh=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GTPU | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GTPU | Dot1Q(vlan=100) / IPv6() / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GENEVE | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GENEVE | Dot1Q(vlan=100) / IPv6() / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP | Dot1Q(vlan=100) / IP(src="10.0.0.1") | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6 | Dot1Q(vlan=100) / IPv6() | ++------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------+ + ++------------------+------------------+----------------------------+ +| Scenarios | Packet Types | Packet Names | ++==================+==================+============================+ +| | | IP/UDP | +| | +----------------------------+ +| | | IP/TCP | +| | +----------------------------+ +| CSUM NON-TUNNEL | Inner parts | IP/SCTP | +| PACKETS | +----------------------------+ +| | | IPv6/UDP | +| | +----------------------------+ +| | | IPv6/TCP | +| | +----------------------------+ +| | | IPv6/SCTP | ++------------------+------------------+----------------------------+ +| | | IP/VXLAN | +| | +----------------------------+ +| | | IPv6/VXLAN | +| | Outer parts +----------------------------+ +| | | IP/NVGRE | +| | +----------------------------+ +| | | IPv6/NVGRE | +| +------------------+----------------------------+ +| CSUM TUNNEL | | IP/UDP | +| PACKETS | +----------------------------+ +| | | IP/TCP | +| | +----------------------------+ +| | Inner parts | IP/SCTP | +| | +----------------------------+ +| | | IPv6/UDP | +| | +----------------------------+ +| | | IPv6/TCP | +| | +----------------------------+ +| | | IPv6/SCTP | ++------------------+------------------+----------------------------+ +| | | IP/VXLAN | +| | +----------------------------+ +| | | IPv6/VXLAN | +| | +----------------------------+ +| | | IP/VXLAN-GPE | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE | +| | +----------------------------+ +| | | IP/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IP/GRE | +| | +----------------------------+ +| CSUM TUNNEL | Outer parts | IPv6/GRE | +| PACKETS | +----------------------------+ +| for Commons DDP | | IP/GRE/Ether | +| | +----------------------------+ +| | | IPv6/GRE/Ether | +| | +----------------------------+ +| | | IP/NVGRE | +| | +----------------------------+ +| | | IPv6/NVGRE | +| | +----------------------------+ +| | | IP/GTPU | +| | +----------------------------+ +| | | IPv6/GTPU | +| +------------------+----------------------------+ +| | | IP/UDP | +| | +----------------------------+ +| | | IP/TCP | +| | +----------------------------+ +| | Inner parts | IP/SCTP | +| | +----------------------------+ +| | | IPv6/UDP | +| | +----------------------------+ +| | | IPv6/TCP | +| | +----------------------------+ +| | | IPv6/SCTP | ++------------------+------------------+----------------------------+ +| | | VLAN/IP/UDP | +| | +----------------------------+ +| | | VLAN/IP/TCP | +| | +----------------------------+ +| CSUM NON-TUNNEL | Inner parts | VLAN/IP/SCTP | +| VLAN PACKETS | +----------------------------+ +| | | VLAN/IPv6/UDP | +| | +----------------------------+ +| | | VLAN/IPv6/TCP | +| | +----------------------------+ +| | | VLAN/IPv6/SCTP | ++------------------+------------------+----------------------------+ +| | | VLAN/IP/VXLAN | +| | +----------------------------+ +| | | VLAN/IPv6/VXLAN | +| | Outer parts +----------------------------+ +| | | VLAN/IP/NVGRE | +| | +----------------------------+ +| | | VLAN/IPv6/NVGRE | +| +------------------+----------------------------+ +| CSUM TUNNEL | | VLAN/IP/UDP | +| VLAN PACKETS | +----------------------------+ +| | | VLAN/IP/TCP | +| | +----------------------------+ +| | Inner parts | VLAN/IP/SCTP | +| | +----------------------------+ +| | | VLAN/IPv6/UDP | +| | +----------------------------+ +| | | VLAN/IPv6/TCP | +| | +----------------------------+ +| | | VLAN/IPv6/SCTP | ++------------------+------------------+----------------------------+ +| | | VLAN/IP/VXLAN | +| | +----------------------------+ +| | | VLAN/IPv6/VXLAN | +| | +----------------------------+ +| | | VLAN/IP/VXLAN-GPE | +| | +----------------------------+ +| | | VLAN/IPv6/VXLAN-GPE | +| | +----------------------------+ +| | | VLAN/IP/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | VLAN/IPv6/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | VLAN/IP/GRE | +| | +----------------------------+ +| CSUM TUNNEL | Outer parts | VLAN/IPv6/GRE | +| VLAN PACKETS | +----------------------------+ +| for Commons DDP | | VLAN/IP/GRE/Ether | +| | +----------------------------+ +| | | VLAN/IPv6/GRE/Ether | +| | +----------------------------+ +| | | VLAN/IP/NVGRE | +| | +----------------------------+ +| | | VLAN/IPv6/NVGRE | +| | +----------------------------+ +| | | VLAN/IP/GTPU | +| | +----------------------------+ +| | | VLAN/IPv6/GTPU | +| +------------------+----------------------------+ +| | | VLAN/IP/UDP | +| | +----------------------------+ +| | | VLAN/IP/TCP | +| | +----------------------------+ +| | Inner parts | VLAN/IP/SCTP | +| | +----------------------------+ +| | | VLAN/IPv6/UDP | +| | +----------------------------+ +| | | VLAN/IPv6/TCP | +| | +----------------------------+ +| | | VLAN/IPv6/SCTP | ++------------------+------------------+----------------------------+ + +5. stop capture packets and then stop fwd:: + + tester: pkill tcpdump + dut: testpmd> stop + +6. check rx and tx results:: + + Check if ``ol_flag`` contains these fields based on the checksum values of L3 and L4 in the sent packets, refer to the following table. + ++--------------+---------------------------------+--------------------------+ +| packet type | checksum value | check ol_flag | ++==============+=================================+==========================+ +| Inner | IPv4 (bad checksum) | `RX_IP_CKSUM_BAD` | +| +---------------------------------+--------------------------+ +| | IPv4 (good checksum) | `RX_IP_CKSUM GOOD` | +| +---------------------------------+--------------------------+ +| | TCP / UDP / SCTP (bad checksum) | `RX_L4_CKSUM_BAD` | +| +---------------------------------+--------------------------+ +| | TCP / UDP / SCTP (bad checksum) | `RX_L4_CKSUM_GOOD` | ++--------------+---------------------------------+--------------------------+ +| Outer | IPv4 (bad checksum) | `RX_OUTER_IP_CKSUM_BAD` | +| +---------------------------------+--------------------------+ +| | IPv4 (good checksum) | `RX_OUTER_IP_CKSUM GOOD` | +| +---------------------------------+--------------------------+ +| | UDP (bad checksum) | `RX_OUTER_L4_CKSUM_BAD` | +| +---------------------------------+--------------------------+ +| | UDP (good checksum) | `RX_OUTER_L4_CKSUM_GOOD` | ++--------------+---------------------------------+--------------------------+ + + + Check rx and tx statistics according to the checksum values of L3 and L4 in the sent packets, refer to the following packets. + ++------------------+-------------------------------------------------------------------+ +| entry | checkpoint | ++==================+===================================================================+ +| RX-packets | `RX-packets` = Num of sent packets | ++------------------+-------------------------------------------------------------------+ +| RX-total | `RX-total` = Num of sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-ipcsum | `Bad-ipcsum` = Sum of bad inner IP checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-l4csum | `Bad-l4csum` = Sum of bad inner L4 checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-outer-ipcsum | `Bad-outer-ipcsum` = Sum of bad outer IP checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-outer-l4csum | `Bad-outer-l4csum` = Sum of bad outer L4 checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| TX-packets | `TX-packets` = `RX-packets` (exclude tso cases) | ++------------------+-------------------------------------------------------------------+ +| TX-total | `TX-total` = `RX-total` (exclude tso cases) | ++------------------+-------------------------------------------------------------------+ + + Read pcap files with scapy and check if configured checksum values to insert of tx_packets are all correct:: + + >>> tx_pkts = rdpcap("/tmp/ens10.pcap") # tx_packets is of list of all tx pkts + >>> tx_pkts[0].show2() # will print all info about the first packet, compare the checksum with the ref checksum. + + +Support of NICs +=============== + +Here we list the NICs for features supported introduced above. For NICs not listed we should use default test scopes. + ++--------------------+------------------------------+--------------------+--------------------+------------------------------+--------------------+--------------------+--------------------+--------------------+--------------------+--------------------+ +| NICs | IPv4 or IPv6 / TCP or UDP RX | IPv4 / SCTP RX | IPv6 / SCTP RX | IPv4 or IPv6 / TCP or UDP TX | IPv4 / SCTP TX | IPv6 / SCTP TX | VLAN RX | VLAN TX | Tunneled RX | Tunneled TX | ++====================+==============================+====================+====================+==============================+====================+====================+====================+====================+====================+====================+ +| E810 series | Yes | Yes | Yes | Yes | Partially | Partially | Yes | Yes | Partially | Partially | +| DDP OS Default | | | | | | | | | | | ++--------------------+------------------------------+--------------------+--------------------+------------------------------+--------------------+--------------------+--------------------+--------------------+--------------------+--------------------+ +| E810 series | Yes | Yes | Yes | Yes | Partially | Partially | Yes | Yes | Yes | Yes | +| DDP Comms | | | | | | | | | | | ++--------------------+------------------------------+--------------------+--------------------+------------------------------+--------------------+--------------------+--------------------+--------------------+--------------------+--------------------+ +| E710 series | Yes | Yes | Yes | Yes | Partially | Partially | Yes | Yes | Partially | Partially | ++--------------------+------------------------------+--------------------+--------------------+------------------------------+--------------------+--------------------+--------------------+--------------------+--------------------+--------------------+ +| Lib SW | N/A | N/A | N/A | Yes | Partially | Partially | N/A | Yes | N/A | No | ++--------------------+------------------------------+--------------------+--------------------+------------------------------+--------------------+--------------------+--------------------+--------------------+--------------------+--------------------+ +| Default | Yes | Yes | Yes | Yes | Partially | Partially | Req Config | Yes | No | No | ++--------------------+------------------------------+--------------------+--------------------+------------------------------+--------------------+--------------------+--------------------+--------------------+--------------------+--------------------+ + + +Test case 1: HW IP non-tunneling +================================ + +This test is used to test non-tunneling packets and will enable hw ip checksum offload. +Configure the TX HW Offload:: + + csum set ip hw 1 + +Send packets of:: -Send a packet ptypes is IP/SCTP with a bad checksum:: + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/SCTP(chksum=0xf)/('X'*50), iface=iface) - check the packet received, the flag RTE_MBUF_F_RX_L4_CKSUM_BAD in the packet received +Test case 2: HW UDP non-tunneling +================================= - port=0, mbuf=0x2269df7e40, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_BAD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 +This test is used to test non-tunneling packets and will enable hw udp checksum offload. +Configure the TX HW Offload:: -Verify flags are as expected. + csum set udp hw 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: -Test Case: Hardware Checksum Check L3 RX -=========================================== -This test involves testing L3 checksum hardware offload. -Due to the relative dominance of IPv4 and IPv6 as L3 protocols, and IPv6's -lack of a checksum, only IPv4's checksum is tested. + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) -Setup the ``csum`` forwarding mode:: +Check for the correct checksum insertion at the correct place. - testpmd> set fwd csum - Set csum packet forwarding mode -Start the packet forwarding:: +Test case 3: HW TCP non-tunneling +================================= - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set sctp hw 0 - testpmd> csum set 0xf 0 - testpmd> port start all - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 +This test is used to test non-tunneling packets and will enable hw tcp checksum offload. +Configure the TX HW Offload:: -Send a packet ptypes is IP/UDP with a good checksum:: + csum set tcp hw 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP()/('X'*50), iface=iface) + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) - check the packet received, the flag RTE_MBUF_F_RX_IP_CKSUM_GOOD in the packet received +Check for the correct checksum insertion at the correct place. - port=0, mbuf=0x2269df8780, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 -Send a packet ptypes is IP/UDP with a bad checksum:: +Test case 4: HW SCTP non-tunneling +================================== - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=0xf)/UDP()/('X'*50), iface=iface) +This test is used to test non-tunneling packets and will enable hw sctp checksum offload. +Configure the TX HW Offload:: - check the packet received, the flag RTE_MBUF_F_RX_IP_CKSUM_BAD in the packet received + csum set sctp hw 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - port=0, mbuf=0x2269df7e40, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_BAD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) -Send a packet ptypes is IP/TCP with a good checksum:: +Check for the correct checksum insertion at the correct place. - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/TCP()/('X'*50), iface=iface) - check the packet received, the flag RTE_MBUF_F_RX_IP_CKSUM_GOOD in the packet received - - port=0, mbuf=0x2269df8780, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/TCP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=0xf)/TCP()/('X'*50), iface=iface) - - check the packet received, the flag RTE_MBUF_F_RX_IP_CKSUM_BAD in the packet received - - port=0, mbuf=0x2269df7e40, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_BAD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/SCTP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/SCTP()/('X'*50), iface=iface) - - check the packet received, the flag RTE_MBUF_F_RX_IP_CKSUM_GOOD in the packet received - - port=0, mbuf=0x2269df8780, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 - -Send a packet ptypes is IP/SCTP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=0xf)/SCTP()/('X'*50), iface=iface) - - check the packet received, the flag RTE_MBUF_F_RX_IP_CKSUM_BAD in the packet received - - port=0, mbuf=0x2269df7e40, pkt_len=96, nb_segs=1: - rx: l2_len=18 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_BAD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: flags=RTE_MBUF_F_TX_L4_NO_CKSUM RTE_MBUF_F_TX_IPV4 - -Verify flags are as expected. - -Test Case: Hardware Checksum Check L4 TX -=========================================== -This test involves testing many different scenarios with a L4 checksum. -A variety of tunneling protocols, L3 protocols and L4 protocols are combined -to test as many scenarios as possible. Currently, UDP and TCP are used -as L4 protocols, with IP and IPv6 being used at level 3. The tested tunneling -protocols are VXLAN and GRE. This test is used to determine whether the -hardware offloading of checksums works properly. - -Setup the ``csum`` forwarding mode:: - - testpmd> set fwd csum - Set csum packet forwarding mode - -Start the packet forwarding:: - - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set sctp hw 0 - testpmd> port start all - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 - - -Start a packet capture on the tester in the background:: - - # tcpdump -i -s 65535 -w /tmp/tester/test_hardware_checksum_check_l4_tx_capture.pcap & - -Send a packet ptypes is IP/UDP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP(chksum=0xb161)/Raw(load=b'x'), iface=iface) - - port=0, mbuf=0x168d06200, pkt_len=90, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=8 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/UDP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP(chksum=0xf)/Raw(load=b'x'), iface=iface) - - port=0, mbuf=0x168d06b40, pkt_len=90, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=8 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/TCP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/TCP(chksum=0x4904)/Raw(load=b'x'), iface=iface) - - port=0, mbuf=0x168d07480, pkt_len=102, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/TCP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/TCP(chksum=0xf)/Raw(load=b'x'), iface=iface) - - port=0, mbuf=0x168be47c0, pkt_len=102, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IPV6/UDP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPv6()/UDP(chksum=0xaf62)/Raw(load=b'x'), iface=iface) - - port=0, mbuf=0x168be5100, pkt_len=110, nb_segs=1: - rx: l2_len=14 ethertype=86dd l3_len=40 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=40 m->l4_len=8 - tx: flags=RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV6 - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IPV6/UDP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPv6()/UDP(chksum=0xf)/Raw(load=b'x'), iface=iface) - - port=0, mbuf=0x168be5a40, pkt_len=110, nb_segs=1: - rx: l2_len=14 ethertype=86dd l3_len=40 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=40 m->l4_len=8 - tx: flags=RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV6 - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IPV6/TCP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPv6()/TCP(chksum=0x4705)/Raw(load=b'x'), iface=iface) - - port=0, mbuf=0x168be6380, pkt_len=122, nb_segs=1: - rx: l2_len=14 ethertype=86dd l3_len=40 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=40 m->l4_len=20 - tx: flags=RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV6 - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IPV6/TCP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPv6()/TCP(chksum=0xf)/Raw(load=b'x'), iface=iface) - - port=0, mbuf=0x168be6cc0, pkt_len=122, nb_segs=1: - rx: l2_len=14 ethertype=86dd l3_len=40 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=40 m->l4_len=20 - tx: flags=RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV6 - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/UDP/VXLAN/IP/UDP inner UDP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP()/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IP()/UDP(chksum=0x9949)/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168be7600, pkt_len=140, nb_segs=1: - rx: l2_len=30 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=30 m->l3_len=20 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/UDP/VXLAN/IP/UDP inner UDP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP()/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IP()/UDP(chksum=0xf)/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168be7600, pkt_len=140, nb_segs=1: - rx: l2_len=30 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=30 m->l3_len=20 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/UDP/VXLAN/IP/UDP outer UDP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP(chksum=0xf)/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IP()/UDP()/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168be7600, pkt_len=140, nb_segs=1: - rx: l2_len=30 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=30 m->l3_len=20 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/UDP/VXLAN/IP/UDP inter UDP and outer UDP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP(chksum=0xf)/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IP()/UDP(chksum=0xf)/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168be7600, pkt_len=140, nb_segs=1: - rx: l2_len=30 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=30 m->l3_len=20 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/UDP/VXLAN/IP/TCP inner TCP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP()/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IP()/TCP(chksum=0x30ec)/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168d058c0, pkt_len=152, nb_segs=1: - rx: l2_len=30 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=30 m->l3_len=20 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/UDP/VXLAN/IP/TCP inner TCP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP()/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IP()/TCP(chksum=0xf)/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168d04f80, pkt_len=152, nb_segs=1: - rx: l2_len=30 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=30 m->l3_len=20 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/UDP/VXLAN/IP/TCP outer UDP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP(chksum=0xf)/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IP()/TCP()/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168d04640, pkt_len=152, nb_segs=1: - rx: l2_len=30 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=30 m->l3_len=20 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IP/UDP/VXLAN/IP/TCP outer UDP and inner TCP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/UDP(chksum=0xf)/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IP()/TCP(chksum=0xf)/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168d03d00, pkt_len=152, nb_segs=1: - rx: l2_len=30 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=30 m->l3_len=20 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IPV6/UDP/VXLAN/IPV6/UDP inner UDP with a good checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/UDP()/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IPV6()/UDP(chksum=0x9949)/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168d033c0, pkt_len=180, nb_segs=1: - rx: l2_len=30 ethertype=86dd l3_len=40 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=86dd outer_l3_len=40 - tx: m->l2_len=30 m->l3_len=40 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=40 - tx: flags=RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV6 RTE_MBUF_F_TX_OUTER_IPV6 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IPV6/UDP/VXLAN/IPV6/UDP inner UDP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/UDP()/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IPV6()/UDP(chksum=0xf)/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168d02a80, pkt_len=180, nb_segs=1: - rx: l2_len=30 ethertype=86dd l3_len=40 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=86dd outer_l3_len=40 - tx: m->l2_len=30 m->l3_len=40 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=40 - tx: flags=RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV6 RTE_MBUF_F_TX_OUTER_IPV6 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IPV6/UDP/VXLAN/IPV6/UDP outer UDP with a bad checksum:: - - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/UDP(chksum=0xf)/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IPV6()/UDP()/Raw(load=b'Y'), iface=iface) - - port=0, mbuf=0x168d02140, pkt_len=180, nb_segs=1: - rx: l2_len=30 ethertype=86dd l3_len=40 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=86dd outer_l3_len=40 - tx: m->l2_len=30 m->l3_len=40 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=40 - tx: flags=RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV6 RTE_MBUF_F_TX_OUTER_IPV6 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM - - Inspect the pcap file from the packet capture and verify the checksums. - -Send a packet ptypes is IPV6/UDP/VXLAN/IPV6/UDP inter UDP and outer UDP with a bad checksum:: +Test case 5: HW IP + L4 non-tunneling +===================================== - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/UDP(chksum=0xf)/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IPV6()/UDP(chksum=0xf)/Raw(load=b'Y'), iface=iface) +This test is used to test non-tunneling packets and will enable IP and all L4 hw checksum offload. +Configure the TX HW Offload:: - port=0, mbuf=0x168d01800, pkt_len=180, nb_segs=1: - rx: l2_len=30 ethertype=86dd l3_len=40 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=86dd outer_l3_len=40 - tx: m->l2_len=30 m->l3_len=40 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=40 - tx: flags=RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV6 RTE_MBUF_F_TX_OUTER_IPV6 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM + csum set ip hw 1 + csum set udp hw 1 + csum set tcp hw 1 + csum set sctp hw 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - Inspect the pcap file from the packet capture and verify the checksums. + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) -Send a packet ptypes is IPV6/UDP/VXLAN/IPV6/TCP inner TCP with a good checksum:: +Check for the correct checksum insertion at the correct place. - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/UDP()/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IPV6()/TCP(chksum=0x30ec)/Raw(load=b'Y'), iface=iface) +For PMD not supporting VLAN defaultly, we run an extra case:: + + 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 + rx_vlan add 100 0 - port=0, mbuf=0x168d00ec0, pkt_len=192, nb_segs=1: - rx: l2_len=30 ethertype=86dd l3_len=40 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=86dd outer_l3_len=40 - tx: m->l2_len=30 m->l3_len=40 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=40 - tx: flags=RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV6 RTE_MBUF_F_TX_OUTER_IPV6 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - Inspect the pcap file from the packet capture and verify the checksums. + CSUM NON-TUNNEL VLAN PACKETS -Send a packet ptypes is IPV6/UDP/VXLAN/IPV6/TCP inner TCP with a bad checksum:: +Check for the correct checksum insertion at the correct place. - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/UDP()/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IPV6()/TCP(chksum=0xf)/Raw(load=b'Y'), iface=iface) - port=0, mbuf=0x168d00580, pkt_len=192, nb_segs=1: - rx: l2_len=30 ethertype=86dd l3_len=40 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=86dd outer_l3_len=40 - tx: m->l2_len=30 m->l3_len=40 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=40 - tx: flags=RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV6 RTE_MBUF_F_TX_OUTER_IPV6 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM +Test case 6: HW Outer-IP tunneling +================================== - Inspect the pcap file from the packet capture and verify the checksums. +This test is used to test tunneling scenario and will enable Outer-IP checksum offload. +Configure the TX HW Offload:: -Send a packet ptypes is IPV6/UDP/VXLAN/IPV6/TCP outer UDP with a bad checksum:: + 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 + rx_vxlan_port add 4789 0 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/UDP(chksum=0xf)/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IPV6()/TCP()/Raw(load=b'Y'), iface=iface) + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) - port=0, mbuf=0x168cffc40, pkt_len=192, nb_segs=1: - rx: l2_len=30 ethertype=86dd l3_len=40 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=86dd outer_l3_len=40 - tx: m->l2_len=30 m->l3_len=40 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=40 - tx: flags=RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV6 RTE_MBUF_F_TX_OUTER_IPV6 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - Inspect the pcap file from the packet capture and verify the checksums. + CSUM TUNNEL PACKETS (common packets for common DDP) + CSUM TUNNEL VLAN PACKETS (for i40e and ice, common packets for common DDP) -Send a packet ptypes is IPV6/UDP/VXLAN/IPV6/TCP outer UDP and inner TCP with a bad checksum:: +Check for the correct checksum insertion at the correct place. - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/UDP(chksum=0xf)/VXLAN()/ - Ether(dst='ff:ff:ff:ff:ff:ff', src='00:00:00:00:00:00')/IPV6()/TCP(chksum=0xf)/Raw(load=b'Y'), iface=iface) - port=0, mbuf=0x168cff300, pkt_len=192, nb_segs=1: - rx: l2_len=30 ethertype=86dd l3_len=40 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=86dd outer_l3_len=40 - tx: m->l2_len=30 m->l3_len=40 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=40 - tx: flags=RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV6 RTE_MBUF_F_TX_OUTER_IPV6 RTE_MBUF_F_TX_TUNNEL_VXLAN RTE_MBUF_F_TX_OUTER_UDP_CKSUM +Test case 7: HW Outer-UDP tunneling +=================================== - Inspect the pcap file from the packet capture and verify the checksums. +This test is used to test tunneling scenario and will enable Outer-UDP checksum offload. +Configure the TX HW Offload:: -Send a packet ptypes is IP/GRE/IP/UDP inner UDP with a good checksum:: + 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 + rx_vxlan_port add 4789 0 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/GRE()/IP()/UDP(chksum=0x8131)/Raw(load=b'Z'), iface=iface) + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) - port=0, mbuf=0x168cfe9c0, pkt_len=114, nb_segs=1: - rx: l2_len=4 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=4 m->l3_len=20 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_GRE +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - Inspect the pcap file from the packet capture and verify the checksums. + CSUM TUNNEL PACKETS (common packets for common DDP) + CSUM TUNNEL VLAN PACKETS (for i40e and ice, common packets for common DDP) -Send a packet ptypes is IP/GRE/IP/UDP inner UDP with a bad checksum:: +Check for the correct checksum insertion at the correct place. - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/GRE()/IP()/UDP(chksum=0xf)/Raw(load=b'Z'), iface=iface) - port=0, mbuf=0x168cfe080, pkt_len=114, nb_segs=1: - rx: l2_len=4 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=4 m->l3_len=20 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_GRE +Test case 8: HW Outer-IP + Outer-UDP tunneling with SW Inner (w/o VLAN) +======================================================================= - Inspect the pcap file from the packet capture and verify the checksums. +This test is used to test tunneling scenario and will enable Outer-IP and Outer-UDP checksum offload. +Configure the TX HW Offload:: -Send a packet ptypes is IP/GRE/IP/TCP inner TCP with a good checksum:: + csum set outer-ip hw 1 + csum set outer-udp hw 1 + csum parse-tunnel on 1 + rx_vxlan_port add 4789 0 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/GRE()/IP()/TCP(chksum=0x18d4)/Raw(load=b'Z'), iface=iface) + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) - port=0, mbuf=0x168cfd740, pkt_len=126, nb_segs=1: - rx: l2_len=4 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=4 m->l3_len=20 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_GRE +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - Inspect the pcap file from the packet capture and verify the checksums. + CSUM TUNNEL PACKETS (common packets for common DDP) + CSUM TUNNEL VLAN PACKETS (for i40e and ice, common packets for common DDP) -Send a packet ptypes is IP/GRE/IP/TCP inner TCP with a bad checksum:: +Check for the correct checksum insertion at the correct place. - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP()/GRE()/IP()/TCP(chksum=0xf)/Raw(load=b'Z'), iface=iface) +For PMD not supporting VLAN defaultly, we run an extra case:: + + csum set outer-ip hw 1 + csum set outer-udp hw 1 + csum parse-tunnel on 1 + vlan set filter on 0 + rx_vlan add 100 0 - port=0, mbuf=0x168cfce00, pkt_len=126, nb_segs=1: - rx: l2_len=4 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=4 m->l3_len=20 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_GRE +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - Inspect the pcap file from the packet capture and verify the checksums. + CSUM NON-TUNNEL VLAN PACKETS -Send a packet ptypes is IPV6/GRE/IPV6/UDP inner UDP with a good checksum:: +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/GRE()/IPV6()/UDP(chksum=0x8131)/Raw(load=b'Z'), iface=iface) + CSUM TUNNEL VLAN PACKETS - port=0, mbuf=0x168cfe9c0, pkt_len=114, nb_segs=1: - rx: l2_len=4 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=4 m->l3_len=20 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_GRE +Check for the correct checksum insertion at the correct place. - Inspect the pcap file from the packet capture and verify the checksums. -Send a packet ptypes is IPV6/GRE/IPV6/UDP inner UDP with a bad checksum:: +Test case 9: HW Outer-IP + Outer-UDP tunneling with HW Inner (w/o VLAN, w/o AVX512) +=================================================================================== - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/GRE()/IPV6()/UDP(chksum=0xf)/Raw(load=b'Z'), iface=iface) +Test for both default path and for AVX512 path by adding EAL Parameter '--force-max-simd-bitwidth=512'. - port=0, mbuf=0x168cfe080, pkt_len=114, nb_segs=1: - rx: l2_len=4 ethertype=800 l3_len=20 l4_proto=17 l4_len=8 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=4 m->l3_len=20 m->l4_len=8 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_UDP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_GRE +This test is used to test tunneling scenario and will enable Outer-IP and Outer-UDP checksum offload. +Configure the TX HW Offload:: - Inspect the pcap file from the packet capture and verify the checksums. + 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 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: -Send a packet ptypes is IPV6/GRE/IPV6/TCP inner TCP with a good checksum:: + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/GRE()/IPV6()/TCP(chksum=0x18d4)/Raw(load=b'Z'), iface=iface) +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - port=0, mbuf=0x168cfd740, pkt_len=126, nb_segs=1: - rx: l2_len=4 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=4 m->l3_len=20 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_GRE + CSUM TUNNEL PACKETS (common packets for common DDP) + CSUM TUNNEL VLAN PACKETS (for i40e and ice, common packets for common DDP) - Inspect the pcap file from the packet capture and verify the checksums. +Check for the correct checksum insertion at the correct place. -Send a packet ptypes is IPV6/GRE/IPV6/TCP inner TCP with a bad checksum:: +For PMD not supporting VLAN defaultly, we run an extra case:: + + 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 + vlan set filter on 0 + rx_vlan add 100 0 - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IPV6()/GRE()/IPV6()/TCP(chksum=0xf)/Raw(load=b'Z'), iface=iface) +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - port=0, mbuf=0x168cfce00, pkt_len=126, nb_segs=1: - rx: l2_len=4 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_BAD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - rx: outer_l2_len=14 outer_ethertype=800 outer_l3_len=20 - tx: m->l2_len=4 m->l3_len=20 m->l4_len=20 - tx: m->outer_l2_len=14 m->outer_l3_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 RTE_MBUF_F_TX_OUTER_IP_CKSUM RTE_MBUF_F_TX_OUTER_IPV4 RTE_MBUF_F_TX_TUNNEL_GRE + CSUM NON-TUNNEL VLAN PACKETS - Inspect the pcap file from the packet capture and verify the checksums. +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: -Test Case: Hardware Checksum Check L3 TX -=========================================== -This test involves testing L3 checksum hardware offload. -Due to the relative dominance of IPv4 and IPv6 as L3 protocols, and IPv6's -lack of a checksum, only IPv4's checksum is tested. + CSUM TUNNEL VLAN PACKETS -Setup the ``csum`` forwarding mode:: +Check for the correct checksum insertion at the correct place. - testpmd> set fwd csum - Set csum packet forwarding mode -Start the packet forwarding:: +Test case 10: SW non-tunneling (w/o VLAN) +========================================= - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set sctp hw 0 - testpmd> port start all - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 +This test is used to test tunneling scenario and will enable no checksum offload. +Configured in default. +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: -Start a packet capture on the tester in the background:: + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) - # tcpdump -i -s 65535 -w /tmp/tester/test_hardware_checksum_check_l3_tx_capture.pcap & +Check for the correct checksum insertion at the correct place. -Send a packet ptypes is IP/TCP with a good checksum with a 1 in it's payload:: +For PMD not supporting VLAN defaultly, we run an extra case:: + + vlan set filter on 0 + rx_vlan add 100 0 - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=0x7ccc)/TCP()/Raw(load=b'1'), iface=iface) +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: - port=0, mbuf=0x168d06200, pkt_len=60, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_GOOD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 + CSUM NON-TUNNEL VLAN PACKETS - Inspect the pcap file from the packet capture and verify the checksums. +Check for the correct checksum insertion at the correct place. -Send a packet ptypes is IP/TCP with a bad checksum with a 0 in it's payload:: - sendp(Ether(dst='23:00:00:00:00:00', src='52:00:00:00:00:00')/IP(chksum=0xf)/TCP()/Raw(load=b'1'), iface=iface) +Test case 11: SW tunneling (w/o VLAN, w/o AVX512) +================================================= - port=0, mbuf=0x168d06b40, pkt_len=60, nb_segs=1: - rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 flags=RTE_MBUF_F_RX_L4_CKSUM_GOOD RTE_MBUF_F_RX_IP_CKSUM_BAD RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN - tx: m->l2_len=14 m->l3_len=20 m->l4_len=20 - tx: flags=RTE_MBUF_F_TX_IP_CKSUM RTE_MBUF_F_TX_TCP_CKSUM RTE_MBUF_F_TX_IPV4 +Test for both default path and for AVX512 path by adding EAL Parameter '--force-max-simd-bitwidth=512'. - Inspect the pcap file from the packet capture and verify the checksums. +This test is used to test tunneling scenario and will enable no checksum offload. +Configure the TX HW Offload:: -Test Case: checksum offload with vlan -===================================== + csum parse-tunnel on 1 + rx_vxlan_port add 4789 0 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: -Setup the ``csum`` forwarding mode:: + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) - testpmd> set fwd csum - Set csum packet forwarding mode +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: -Enable the IPv4/UDP/TCP/SCTP checksum offload on port 0:: + CSUM TUNNEL PACKETS (common packets for common DDP) + CSUM TUNNEL VLAN PACKETS (for i40e and ice, common packets for common DDP) - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set sctp hw 0 - testpmd> port start all - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 +Check for the correct checksum insertion at the correct place. -Start a packet capture on the tester in the background:: +For PMD not supporting VLAN defaultly, we run an extra case:: + + csum parse-tunnel on 1 + vlan set filter on 0 + rx_vlan add 100 0 - tcpdump -i -s 65535 -w /tmp/tester/test_checksum_capture.pcap & +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: -Send the following multiple packets from tester for with scapy -combination: IPv4/UDP, IPv4/TCP, IPv6/UDP, IPv6/TCP:: + CSUM NON-TUNNEL VLAN PACKETS - sendp([Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/SCTP(chksum=0x0)/("X"*48), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46), - Ether(dst="52:00:00:00:00:01", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)], - iface="ens192f0",count=4,inter=0,verbose=False) +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 checksum, bad all checksum, good all checksum:: -Then verify that the same number of packet are correctly received on the tester. + CSUM TUNNEL VLAN PACKETS -Inspect the pcap file from the packet capture and verify the checksums. +Check for the correct checksum insertion at the correct place. From patchwork Tue Jul 18 01:26:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 129591 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 9ABF542E9F; Tue, 18 Jul 2023 03:26:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 951D5427F5; Tue, 18 Jul 2023 03:26:35 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 2ABA440223 for ; Tue, 18 Jul 2023 03:26:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689643594; x=1721179594; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=m1VwKM2qg57XOVn7eZDhFAsGn5kyns3eShDxmX4yLxc=; b=bqKpkCIxC/s2NWmmk3vi7BJ7qgNWtsVjBBDVjDTUlV19FsWS8Zye7igr bpG5LgguCW0r669zWiYH6X5KOvpHp+dsFvoipiNVTdL71ogWWsxdlMwUH JDIybhycCJZEAfEasUuTQFzYi4UXVcFY0CFz3hgqRKLpRmjHWK7xMEye8 UzxytoeA9kVsBj9vm8Zoeu6n+Ya55GuK8FrHbyVRCxHBNnv7e0cQU2OKY CysCOlJjxL1sLHI9pRqQc3U3qDpcxMgu3+/ZzbMQxvsko0ig7Jge7RWoR 5vsHHcOUq7q47RLEAkeE7/JcWuByFbWxhT9uftpW7UjySqABBcA3LbIVP Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="366119526" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="366119526" 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:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="837089805" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="837089805" Received: from dpdk-xuke-host.sh.intel.com ([10.67.114.220]) by fmsmga002.fm.intel.com with ESMTP; 17 Jul 2023 18:26:31 -0700 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, tarcadia@qq.com Subject: [DTS][Patch V2 2/6] tests/checksum_offload: Refactor checksum_offload case. Date: Tue, 18 Jul 2023 01:26:25 +0000 Message-Id: <20230718012629.2471811-3-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 checksum_offload scripts. 1. Using common test method from offload_common to 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. 2. Update cases for NIC comaptibility. Add description for VLAN 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_checksum_offload.py | 1788 ++++++++++++++------------- 1 file changed, 962 insertions(+), 826 deletions(-) diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py index 0214231c..206c8b1f 100644 --- a/tests/TestSuite_checksum_offload.py +++ b/tests/TestSuite_checksum_offload.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2010-2014 Intel Corporation +# Copyright(c) 2010-2023 Intel Corporation # Copyright(c) 2018-2019 The University of New Hampshire # @@ -26,32 +26,206 @@ from scapy.utils import rdpcap, wrpcap import framework.packet as packet import framework.utils as utils -from framework.exception import VerifyFailure +import tests.offload_common as offload +from framework.dut import Dut +from framework.exception import VerifyFailure, VerifySkip from framework.pktgen import PacketGeneratorHelper from framework.pmd_output import PmdOutput from framework.rst import RstReport from framework.settings import FOLDERS from framework.test_capabilities import DRIVER_TEST_LACK_CAPA -from framework.test_case import TestCase +from framework.test_case import ( + TestCase, + check_supported_nic, + skip_unsupported, + skip_unsupported_host_driver, + skip_unsupported_nic, + skip_unsupported_pkg, +) + +VM_CORES_MASK = "all" +DEFAULT_MTU = 1500 + +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) +] -l3_proto_classes = [IP, IPv6] +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/VXLAN", + "IPv6/VXLAN", + "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) +] -l4_proto_classes = [ - UDP, - TCP, +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", + "IPv6/VXLAN", + "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) ] -tunnelling_proto_classes = [ - VXLAN, - GRE, +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, + ] + for _ in range(offload.TX_REPEAT) ] -l3_protos = ["IP", "IPv6"] +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/VXLAN", + "VLAN/IPv6/VXLAN", + "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) +] -l4_protos = [ - "UDP", - "TCP", - "SCTP", +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", + "VLAN/IPv6/VXLAN", + "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) ] @@ -61,10 +235,24 @@ class TestChecksumOffload(TestCase): Run at the start of each test suite. Checksum offload prerequisites. """ + # Based on h/w type, choose how many ports to use self.dut_ports = self.dut.get_ports(self.nic) # Verify that enough ports are available self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing") + self.dut_pci = [ + self.dut.ports_info[self.dut_ports[0]]["pci"], + self.dut.ports_info[self.dut_ports[1]]["pci"], + ] + 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.bind_nic_driver(self.dut_ports, "vfio-pci") self.pmdout: PmdOutput = PmdOutput(self.dut) self.portMask = utils.create_mask([self.dut_ports[0]]) self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) @@ -77,624 +265,795 @@ class TestChecksumOffload(TestCase): # log debug used self.count = 0 + # supported packets + self.packets_csum_non_tunnel = [] + self.packets_csum_tunnel = [] + self.support_rx_tunnel = False + if self.kdriver in {"ice", "i40e"}: + self.packets_csum_non_tunnel.extend(CSUM_NON_TUNNEL_PACKETS) + self.packets_csum_non_tunnel.extend(CSUM_VLAN_NON_TUNNEL_PACKETS) + else: + self.packets_csum_non_tunnel.extend(CSUM_NON_TUNNEL_PACKETS) + if ( + self.kdriver in {"ice", "i40e"} + 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.support_rx_tunnel = True + elif self.kdriver in {"ice", "i40e"}: + self.packets_csum_tunnel.extend(CSUM_TUNNEL_PACKETS) + self.packets_csum_tunnel.extend(CSUM_VLAN_TUNNEL_PACKETS) + self.support_rx_tunnel = True + else: + self.packets_csum_tunnel.extend(CSUM_TUNNEL_PACKETS) + self.support_rx_tunnel = True + _pkgtype = self.pkg.get("type") + self.is_ice = self.kdriver == "ice" + self.is_ice_ddp_os = self.is_ice and _pkgtype and "os default" in _pkgtype.lower() + self.is_ice_ddp_comms = self.is_ice and _pkgtype and "comms" in _pkgtype.lower() + self.is_i40e = self.kdriver == "i40e" + def set_up(self): """ Run before each test case. """ - self.pmdout.start_testpmd( - "Default", - "--portmask=%s " % (self.portMask) - + " --enable-rx-cksum " - + "--port-topology=loop", - socket=self.ports_socket, - ) - self.dut.send_expect("set verbose 1", "testpmd>") - self.dut.send_expect("set fwd csum", "testpmd>") - self.dut.send_expect("csum mac-swap off 0", "testpmd>") - - def checksum_enablehw(self, port): - self.dut.send_expect("port stop all", "testpmd>") - self.dut.send_expect("rx_vxlan_port add 4789 0 ", "testpmd>") - self.dut.send_expect("csum set ip hw %d" % port, "testpmd>") - self.dut.send_expect("csum set udp hw %d" % port, "testpmd>") - self.dut.send_expect("csum set tcp hw %d" % port, "testpmd>") - self.dut.send_expect("csum set sctp hw %d" % port, "testpmd>") - self.dut.send_expect("csum set outer-ip hw %d" % port, "testpmd>") - self.dut.send_expect("csum set outer-udp hw %d" % port, "testpmd>") - self.dut.send_expect("csum parse-tunnel on %d" % port, "testpmd>") - self.dut.send_expect("port start all", "testpmd>") - - def checksum_enablesw(self, port): - self.dut.send_expect("port stop all", "testpmd>") - self.dut.send_expect("csum set ip sw %d" % port, "testpmd>") - self.dut.send_expect("csum set udp sw %d" % port, "testpmd>") - self.dut.send_expect("csum set tcp sw %d" % port, "testpmd>") - self.dut.send_expect("csum set sctp sw %d" % port, "testpmd>") - self.dut.send_expect("port start all", "testpmd>") - - def get_chksum_values(self, packets_expected): - """ - Validate the checksum flags. - """ - checksum_pattern = re.compile("chksum.*=.*(0x[0-9a-z]+)") - - chksum = dict() - - self.tester.send_expect("scapy", ">>> ") - - for packet_type in list(packets_expected.keys()): - self.tester.send_expect("p = %s" % packets_expected[packet_type], ">>>") - out = self.tester.send_command("p.show2()", timeout=1) - chksums = checksum_pattern.findall(out) - chksum[packet_type] = chksums - - self.tester.send_expect("exit()", "#") + pass - return chksum + def test_checksum_hw_ip(self): + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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, + ) - def checksum_valid_flags(self, packets_sent, flag): - """ - Sends packets and check the checksum valid-flags. - """ - self.dut.send_expect("start", "testpmd>") - tx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[0]) + def test_checksum_hw_udp(self): + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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, ) - for packet_type in list(packets_sent.keys()): - self.pkt = packet.Packet(pkt_str=packets_sent[packet_type]) - self.pkt.send_pkt(self.tester, tx_interface, count=4) - out = self.dut.get_session_output(timeout=1) - lines = out.split("\r\n") - # collect the checksum result - for line in lines: - line = line.strip() - if len(line) != 0 and line.startswith("rx"): - # IPv6 don't be checksum, so always show "GOOD" - if packet_type.startswith("IPv6"): - if "RTE_MBUF_F_RX_L4_CKSUM" not in line: - self.verify(0, "There is no checksum flags appeared!") - else: - if flag == 1: - self.verify( - "RTE_MBUF_F_RX_L4_CKSUM_GOOD" in line, - "Packet Rx L4 checksum valid-flags error!", - ) - elif flag == 0: - self.verify( - "RTE_MBUF_F_RX_L4_CKSUM_BAD" in line - or "RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN" in line, - "Packet Rx L4 checksum valid-flags error!", - ) - else: - if "RTE_MBUF_F_RX_L4_CKSUM" not in line: - self.verify(0, "There is no L4 checksum flags appeared!") - elif "RTE_MBUF_F_RX_IP_CKSUM" not in line: - self.verify(0, "There is no IP checksum flags appeared!") - else: - if flag == 1: - self.verify( - "RTE_MBUF_F_RX_L4_CKSUM_GOOD" in line, - "Packet Rx L4 checksum valid-flags error!", - ) - self.verify( - "RTE_MBUF_F_RX_IP_CKSUM_GOOD" in line, - "Packet Rx IP checksum valid-flags error!", - ) - elif flag == 0: - self.verify( - "RTE_MBUF_F_RX_L4_CKSUM_BAD" in line - or "RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN" in line, - "Packet Rx L4 checksum valid-flags error!", - ) - self.verify( - "RTE_MBUF_F_RX_IP_CKSUM_BAD" in line, - "Packet Rx IP checksum valid-flags error!", - ) + def test_checksum_hw_tcp(self): + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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, + ) - self.dut.send_expect("stop", "testpmd>") + def test_checksum_hw_sctp(self): + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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, + ) - 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_all(self): + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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, ) - rx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[0]) + + def test_checksum_tunnel_hw_outer_ip(self): + _ddp_type = self.pkg.get("type") + if self.kdriver == "ice" and (not _ddp_type or "os" in _ddp_type.lower()): + raise VerifySkip("OS Default DDP does not support this case") + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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", + "rx_vxlan_port add 4789 0", + "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=(not self.is_ice_ddp_comms), + allow_rx_bad_outer_l4=(not self.is_ice_ddp_comms), ) - sniff_src = "52:00:00:00:00:00" - result = dict() + def test_checksum_tunnel_hw_outer_udp(self): + _ddp_type = self.pkg.get("type") + if self.kdriver == "ice" and (not _ddp_type or "os" in _ddp_type.lower()): + raise VerifySkip("OS Default DDP does not support this case") + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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", + "rx_vxlan_port add 4789 0", + "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_bad_outer_udp=(not self.is_ice_ddp_comms), + allow_rx_bad_outer_l4=(not self.is_ice_ddp_comms), + ) - chksum = self.get_chksum_values(packets_expected) - inst = self.tester.tcpdump_sniff_packets( - intf=rx_interface, - count=len(packets_sent) * 4, - filters=[{"layer": "ether", "config": {"src": sniff_src}}], + def test_checksum_tunnel_hw_outer_sw_inner(self): + _ddp_type = self.pkg.get("type") + if self.kdriver == "ice" and (not _ddp_type or "os" in _ddp_type.lower()): + raise VerifySkip("OS Default DDP does not support this case") + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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", + "rx_vxlan_port add 4789 0", + "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_tx_bad_outer_udp=(not self.is_ice_ddp_comms), + allow_rx_bad_outer_l4=(not self.is_ice_ddp_comms), ) - self.pkt = packet.Packet() - for packet_type in list(packets_sent.keys()): - self.pkt.append_pkt(packets_sent[packet_type]) - self.pkt.send_pkt(crb=self.tester, tx_port=tx_interface, count=4) + def test_checksum_tunnel_hw_all(self): + _ddp_type = self.pkg.get("type") + if self.kdriver == "ice" and (not _ddp_type or "os" in _ddp_type.lower()): + raise VerifySkip("OS Default DDP does not support this case") + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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=self.packets_csum_non_tunnel + self.packets_csum_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_bad_outer_udp=(not self.is_ice_ddp_comms), + allow_rx_bad_outer_l4=(not self.is_ice_ddp_comms), + ) - p = self.tester.load_tcpdump_sniff_packets(inst) - nr_packets = len(p) - print(p) - packets_received = [ - p[i].sprintf("%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum%") - for i in range(nr_packets) + @check_supported_nic( + [ + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", ] - print(len(packets_sent), len(packets_received)) - self.verify( - len(packets_sent) * 4 == len(packets_received), "Unexpected Packets Drop" + ) + def test_checksum_tunnel_hw_all_avx512(self): + _ddp_type = self.pkg.get("type") + if self.kdriver == "ice" and (not _ddp_type or "os" in _ddp_type.lower()): + raise VerifySkip("OS Default DDP does not support this case") + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=512, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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=self.packets_csum_non_tunnel + self.packets_csum_tunnel, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_bad_outer_udp=(not self.is_ice_ddp_comms), + allow_rx_bad_outer_l4=(not self.is_ice_ddp_comms), ) - for packet_received in packets_received: - ( - ip_checksum, - tcp_checksum, - udp_checksum, - sctp_checksum, - ) = packet_received.split(";") - - packet_type = "" - l4_checksum = "" - if tcp_checksum != "??": - packet_type = "TCP" - l4_checksum = tcp_checksum - elif udp_checksum != "??": - packet_type = "UDP" - l4_checksum = udp_checksum - elif sctp_checksum != "??": - packet_type = "SCTP" - l4_checksum = sctp_checksum - - if ip_checksum != "??": - packet_type = "IP/" + packet_type - if chksum[packet_type] != [ip_checksum, l4_checksum]: - result[packet_type] = packet_type + " checksum error" - else: - packet_type = "IPv6/" + packet_type - if chksum[packet_type] != [l4_checksum]: - result[packet_type] = packet_type + " checksum error" - - return result - - def send_scapy_packet(self, packet: str): - itf = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) - - self.tester.scapy_foreground() - self.tester.scapy_append(f'sendp({packet}, iface="{itf}")') - return self.tester.scapy_execute() - - def get_pkt_rx_l4_cksum(self, testpmd_output: str) -> bool: - return self.checksum_flags_are_good("RTE_MBUF_F_RX_L4_CKSUM_", testpmd_output) - - def get_pkt_rx_ip_cksum(self, testpmd_output: str) -> bool: - return self.checksum_flags_are_good("RTE_MBUF_F_RX_IP_CKSUM_", testpmd_output) - - def send_pkt_expect_good_bad_from_flag( - self, pkt_str: str, flag: str, test_name: str, should_pass: bool = True - ): - self.pmdout.get_output(timeout=1) # Remove any old output - self.scapy_exec(f"sendp({pkt_str}, iface=iface)") - testpmd_output: str = self.pmdout.get_output(timeout=1) - self.verify( - flag in testpmd_output, - f"Flag {flag[:-1]} not found for test {test_name}, please run test_rx_checksum_valid_flags.", - ) - self.verify( - (flag + "UNKNOWN") not in testpmd_output, - f"Flag {flag[:-1]} was found to be unknown for test {test_name}, indicating a possible lack of support", + def test_checksum_sw_all(self): + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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, ) - if should_pass: - if flag + "GOOD" in testpmd_output: - return - else: # flag + "BAD" in testpmd_output - self.verify( - False, f"{flag}BAD was found in output, expecting {flag}GOOD." - ) - else: - if flag + "BAD" in testpmd_output: - return - else: # flag + "GOOD" in testpmd_output - self.verify( - False, f"{flag}GOOD was found in output, expecting {flag}BAD." - ) - def send_pkt_expect_good_bad_from_flag_catch_failure( - self, pkt_str: str, flag: str, test_name: str, should_pass: bool = True - ) -> Union[VerifyFailure, None]: - try: - self.send_pkt_expect_good_bad_from_flag( - pkt_str, flag, test_name, should_pass=should_pass - ) - except VerifyFailure as vf: - return vf - - return None - - def validate_checksum(self, pkt, pkt_type, inner_flag=False) -> bool: - """ - @param pkt: The packet to validate the checksum of. - @return: Whether the checksum was valid. - """ - if pkt is None: - return False - for i in range(0, len(l3_protos)): - if l3_protos[i] in pkt: - l3 = l3_protos[i] - for j in range(0, len(l4_protos)): - if l4_protos[j] in pkt: - layer = l4_proto_classes[j] - csum = pkt[layer].chksum - if csum is None: - csum = 0 - del pkt[layer].chksum - # Converting it to raw will calculate the checksum - correct_csum = layer(bytes(Raw(pkt[layer]))).chksum - if correct_csum == csum: - # checksum value is correct - return False - else: - if inner_flag: - print( - "{} pkg[{}] VXLAN/{}/{} inner checksum {} is not correct {}".format( - pkt_type, - self.count, - l3, - l4_protos[j], - hex(correct_csum), - hex(csum), - ) - ) - else: - print( - "{} pkg[{}] {}/{} outer checksum {} is not correct {}".format( - pkt_type, - self.count, - l3, - l4_protos[j], - hex(correct_csum), - hex(csum), - ) - ) - return True - return False - - def scapy_exec(self, cmd: str, timeout=1) -> str: - return self.tester.send_expect(cmd, ">>>", timeout=timeout) - - def get_packets(self, dut_mac, tester_mac): - eth = Ether(dst=dut_mac, src=tester_mac) - packets = [] - checksum_options = ( - {}, - {"chksum": 0xF}, + @skip_unsupported(reason="Tunnel SW checksum TX is not properly implemented.") + def test_checksum_tunnel_sw_all(self): + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=None, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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", + "rx_vxlan_port add 4789 0", + "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, ) - # Untunneled - for l3 in l3_proto_classes: - for l4 in l4_proto_classes: - for chksum in checksum_options: - # The packet's data can be used to identify how the packet was constructed so avoid any issues with - # ordering - pkt = eth / l3() / l4(**chksum) / (b"X" * 48) - # Prevents the default behavior which adds DNS headers - if l4 == UDP: - pkt[UDP].dport, pkt[UDP].sport = 1001, 1001 - packets.append(pkt) - # Tunneled - # VXLAN - for l3 in l3_proto_classes: - for l4 in l4_proto_classes: - for outer_arg in checksum_options: - for inner_arg in checksum_options: - pkt = ( - eth - / l3() - / UDP(**outer_arg) - / VXLAN() - / Ether() - / l3() - / l4(**inner_arg) - / (b"Y" * 48) - ) - # Prevents the default behavior which adds DNS headers - if l4 == UDP: - pkt[VXLAN][UDP].dport, pkt[VXLAN][UDP].sport = 1001, 1001 - packets.append(pkt) - # GRE - for l3 in l3_proto_classes: - for l4 in l4_proto_classes: - for chksum in checksum_options: - pkt = eth / l3() / GRE() / l3() / l4(**chksum) / (b"Z" * 48) - # Prevents the default behavior which adds DNS headers - if l4 == UDP: - pkt[GRE][UDP].dport, pkt[GRE][UDP].sport = 1001, 1001 - packets.append(pkt) - - return packets - - def send_tx_package( - self, packet_file_path, capture_file_path, packets, iface, dut_mac - ): - if os.path.isfile(capture_file_path): - os.remove(capture_file_path) - src_mac = "52:00:00:00:00:00" - self.tester.send_expect( - f"tcpdump -i '{iface}' ether src {src_mac} -s 0 -w {capture_file_path} -Q in &", - "# ", + @skip_unsupported(reason="Tunnel SW checksum TX is not properly implemented.") + @check_supported_nic( + [ + "ICE_100G-E810C_QSFP", + "ICE_25G-E810C_SFP", + "ICE_25G-E823C_QSFP", + "ICE_25G-E810_XXV_SFP", + ] + ) + def test_checksum_tunnel_sw_all_avx512(self): + offload.execute_test_checksum( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + testpmd_enable_dcf_0=False, + testpmd_enable_dcf_1=False, + testpmd_bitwidth=512, + testpmd_log_level={"ice": 7, "iavf": 8}, + 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", + "rx_vxlan_port add 4789 0", + "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, ) - if os.path.isfile(packet_file_path): - os.remove(packet_file_path) - wrpcap(packet_file_path, packets) - self.tester.session.copy_file_to(packet_file_path, packet_file_path) - - # send packet - self.tester.send_expect("scapy", ">>>") - self.scapy_exec(f"packets = rdpcap('{packet_file_path}')") - for i in range(0, len(packets)): - self.scapy_exec(f"packets[{i}].show") - self.scapy_exec(f"sendp(packets[{i}], iface='{iface}')") - self.pmdout.get_output(timeout=0.5) - self.dut.send_expect( - "show port stats {}".format(self.dut_ports[0]), "testpmd>" - ) - self.tester.send_expect("quit()", "# ") - - time.sleep(1) - self.tester.send_expect("killall tcpdump", "#") - time.sleep(1) - self.tester.send_expect('echo "Cleaning buffer"', "#") - time.sleep(1) - return - - def validate_packet_list_checksums(self, packets): - error_messages = [] - untunnelled_error_message = ( - f"un-tunneled checksum state for pkg[%s] with a invalid checksum." - ) - vxlan_error_message = ( - f"VXLAN tunnelled checksum state for pkg[%s] with a invalid checksum." - ) - gre_error_message = ( - f"GRE tunnelled checksum state for pkg[%s] with a invalid checksum." + @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_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.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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, ) - for packet in packets: - self.count = self.count + 1 - payload: str - # try: - payload = packet[Raw].load.decode("utf-8") - # # This error usually happens with tunneling protocols, and means that an additional cast is needed - # except UnicodeDecodeError: - # for proto in tunnelling_proto_classes: - if "X" in payload: - if self.validate_checksum(packet, "un-tunneled"): - error_messages.append(untunnelled_error_message % self.count) - elif "Y" in payload: - if self.validate_checksum( - packet[VXLAN][Ether], "VXLAN", inner_flag=True - ): - error_messages.append(vxlan_error_message % self.count) - # Intel® Ethernet 700 Series not support outer udp checksum - if self.is_eth_series_nic(700): - continue - if self.validate_checksum(packet, "VXLAN"): - error_messages.append(vxlan_error_message % self.count) - elif "Z" in payload: - if self.validate_checksum(packet, "GRE"): - error_messages.append(gre_error_message % self.count) - return error_messages - - # - # - # - # Test Cases - # - def test_checksum_offload_with_vlan(self): - """ - Do not insert IPv4/IPv6 UDP/TCP checksum on the transmit packet. - Verify that the same number of packet are correctly received on the - traffic generator side. - """ - # mac = self.dut.get_mac_address(self.dut_ports[0]) - mac = "52:00:00:00:00:01" - - pktsChkErr = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' - % mac, - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46)' - % mac, - "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IP(chksum=0x0)/SCTP(chksum=0x0)/("X"*48)' - % mac, - "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' - % mac, - "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/Dot1Q(vlan=1)/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' - % mac, - } - - pkts = { - "IP/UDP": 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IP(src="127.0.0.1")/UDP()/("X"*46)' - % mac, - "IP/TCP": 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IP(src="127.0.0.1")/TCP()/("X"*46)' - % mac, - "IP/SCTP": 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IP(src="127.0.0.1")/SCTP()/("X"*48)' - % mac, - "IPv6/UDP": 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IPv6(src="::1")/UDP()/("X"*46)' - % mac, - "IPv6/TCP": 'Ether(dst="02:00:00:00:00:00", src="%s")/Dot1Q(vlan=1)/IPv6(src="::1")/TCP()/("X"*46)' - % mac, - } - - if self.kdriver in DRIVER_TEST_LACK_CAPA["sctp_tx_offload"]: - del pktsChkErr["IP/SCTP"] - del pkts["IP/SCTP"] - - self.checksum_enablehw(self.dut_ports[0]) - self.dut.send_expect("start", "testpmd>") - result = self.checksum_validate(pktsChkErr, pkts) - self.dut.send_expect("stop", "testpmd>") - self.verify(len(result) == 0, ",".join(list(result.values()))) - - def test_rx_checksum_valid_flags(self): - """ - Insert right and wrong IPv4/IPv6 UDP/TCP/SCTP checksum on the - transmit packet.Enable Checksum offload. - Verify the checksum valid-flags. - """ - mac = "52:00:00:00:00:01" - - pkts_ref = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP()/UDP()/("X"*46)' - % mac, - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="10.0.0.1")/TCP()/("X"*46)' - % mac, - "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="10.0.0.1")/SCTP()/("X"*48)' - % mac, - "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP()/("X"*46)' - % mac, - "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP()/("X"*46)' - % mac, - } - - self.checksum_enablehw(self.dut_ports[0]) - - # get the packet checksum value - result = self.get_chksum_values(pkts_ref) - - # set the expected checksum values same with the actual values - pkts_good = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=int(%s))/UDP(chksum=int(%s))/("X"*46)' - % (mac, result["IP/UDP"][0], result["IP/UDP"][1]), - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="10.0.0.1",chksum=int(%s))/TCP(chksum=int(%s))/("X"*46)' - % (mac, result["IP/TCP"][0], result["IP/TCP"][1]), - "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="10.0.0.1",chksum=int(%s))/SCTP(chksum=int(%s))/("X"*48)' - % (mac, result["IP/SCTP"][0], result["IP/SCTP"][1]), - "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=int(%s))/("X"*46)' - % (mac, result["IPv6/UDP"][0]), - "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=int(%s))/("X"*46)' - % (mac, result["IPv6/TCP"][0]), - } - - # set the expected checksum values different from the actual values - pkts_bad = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' - % mac, - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="10.0.0.1",chksum=0x0)/TCP(chksum=0xf)/("X"*46)' - % mac, - "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="10.0.0.1",chksum=0x0)/SCTP(chksum=0xf)/("X"*48)' - % mac, - "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' - % mac, - "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' - % mac, - } - - if self.kdriver in DRIVER_TEST_LACK_CAPA["sctp_tx_offload"]: - del pkts_good["IP/SCTP"] - del pkts_bad["IP/SCTP"] - del pkts_ref["IP/SCTP"] - - # send the packet checksum value same with the expected value - self.checksum_valid_flags(pkts_good, 1) - # send the packet checksum value different from the expected value - self.checksum_valid_flags(pkts_bad, 0) - - def test_insert_checksum_on_the_transmit_packet(self): - """ - Insert IPv4/IPv6 UDP/TCP/SCTP checksum on the transmit packet. - Enable Checksum offload. - Verify that the same number of packet are correctly received on the - traffic generator side. - """ - mac = "52:00:00:00:00:01" - - pkts = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/UDP(chksum=0xf)/("X"*46)' - % mac, - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/TCP(chksum=0xf)/("X"*46)' - % mac, - "IP/SCTP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(chksum=0x0)/SCTP(chksum=0x0)/("X"*48)' - % mac, - "IPv6/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/UDP(chksum=0xf)/("X"*46)' - % mac, - "IPv6/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)' - % mac, - } - - pkts_ref = { - "IP/UDP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.1")/UDP()/("X"*46)' - % mac, - "IP/TCP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.1")/TCP()/("X"*46)' - % mac, - "IP/SCTP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IP(src="127.0.0.1")/SCTP()/("X"*48)' - % mac, - "IPv6/UDP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="::1")/UDP()/("X"*46)' - % mac, - "IPv6/TCP": 'Ether(dst="02:00:00:00:00:00", src="%s")/IPv6(src="::1")/TCP()/("X"*46)' - % mac, - } - - if self.kdriver in DRIVER_TEST_LACK_CAPA["sctp_tx_offload"]: - del pkts["IP/SCTP"] - del pkts_ref["IP/SCTP"] - - self.checksum_enablehw(self.dut_ports[0]) - - self.dut.send_expect("start", "testpmd>") - - result = self.checksum_validate(pkts, pkts_ref) - - self.dut.send_expect("stop", "testpmd>") - - self.verify(len(result) == 0, ",".join(list(result.values()))) + @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_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.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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 outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=CSUM_VLAN_NON_TUNNEL_PACKETS + CSUM_VLAN_TUNNEL_PACKETS, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + ) - def test_do_not_insert_checksum_on_the_transmit_packet(self): - """ - Do not insert IPv4/IPv6 UDP/TCP checksum on the transmit packet. - Disable Checksum offload. - Verify that the same number of packet are correctly received on - the traffic generator side. - """ - mac = "52:00:00:00:00:01" - sndIP = "10.0.0.1" - sndIPv6 = "::1" - sndPkts = { - "IP/UDP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/UDP(chksum=0xf)/("X"*46)' - % (mac, sndIP), - "IP/TCP": 'Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="%s",chksum=0x0)/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), - } + @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_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.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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", + "csum set outer-ip hw 1", + "csum set outer-udp hw 1", + "csum parse-tunnel on 1", + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=CSUM_VLAN_NON_TUNNEL_PACKETS + CSUM_VLAN_TUNNEL_PACKETS, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + ) - 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), - } + @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.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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 + CSUM_VLAN_NON_TUNNEL_PACKETS, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + ) - self.dut.send_expect("start", "testpmd>") - result = self.checksum_validate(sndPkts, expPkts) + @skip_unsupported(reason="Tunnel SW checksum TX is not properly implemented.") + @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_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.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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 parse-tunnel on 1", + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=CSUM_VLAN_NON_TUNNEL_PACKETS + CSUM_VLAN_TUNNEL_PACKETS, + packet_interval=offload.TX_INTERVAL, + support_rx_tunnel=self.support_rx_tunnel, + allow_tx_zero_inner_sctp=True, + ) - self.verify(len(result) == 0, ",".join(list(result.values()))) + def checksum_enablehw(self, port): + self.dut.send_expect("port stop all", "testpmd>") + self.dut.send_expect("rx_vxlan_port add 4789 0 ", "testpmd>") + self.dut.send_expect("csum set ip hw %d" % port, "testpmd>") + self.dut.send_expect("csum set udp hw %d" % port, "testpmd>") + self.dut.send_expect("csum set tcp hw %d" % port, "testpmd>") + self.dut.send_expect("csum set sctp hw %d" % port, "testpmd>") + self.dut.send_expect("csum set outer-ip hw %d" % port, "testpmd>") + self.dut.send_expect("csum set outer-udp hw %d" % port, "testpmd>") + self.dut.send_expect("csum parse-tunnel on %d" % port, "testpmd>") + self.dut.send_expect("port start all", "testpmd>") - self.dut.send_expect("stop", "testpmd>") + def checksum_enablesw(self, port): + self.dut.send_expect("port stop all", "testpmd>") + self.dut.send_expect("csum set ip sw %d" % port, "testpmd>") + self.dut.send_expect("csum set udp sw %d" % port, "testpmd>") + self.dut.send_expect("csum set tcp sw %d" % port, "testpmd>") + self.dut.send_expect("csum set sctp sw %d" % port, "testpmd>") + self.dut.send_expect("port start all", "testpmd>") def benchmark(self, lcore, ptype, mode, flow_format, size_list, nic): """ @@ -810,236 +1169,13 @@ class TestChecksumOffload(TestCase): self.dut.send_expect("quit", "#", 10) self.result_table_print() - def test_hardware_checksum_check_ip_rx(self): - self.tester.send_expect("scapy", ">>>") - self.checksum_enablehw(self.dut_ports[0]) - self.dut.send_expect("start", "testpmd>") - self.pmdout.wait_link_status_up(self.dut_ports[0]) - verification_errors: List[VerifyFailure] = [] - - iface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) - dut_mac = "52:00:00:00:00:01" - tester_mac = "52:00:00:00:00:00" - self.scapy_exec(f"eth = Ether(dst='{dut_mac}', src='{tester_mac}')") - self.scapy_exec(f"iface = '{iface}'") - - # Untunnelled - for l4 in l4_protos: - for chksum in "", "chksum=0xf": - vf = self.send_pkt_expect_good_bad_from_flag_catch_failure( - f"eth/IP({chksum})/{l4}()/('X'*50)", - "RTE_MBUF_F_RX_IP_CKSUM_", - f"{l4}", - should_pass=(chksum == ""), - ) - if vf is not None: - verification_errors.append(vf) - - for err in verification_errors: - self.logger.error(str(err)) - self.verify(len(verification_errors) == 0, "See previous output") - - self.tester.send_expect("quit()", "# ") - self.dut.send_expect("stop", "testpmd>") - - def test_hardware_checksum_check_ip_tx(self): - self.checksum_enablehw(self.dut_ports[0]) - self.dut.send_expect("start", "testpmd>") - self.pmdout.wait_link_status_up(self.dut_ports[0]) - verification_errors: List[VerifyFailure] = [] - - iface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) - dut_mac = "52:00:00:00:00:01" - tester_mac = "52:00:00:00:00:00" - eth = Ether(dst=dut_mac, src=tester_mac) - - checksum_options = ( - {}, - {"chksum": 0xF}, - ) - - packets = [ - eth / IP(**chksum) / TCP() / Raw(load=str(int(len(chksum) != 1))) - for chksum in checksum_options - ] - - capture_file_name = "test_hardware_checksum_check_l3_tx_capture.pcap" - - packet_file_path = "/tmp/test_hardware_checksum_check_l3_tx_packets.pcap" - capture_file_path = "/tmp/tester/" + capture_file_name - - self.send_tx_package( - packet_file_path, capture_file_path, packets, iface, dut_mac - ) - - self.tester.session.copy_file_from( - capture_file_path, "output/tmp/pcap/" + capture_file_name - ) - captured_packets = rdpcap("output/tmp/pcap/" + capture_file_name) - - self.verify( - len(packets) == len(captured_packets), "Not all packets were received" - ) - - error_messages = [] - for pkt in captured_packets: - should_pass = pkt[TCP].payload.build() == b"1" - if not (self.validate_checksum(pkt, IP) == should_pass): - error_messages.append( - f"A packet was marked as having a" - f"{' valid' if should_pass == '' else 'n invalid'}" - f" checksum when it should have had the opposite." - ) - - self.dut.send_expect("stop", "testpmd>") - if len(error_messages) != 0: - for error_msg in error_messages: - self.logger.error(error_msg) - self.verify(False, "See prior output") - - def test_hardware_checksum_check_l4_rx(self): - self.checksum_enablehw(self.dut_ports[0]) - self.dut.send_expect("start", "testpmd>") - self.pmdout.wait_link_status_up("all") - verification_errors: List[VerifyFailure] = [] - - iface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) - dut_mac = "52:00:00:00:00:01" - tester_mac = "52:00:00:00:00:00" - self.tester.send_expect("scapy", ">>> ") - self.scapy_exec(f"eth = Ether(dst='{dut_mac}', src='{tester_mac}')") - self.scapy_exec(f"iface = '{iface}'") - # Untunneled - for l3 in l3_protos: - for l4 in l4_protos: - for chksum in "", "chksum=0xf": - vf = self.send_pkt_expect_good_bad_from_flag_catch_failure( - f"eth/{l3}()/{l4}({chksum})/('X'*48)", - "RTE_MBUF_F_RX_L4_CKSUM_", - f"{l3}/{l4}", - should_pass=(chksum == ""), - ) - if vf is not None: - verification_errors.append(vf) - - # Tunneled - # VXLAN - for l3 in l3_protos: - for l4 in l4_protos: - for outer_arg in "", "chksum=0xf": - for inner_arg in "", "chksum=0xf": - for flag in ( - "RTE_MBUF_F_RX_L4_CKSUM_", - "RTE_MBUF_F_RX_OUTER_L4_CKSUM_", - ): - if flag == "RTE_MBUF_F_RX_L4_CKSUM_": - should_pass = inner_arg == "" - else: # flag == RTE_MBUF_F_RX_OUTER_L4_CKSUM_ - # Intel® Ethernet 700 Series not support outer checksum - if self.is_eth_series_nic(700): - continue - should_pass = outer_arg == "" - vf = self.send_pkt_expect_good_bad_from_flag_catch_failure( - f"eth/{l3}()/UDP(dport=4789,{outer_arg})/VXLAN()/eth/{l3}()/" - f"{l4}({inner_arg})/('X'*48)", - flag, - f"{l3}/UDP/VXLAN/{l3}/{l4}", - should_pass=should_pass, - ) - - if vf is not None: - verification_errors.append(vf) - - # GRE - for l3 in l3_protos: - for l4 in l4_protos: - for inner_arg in "", "chksum=0xf": - should_pass: bool = inner_arg == "" - vf = self.send_pkt_expect_good_bad_from_flag_catch_failure( - f"eth/{l3}()/GRE()/{l3}()/{l4}({inner_arg})/('X'*48)", - "RTE_MBUF_F_RX_L4_CKSUM_", - f"{l3}/GRE/{l3}/{l4}", - should_pass=should_pass, - ) - - if vf is not None: - verification_errors.append(vf) - - # This section is commented out because GENEVE is not supported in the current version (2.3.3) that is used - # in dts. This will be available in scapy 2.4.3, so this was added and commented out so that when scapy is - # updated this test case can easily take advantage of the new functionality. - - # # GENEVE - # # This import is over here so that it is not forgotten when the update happens - # from scapy.contrib.geneve import GENEVE - # for l3_outer in l3_protos: - # for l4_outer in l4_protos: - # for l3_inner in l3_protos: - # for l4 in l4_protos: - # for outer_arg in "", "chksum=0xf": - # for inner_arg in "", "chksum=0xf": - # for flag in "RTE_MBUF_F_RX_L4_CKSUM_", "RTE_MBUF_F_RX_OUTER_L4_CKSUM_": - # should_pass: bool = inner_arg == "" if flag == "RTE_MBUF_F_RX_L4_CKSUM_" else outer_arg == "" - # vf = self.send_pkt_expect_good_bad_from_flag_catch_failure( - # f"eth/{l3_outer}()/{l4_outer}({outer_arg})/GENEVE()/eth/{l3_inner}()/" - # f"{l4}({inner_arg})/('X'*50)", - # flag, f"{l3_outer}/{l4_outer}/VXLAN/{l3_inner}/{l4}", - # should_pass=should_pass) - # - # if vf is not None: - # verification_errors.append(vf) - - self.tester.send_expect("quit()", "#") - self.dut.send_expect("stop", "testpmd>") - - for err in verification_errors: - self.logger.error(str(err)) - self.verify(len(verification_errors) == 0, "See previous output") - - def test_hardware_checksum_check_l4_tx(self): - self.checksum_enablehw(self.dut_ports[0]) - self.dut.send_expect("start", "testpmd>") - self.pmdout.wait_link_status_up("all") - verification_errors: List[VerifyFailure] = [] - - iface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])) - dut_mac = "52:00:00:00:00:01" - tester_mac = "52:00:00:00:00:00" - packets = self.get_packets(dut_mac, tester_mac) - - capture_file_name = "test_hardware_checksum_check_l4_tx_capture.pcap" - - packet_file_path = "/tmp/test_hardware_checksum_check_l4_tx_packets.pcap" - capture_file_path = "/tmp/tester/" + capture_file_name - - self.send_tx_package( - packet_file_path, capture_file_path, packets, iface, dut_mac - ) - - self.tester.session.copy_file_from( - capture_file_path, "output/tmp/pcap/" + capture_file_name - ) - - captured_packets = rdpcap("output/tmp/pcap/" + capture_file_name) - self.verify( - len(packets) == len(captured_packets), "Not all packets were received" - ) - - self.dut.send_expect("stop", "testpmd>") - - self.count = 0 - error_messages = self.validate_packet_list_checksums(captured_packets) - - if len(error_messages) != 0: - for error_msg in error_messages: - self.logger.error(error_msg) - self.verify(False, "See prior output") - def tear_down(self): """ Run after each test case. """ - self.dut.send_expect("quit", "#") + self.dut.send_expect("quit", "# ") + self.dut.kill_all() + time.sleep(2) def tear_down_all(self): """ From patchwork Tue Jul 18 01:26:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 129592 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 CFA0E42E9F; Tue, 18 Jul 2023 03:26:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9D1242D17; Tue, 18 Jul 2023 03:26:37 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id B921D42D0D for ; Tue, 18 Jul 2023 03:26:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689643595; x=1721179595; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l9qYk8osGN2X7U3LeMvHNz8N+XS/TbBH9yGCorKlyHM=; b=h3SfYD/RzR3NNuN2gIFRJEHmQj8PjZP+Q1qPfJt8r/cnW2qIR4cg28La P5P1w4pS+xDcNTPifA+yO0xXBXmaimAChx05xV01VdobFr5H7a5JIzTTi sbDio5xH7iv/0GyT3h1VaZk++B5oOM8W50v0ad97Z6JtNb1iGxa1q/0P9 8aVxrtYRLMfb7hzAirUhR/P6ZMJ8ZZD3sblMTRxU5XX7cRBWCdDKSxmos IiDaUZQlcvp0/W8pUXgf+OhM1ha/bLXyTklc7htVHwHWjGMlaJ6M4pV54 AjE+sUWQzOe+0Jx4FeJwg5sqwJOwBaxKZLk1EyGc1w4AOovHfZtS+9p/n Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="366119530" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="366119530" 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:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="837089810" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="837089810" Received: from dpdk-xuke-host.sh.intel.com ([10.67.114.220]) by fmsmga002.fm.intel.com with ESMTP; 17 Jul 2023 18:26:33 -0700 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, tarcadia@qq.com Subject: [DTS][Patch V2 3/6] test_plans/tso: Refactor TSO case. Date: Tue, 18 Jul 2023 01:26:26 +0000 Message-Id: <20230718012629.2471811-4-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 tso testplan. 1. Add Common test steps and packet organization table to better show the test steps. 2. Updated test cases and test scopes. Covering TSO tunnel, non-tunnel and combined scenario seperately. 3. Update cases for NIC comaptibility. Add description for VLAN, DCF VxLAN and AVX512 to fit specific testing scenarios required by several NICs. 4. 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 --- test_plans/tso_test_plan.rst | 489 ++++++++++++++++++++++++++--------- 1 file changed, 366 insertions(+), 123 deletions(-) diff --git a/test_plans/tso_test_plan.rst b/test_plans/tso_test_plan.rst index e5122bb9..19b6a116 100644 --- a/test_plans/tso_test_plan.rst +++ b/test_plans/tso_test_plan.rst @@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright(c) 2015-2017 Intel Corporation + Copyright(c) 2015-2023 Intel Corporation ========================================= Transmit Segmentation Offload (TSO) Tests @@ -10,23 +10,56 @@ Description This document provides the plan for testing the TSO (Transmit Segmentation Offload, also called Large Send offload - LSO) feature of -Intel Ethernet Controller, including Intel 82599 10GbE Ethernet Controller and -Intel® Ethernet Converged Network Adapter XL710-QDA2. TSO enables the TCP/IP stack to +Intel Ethernet Controller, including Intel 82599 10GbE Ethernet Controller, +Intel® Ethernet Converged Network Adapter 700 Series and Intel® Ethernet Converged +Network Adapter 800 Series. TSO enables the TCP/IP stack to pass to the network device a larger ULP datagram than the Maximum Transmit Unit Size (MTU). NIC divides the large ULP datagram to multiple segments according to the MTU size. +The support of TX TSO features by Poll Mode Drivers consists in: + +On the TX side: + +- TCP/UDP segmentation. +- Tunneled inner TCP/UDP segmentation. + +RX/TX side, the TSO can be enabled with the following command of the ``testpmd`` application and running in tx +checksum mode with enabled checksum support:: + + set fwd csum + csum set ... + tso set + tunnel_tso set + +Please notice here that in DPDK TSO refers to both TCP Segmentation Offload (TSO) +and UDP Fragmentation Offload (UFO). DPDK TSO is also different from Generic Segmentation +Offload (GSO) for there is a GSO lib implemented elsewhere in DPDK. We will use TSO and UFO +to descripe packets and test steps, but only TSO configurations on ``testpmd`` are involved. + +The transmission of packet is done with the ``start`` command of the ``testpmd`` +application that will receive packets and then transmit the packet out on all +configured ports. Prerequisites ============= -Hardware: - Intel® Ethernet 700 Series, Intel® Ethernet 800 Series and 82599/500 Series +Topology +-------- + + dut_port_0 <---> tester_port_0 + + dut_port_1 <---> tester_port_1 + +Software +-------- -The DUT must take one of the Ethernet controller ports connected to a port on another -device that is controlled by the Scapy packet generator. + - dpdk: http://dpdk.org/git/dpdk + - scapy: http://www.secdev.org/projects/scapy/ + +Configuration and Setup +----------------------- -The Ethernet interface identifier of the port that Scapy will use must be known. On tester, all offload feature should be disabled on tx port, and start rx port capture:: ifconfig mtu 9000 @@ -48,121 +81,331 @@ and checksum on rx port. The test commands is below:: # enable TSO on tx port *tso set 800 1 - -Test case: csum fwd engine, use TSO -=================================== - -This test uses ``Scapy`` to send out one large TCP package. The dut forwards package -with TSO enable on tx port while rx port turns checksum on. After package send out -by TSO on tx port, the tester receives multiple small TCP package. - -Turn off tx port by ethtool on tester:: - - ethtool -K rx off tx off tso off gso off gro off lro off - ip l set up - -capture package rx port on tester:: - - tcpdump -n -e -i -s 0 -w /tmp/cap - -Launch the userland ``testpmd`` application on DUT as follows:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0xffffffff -n 2 -- -i --rxd=512 --txd=512 - --burst=32 --rxfreet=64 --mbcache=128 --portmask=0x3 --txpt=36 --txht=0 --txwt=0 - --txfreet=32 --txrst=32 --enable-rx-cksum - testpmd> set verbose 1 - # should stop ports before set csum and start ports after the settings - testpmd> port stop all - # enable hw checksum on rx port - testpmd> csum set ip hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set sctp hw 0 - testpmd> csum set outer-ip hw 0 - testpmd> csum parse-tunnel on 0 - # enable TSO on tx port - testpmd> tso set 800 1 - # set fwd engine and start - testpmd> set fwd csum - testpmd> port start all - testpmd> set promisc all off - testpmd> start - -Test IPv4() in scapy:: - - sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=1021)/Raw(load="\x50"*%s)], iface="%s") - -Test IPv6() in scapy:: - - sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/UDP(sport=1021,dport=1021)/Raw(load="\x50"*%s)], iface="%s" - -Test case: csum fwd engine, use TSO tunneling -============================================= -not support nic: IXGBE_10G-82599_SFP, IGC-I225_LM, IGC-I226_LM. - -This test uses ``Scapy`` to send out one large TCP package. The dut forwards package -with TSO enable on tx port while rx port turns checksum on. After package send out -by TSO on tx port, the tester receives multiple small TCP package. - -Turn off tx port by ethtool on tester:: - - ethtool -K rx off tx off tso off gso off gro off lro off - ip l set up - -capture package rx port on tester:: - - tcpdump -n -e -i -s 0 -w /tmp/cap - -Launch the userland ``testpmd`` application on DUT as follows:: - - ./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c 0xffffffff -n 2 -- -i --rxd=512 --txd=512 - --burst=32 --rxfreet=64 --mbcache=128 --portmask=0x3 --txpt=36 --txht=0 --txwt=0 - --txfreet=32 --txrst=32 --enable-rx-cksum - testpmd> set verbose 1 - - testpmd> port stop all - # enable hw checksum on rx port - testpmd> csum set ip hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set sctp hw 0 - testpmd> csum set outer-ip hw 0 - #Intel® Ethernet 700 Series not support outer udp - testpmd> csum set outer-udp hw 0 - testpmd> csum parse-tunnel on 0 - - # enable hw checksum on tx port - testpmd> csum set ip hw 1 - testpmd> csum set udp hw 1 - testpmd> csum set tcp hw 1 - testpmd> csum set sctp hw 1 - #csum set outer-ip must be set to hw if outer L3 is IPv4 - testpmd> csum set outer-ip hw 1 - #csum parse-tunnel must be set so that tunneled packets are recognized - testpmd> csum parse-tunnel on 1 - #Intel® Ethernet 700 Series not support outer udp - testpmd> csum set outer-udp hw 1 - - # enable TSO on tx port - testpmd> tunnel_tso set 800 1 - # enable VXLAN protocol on ports - testpmd> rx_vxlan_port add 4789 0 - # set fwd engine and start - testpmd> set fwd csum - testpmd> port start all - testpmd> set promisc all off - testpmd> start - -Test vxlan() in scapy:: - - sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=4789)/VXLAN(vni=1234)/Ether(dst=%s,src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=1021)/Raw(load="\x50"*%s)], iface="%s" - -Test nvgre() in scapy:: - - sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/GRE(key_present=1,proto=0x6558,key=0x00001000)/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s") - -Test case: TSO performance -========================== +Common test steps +================= + +This test uses ``Scapy`` to send out large TCP/UDP packages. The dut forwards packages +with checksum offload and TSO enabled on tx port. After package send out by TSO on tx port, +the tester receives multiple small TCP/UDP packages and verify them along with the verbose +and stats. + +1. launch test-pmd to enable RX Checksum offload and for some NIC it enables a general set of RX Offloads:: + + ./dpdk/x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c <...> -n <...> -a <...> -- -i --enable-rx-cksum + +2. config testpmd:: + + set csum fwd mode and stop all port:: + + testpmd> set fwd csum + testpmd> port stop all + + Modify the following commands to configure checksum offload according to the test scenario of each case: + + testpmd> csum set ip|tcp|udp|sctp|outer-ip|outer-udp hw|sw port_id + + start all ports and fwd: + + testpmd> port start all + testpmd> set verbose 1 + testpmd> start + +3. start to capture packets on tester:: + + tester: tcpdump -i -Q in -e ether src 52:00:00:00:00:00 -w /tmp/ens10.pcap + +4. send packets with scapy:: + + Configure the packet generator to send multiple combinations of inner and outer packet parts + according to the test scenario of each case, refer to the following table: + ++------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| Packet Types | Packet Names | Packet organizations | ++==================+===========================+==============================================================================================================================+ +| | IP/UDP | IP(src="10.0.0.1") / UDP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IP/TCP | IP(src="10.0.0.1") / TCP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IP/SCTP | IP(src="10.0.0.1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IPv6/UDP | IPv6(src="::1") / UDP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IPv6/TCP | IPv6(src="::1") / TCP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| Inner Parts | IPv6/SCTP | IPv6(src="::1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IP/UDP | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IP/TCP | Dot1Q(vlan=100) / IP(src="10.0.0.1") / TCP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IP/SCTP | Dot1Q(vlan=100) / IP(src="10.0.0.1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IPv6/UDP | Dot1Q(vlan=100) / IPv6(src="::1") / UDP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IPv6/TCP | Dot1Q(vlan=100) / IPv6(src="::1") / TCP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IPv6/SCTP | Dot1Q(vlan=100) / IPv6(src="::1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(PAYLOAD_SIZE)) | ++------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/VXLAN | IP(src="10.0.0.1") / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/VXLAN | IPv6() / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/VXLAN-GPE | IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/VXLAN-GPE | IPv6() / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/VXLAN-GPE/Ether | IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/VXLAN-GPE/Ether | IPv6() / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GRE | IP(src="10.0.0.1", proto=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GRE | IPv6(nh=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GRE/Ether | IP(src="10.0.0.1", proto=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GRE/Ether | IPv6(nh=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/NVGRE | IP(src="10.0.0.1", proto=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/NVGRE | IPv6(nh=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GTPU | IP(src="10.0.0.1") / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GTPU | IPv6() / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GENEVE | IP(src="10.0.0.1") / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GENEVE | IPv6() / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP | IP(src="10.0.0.1") | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| Outer Parts |IPv6 | IPv6() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/VXLAN | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/VXLAN | Dot1Q(vlan=100) / IPv6() / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/VXLAN-GPE | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/VXLAN-GPE | Dot1Q(vlan=100) / IPv6() / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/VXLAN-GPE/Ether | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/VXLAN-GPE/Ether | Dot1Q(vlan=100) / IPv6() / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GRE | Dot1Q(vlan=100) / IP(src="10.0.0.1", proto=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GRE | Dot1Q(vlan=100) / IPv6(nh=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GRE/Ether | Dot1Q(vlan=100) / IP(src="10.0.0.1", proto=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GRE/Ether | Dot1Q(vlan=100) / IPv6(nh=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/NVGRE | Dot1Q(vlan=100) / IP(src="10.0.0.1", proto=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/NVGRE | Dot1Q(vlan=100) / IPv6(nh=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GTPU | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GTPU | Dot1Q(vlan=100) / IPv6() / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GENEVE | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GENEVE | Dot1Q(vlan=100) / IPv6() / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP | Dot1Q(vlan=100) / IP(src="10.0.0.1") | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6 | Dot1Q(vlan=100) / IPv6() | ++------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------+ + ++------------------+------------------+----------------------------+ +| Scenarios | Packet Types | Packet Names | ++==================+==================+============================+ +| TSO NON-TUNNEL | | IP/TCP | +| PACKETS | Inner parts +----------------------------+ +| | | IPv6/TCP | ++------------------+------------------+----------------------------+ +| | | IP/VXLAN-GPE | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE | +| | +----------------------------+ +| | | IP/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IP/GRE | +| | +----------------------------+ +| TSO TUNNEL | Outer parts | IPv6/GRE | +| PACKETS | +----------------------------+ +| | | IP/GRE/Ether | +| | +----------------------------+ +| | | IPv6/GRE/Ether | +| | +----------------------------+ +| | | IP/NVGRE | +| | +----------------------------+ +| | | IPv6/NVGRE | +| | +----------------------------+ +| | | IP/GTPU | +| | +----------------------------+ +| | | IPv6/GTPU | +| +------------------+----------------------------+ +| | | IP/TCP | +| | Inner parts +----------------------------+ +| | | IPv6/TCP | ++------------------+------------------+----------------------------+ +| UFO NON-TUNNEL | | IP/UDP | +| PACKETS | Inner parts +----------------------------+ +| | | IPv6/UDP | ++------------------+------------------+----------------------------+ +| | | IP/VXLAN-GPE | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE | +| | +----------------------------+ +| | | IP/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IP/GRE | +| | +----------------------------+ +| UFO TUNNEL | Outer parts | IPv6/GRE | +| PACKETS | +----------------------------+ +| | | IP/GRE/Ether | +| | +----------------------------+ +| | | IPv6/GRE/Ether | +| | +----------------------------+ +| | | IP/NVGRE | +| | +----------------------------+ +| | | IPv6/NVGRE | +| | +----------------------------+ +| | | IP/GTPU | +| | +----------------------------+ +| | | IPv6/GTPU | +| +------------------+----------------------------+ +| | | IP/UDP | +| | Inner parts +----------------------------+ +| | | IPv6/UDP | ++------------------+------------------+----------------------------+ + +5. stop capture packets and then stop fwd:: + + tester: pkill tcpdump + dut: testpmd> stop + +6. check rx and tx statistics according to the expected segmented packets. + ++------------------+-------------------------------------------------------------------+ +| entry | checkpoint | ++==================+===================================================================+ +| RX-packets | `RX-packets` = Num of sent packets | ++------------------+-------------------------------------------------------------------+ +| RX-total | `RX-total` = Num of sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-ipcsum | `Bad-ipcsum` = Sum of bad inner IP checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-l4csum | `Bad-l4csum` = Sum of bad inner L4 checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-outer-ipcsum | `Bad-outer-ipcsum` = Sum of bad outer IP checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-outer-l4csum | `Bad-outer-l4csum` = Sum of bad outer L4 checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| TX-packets | `TX-packets` = Sum of segmented packets | ++------------------+-------------------------------------------------------------------+ +| TX-total | `TX-total` = Sum of segmented packets | ++------------------+-------------------------------------------------------------------+ + + Read pcap files with scapy and check if configured checksum values to insert of tx_packets are all correct:: + + >>> tx_pkts = rdpcap("/tmp/ens10.pcap") # tx_packets is of list of all tx pkts + >>> tx_pkts[0].show2() # will print all info about the first packet, compare the checksum with the ref checksum. + + Verify if the segmented payload matches the send payload:: + + >>> tx_pkts[0].load == send_pkt.load[ : SEG_LENGTH ] + >>> tx_pkts[1].load == send_pkt.load[ SEG_LENGTH : 2*SEG_LENGTH ] + >>> ... + + +Test case 1: TSO (w/o VLAN) +=========================== + +This test is used to test TSO and will enable all HW checksum offload with TSO. +Configure the TX HW Offload:: + + 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 800 1 + +Send packets of below with bad all checksum, good all checksum, payload size ranges +in 128, 800, 801, 1700, 2500, 8500, each packet for multiple times, 10 times usually:: + + TSO NON-TUNNEL PACKETS + TSO TUNNEL PACKETS + UFO NON-TUNNEL PACKETS + UFO TUNNEL PACKETS + +Check for the correct checksum insertion at the correct place, check for the correct payload segmentation. + + +Test case 2: TSO tunneling (w/o VLAN) +===================================== + +This test is used to test Tunnel TSO and will enable all HW checksum offload with Tunnel TSO. +Configure the TX HW Offload:: + + 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 800 1 + +Send packets of below with bad all checksum, good all checksum, payload size ranges +in 128, 800, 801, 1700, 2500, 8500, each packet for multiple times, 10 times usually:: + + TSO NON-TUNNEL PACKETS + TSO TUNNEL PACKETS + UFO NON-TUNNEL PACKETS + UFO TUNNEL PACKETS + +Check for the correct checksum insertion at the correct place, check for the correct payload segmentation. + + +Test case 3: TSO combine (w/o VLAN, w/o AVX512) +=============================================== + +This test is used to test TSO and Tunnel TSO, will enable all HW checksum offload with TSO and Tunnel TSO. +Configure the TX HW Offload:: + + 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 800 1 + tunnel_tso set 800 1 + +Send packets of below with bad all checksum, good all checksum, payload size ranges +in 128, 800, 801, 1700, 2500, 8500, each packet for multiple times, 10 times usually:: + + TSO NON-TUNNEL PACKETS + TSO TUNNEL PACKETS + UFO NON-TUNNEL PACKETS + UFO TUNNEL PACKETS + +Check for the correct checksum insertion at the correct place, check for the correct payload segmentation. + +Test case 4: TSO performance +============================ Set the packet stream to be sent out from packet generator before testing as below. From patchwork Tue Jul 18 01:26:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 129593 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 F322A42E9F; Tue, 18 Jul 2023 03:26:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ECFA742D20; Tue, 18 Jul 2023 03:26:39 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 7A28440223 for ; Tue, 18 Jul 2023 03:26:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689643597; x=1721179597; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zfNkKdoYclaE2vMxfb47cxHL4X+/jyCudKdK+Lvm7Q0=; b=F8wUhb4w4ZIKd5ysW43nrN2VV/TXIktHTzhSbvPMsoWfsn/AIco2M1oE x85W81O8YJa3acuecHtW7gSzn0qH++WVD8FrrBWzG6m4sTaqM5nWwMKz4 nuD/TQRzyJZQn+cT5bC/yzskqXmmvEm97swkYtvbye2XQDVzDL808jm73 FqPWz0INWlHE6dyl1luLlwiy40hwlmQgDwO3OJXEuUJAU1mfkF465Ow9A 5H2RwJ2jkjs6M6eu0CiKJgZxQ9wR54qyb0CH/dJZqnaiZO/ec2kluqwje VWYZcAT+mmolw4WE1IPwLMiyX5QR1lKwTDz30T0QDwkPMLIkHBtldtFoF w==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="366119534" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="366119534" 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:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="837089821" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="837089821" Received: from dpdk-xuke-host.sh.intel.com ([10.67.114.220]) by fmsmga002.fm.intel.com with ESMTP; 17 Jul 2023 18:26:35 -0700 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, tarcadia@qq.com Subject: [DTS][Patch V2 4/6] tests/tso: Refactor TSO cases. Date: Tue, 18 Jul 2023 01:26:27 +0000 Message-Id: <20230718012629.2471811-5-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 TSO testplan. 1. Using common test method from offload_common to update test cases and test scopes. 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_tso.py | 1100 +++++++++++++++++++++++++++------------- 1 file changed, 740 insertions(+), 360 deletions(-) diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index a8292d8c..bbe4939f 100755 --- a/tests/TestSuite_tso.py +++ b/tests/TestSuite_tso.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2010-2014 Intel Corporation +# Copyright(c) 2010-2023 Intel Corporation # """ @@ -13,18 +13,335 @@ import re import time import framework.utils as utils -from framework.packet import Packet +import tests.offload_common as offload +from framework.packet import Packet, Raw, randstring from framework.pktgen import PacketGeneratorHelper +from framework.pmd_output import PmdOutput from framework.settings import HEADER_SIZE -from framework.test_case import TestCase +from framework.test_case import ( + TestCase, + check_supported_nic, + skip_unsupported, + skip_unsupported_host_driver, + skip_unsupported_nic, + skip_unsupported_pkg, +) DEFAULT_MUT = 1500 + +TX_INTERVAL = 0.01 + +TSO_TX_REPEAT = 10 TSO_MTU = 9000 +TSO_SEGMENT_LENGTH = 800 +TSO_PAYLOAD_SIZE_LIST = [128, 800, 801, 1700, 2500, 8500] + +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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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/VXLAN", + "IPv6/VXLAN", + "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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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", + "IPv6/VXLAN", + "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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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/VXLAN", + "IPv6/VXLAN", + "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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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", + "IPv6/VXLAN", + "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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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/VXLAN", + "VLAN/IPv6/VXLAN", + "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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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", + "VLAN/IPv6/VXLAN", + "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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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/VXLAN", + "VLAN/IPv6/VXLAN", + "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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_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", + "VLAN/IPv6/VXLAN", + "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 TSO_PAYLOAD_SIZE_LIST + for _ in range(TSO_TX_REPEAT) +] class TestTSO(TestCase): - dut_ports = [] - def set_up_all(self): """ Run at the start of each test suite. @@ -34,6 +351,60 @@ class TestTSO(TestCase): # Verify that enough ports are available self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing") + self.dut_pci = [ + self.dut.ports_info[self.dut_ports[0]]["pci"], + self.dut.ports_info[self.dut_ports[1]]["pci"], + ] + 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]), + ] + + # supported packets + self.packets_tso_non_tunnel = [] + self.packets_tso_tunnel = [] + self.support_rx_tunnel = False + if self.kdriver in {"ice"}: + 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_tso_non_tunnel.extend(TSO_NON_TUNNEL_PACKETS) + self.packets_tso_non_tunnel.extend(TSO_VLAN_NON_TUNNEL_PACKETS) + else: + 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_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_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_tso_tunnel.extend(TSO_TUNNEL_PACKETS) + self.packets_tso_tunnel.extend(TSO_VLAN_TUNNEL_PACKETS) + self.support_rx_tunnel = True + else: + self.packets_tso_tunnel.extend(TSO_TUNNEL_PACKETS) + self.support_rx_tunnel = True + + self.bind_nic_driver(self.dut_ports, "vfio-pci") + self.pmdout: PmdOutput = PmdOutput(self.dut) # Verify that enough threads are available self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]]) @@ -77,232 +448,144 @@ class TestTSO(TestCase): """ pass - def tcpdump_start_sniffing(self, ifaces=[]): - """ - Starts 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 /tmp/tcpdump_{0}.pcap -i {0} 2>tcpdump_{0}.out &" - ).format(iface) - del_cmd = ("rm -f /tmp/tcpdump_{0}.pcap").format(iface) - self.tester.send_expect(del_cmd, "#") - self.tester.send_expect(command, "#") - - def tcpdump_stop_sniff(self): - """ - Stops 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_command(self, command): - """ - Sends a tcpdump related command and returns an integer from the output - """ - - result = self.tester.send_expect(command, "#") - return int(result.strip()) - - def number_of_packets(self, iface): - """ - By reading the file generated by tcpdump it counts how many packets were - forwarded by the sample app and received in the self.tester. The sample app - will add a known MAC address for the test to look for. - """ - - command = ( - "tcpdump -A -nn -e -v -r /tmp/tcpdump_{iface}.pcap 2>/dev/null | " - + 'grep -c "seq"' + def test_tso_non_tunnel(self): + offload.execute_test_tso( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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 " % 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", + "rx_vxlan_port add 4789 0", + "tso set %d 1" % TSO_SEGMENT_LENGTH, + "port start all", + ], + packets=self.packets_tso_non_tunnel + self.packets_tso_tunnel, + packet_interval=TX_INTERVAL, + packet_mtu=TSO_MTU, + segment_length=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, ) - return self.tcpdump_command(command.format(**locals())) - - def tcpdump_scanner(self, scanner): - """ - Execute scanner to return results - """ - scanner_result = self.tester.send_expect(scanner, "#", 60) - fially_result = re.findall(r"length( \d+)", scanner_result) - return list(fially_result) - def number_of_bytes(self, iface): - """ - Get the length of loading_sizes - """ - scanner = 'tcpdump -vv -r /tmp/tcpdump_{iface}.pcap 2>/dev/null | grep "seq" | grep "length"' - return self.tcpdump_scanner(scanner.format(**locals())) - - def get_chksum_value_and_verify(self, dump_pcap, Nic_list): - packet = Packet() - pkts = packet.read_pcapfile(dump_pcap, self.tester) - for pkt in pkts: - chksum_list_rx = re.findall(r"chksum\s*=\s*(0x\w+)", pkt.show(dump=True)) - pkt["IP"].chksum = None - if "VXLAN" in pkt: - pkt["UDP"].chksum = None - pkt["VXLAN"]["IP"].chksum = None - pkt["VXLAN"]["TCP"].chksum = None - elif "GRE" in pkt: - pkt["GRE"]["IP"].chksum = None - pkt["GRE"]["TCP"].chksum = None - chksum_list_good = re.findall(r"chksum\s*=\s*(0x\w+)", pkt.show2(dump=True)) - if self.nic in Nic_list and "VXLAN" in pkt: - self.verify( - chksum_list_rx[0] == chksum_list_good[0] - and chksum_list_rx[2] == chksum_list_good[2] - and chksum_list_rx[3] == chksum_list_good[3], - "The obtained chksum value is incorrect.", - ) - else: - self.verify( - chksum_list_rx == chksum_list_good, - "The obtained chksum value is incorrect.", - ) - - def test_tso(self): - """ - TSO IPv4 TCP, IPv6 TCP - """ - tx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[0]) - ) - rx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[1]) - ) - - mac = self.dut.get_mac_address(self.dut_ports[0]) - - self.tester.send_expect( - "ethtool -K %s rx off tx off tso off gso off gro off lro off" - % tx_interface, - "# ", + def test_tso_tunnel(self): + offload.execute_test_tso( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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 " % 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", + "rx_vxlan_port add 4789 0", + "tunnel_tso set %d 1" % TSO_SEGMENT_LENGTH, + "port start all", + ], + packets=self.packets_tso_non_tunnel + self.packets_tso_tunnel, + packet_interval=TX_INTERVAL, + packet_mtu=TSO_MTU, + segment_length=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.tester.send_expect("ip l set %s up" % tx_interface, "# ") - if self.nic in ["cavium_a063", "cavium_a064"]: - cmd = ( - "%s %s -- -i --rxd=512 --txd=512 --burst=32 --rxfreet=64 --mbcache=128 --portmask=%s --max-pkt-len=%s --txpt=36 --txht=0 --txwt=0 --txfreet=32 --txrst=32 --tx-offloads=0x8000" - % (self.path, self.eal_param, self.portMask, TSO_MTU) - ) - else: - cmd = ( - "%s %s -- -i --rxd=512 --txd=512 --burst=32 --rxfreet=64 --mbcache=128 --portmask=%s --max-pkt-len=%s --txpt=36 --txht=0 --txwt=0 --txfreet=32 --txrst=32 " - % (self.path, self.eal_param, self.portMask, TSO_MTU) - ) - - self.dut.send_expect(cmd, "testpmd> ", 120) - self.dut.send_expect("set verbose 1", "testpmd> ", 120) - self.dut.send_expect("port stop all", "testpmd> ", 120) - self.dut.send_expect("csum set ip hw %d" % self.dut_ports[0], "testpmd> ", 120) - self.dut.send_expect("csum set udp hw %d" % self.dut_ports[0], "testpmd> ", 120) - self.dut.send_expect("csum set tcp hw %d" % self.dut_ports[0], "testpmd> ", 120) - if self.nic not in ["cavium_a063", "cavium_a064"]: - self.dut.send_expect( - "csum set sctp hw %d" % self.dut_ports[0], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set outer-ip hw %d" % self.dut_ports[0], "testpmd> ", 120 - ) - - self.dut.send_expect( - "csum parse-tunnel on %d" % self.dut_ports[0], "testpmd> ", 120 + def test_tso_combine(self): + offload.execute_test_tso( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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 " % 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", + "rx_vxlan_port add 4789 0", + "tso set %d 1" % TSO_SEGMENT_LENGTH, + "tunnel_tso set %d 1" % TSO_SEGMENT_LENGTH, + "port start all", + ], + packets=self.packets_tso_non_tunnel + self.packets_tso_tunnel, + packet_interval=TX_INTERVAL, + packet_mtu=TSO_MTU, + segment_length=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.dut.send_expect("tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120) - self.dut.send_expect("set fwd csum", "testpmd> ", 120) - self.dut.send_expect("port start all", "testpmd> ", 120) - self.dut.send_expect("set promisc all off", "testpmd> ", 120) - self.dut.send_expect("start", "testpmd> ") - - self.tester.scapy_foreground() - time.sleep(5) - - for loading_size in self.loading_sizes: - # IPv4 tcp test - self.tcpdump_start_sniffing([tx_interface, rx_interface]) - out = self.dut.send_expect("clear port stats all", "testpmd> ", 120) - self.tester.scapy_append( - 'sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' - % (mac, loading_size, tx_interface) - ) - out = self.tester.scapy_execute() - out = self.dut.send_expect("show port stats all", "testpmd> ", 120) - print(out) - self.tcpdump_stop_sniff() - rx_stats = self.number_of_packets(rx_interface) - tx_stats = self.number_of_packets(tx_interface) - tx_outlist = self.number_of_bytes(rx_interface) - self.logger.info(tx_outlist) - if loading_size <= 800: - self.verify( - rx_stats == tx_stats and int(tx_outlist[0]) == loading_size, - "IPV6 RX or TX packet number not correct", - ) - else: - num = int(loading_size / 800) - for i in range(num): - self.verify( - int(tx_outlist[i]) == 800, - "the packet segmentation incorrect, %s" % tx_outlist, - ) - if loading_size % 800 != 0: - self.verify( - int(tx_outlist[num]) == loading_size % 800, - "the packet segmentation incorrect, %s" % tx_outlist, - ) - - for loading_size in self.loading_sizes: - # IPv6 tcp test - self.tcpdump_start_sniffing([tx_interface, rx_interface]) - out = self.dut.send_expect("clear port stats all", "testpmd> ", 120) - self.tester.scapy_append( - 'sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' - % (mac, loading_size, tx_interface) - ) - out = self.tester.scapy_execute() - out = self.dut.send_expect("show port stats all", "testpmd> ", 120) - print(out) - self.tcpdump_stop_sniff() - rx_stats = self.number_of_packets(rx_interface) - tx_stats = self.number_of_packets(tx_interface) - tx_outlist = self.number_of_bytes(rx_interface) - self.logger.info(tx_outlist) - if loading_size <= 800: - self.verify( - rx_stats == tx_stats and int(tx_outlist[0]) == loading_size, - "IPV6 RX or TX packet number not correct", - ) - else: - num = int(loading_size / 800) - for i in range(num): - self.verify( - int(tx_outlist[i]) == 800, - "the packet segmentation incorrect, %s" % tx_outlist, - ) - if loading_size % 800 != 0: - self.verify( - int(tx_outlist[num]) == loading_size % 800, - "the packet segmentation incorrect, %s" % tx_outlist, - ) - - def test_tso_tunneling(self): - """ - TSO tunneling, VXLan testing, Nvgre testing - """ - tx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[0]) - ) - rx_interface = self.tester.get_interface( - self.tester.get_local_port(self.dut_ports[1]) - ) - - Nic_list = [ + @skip_unsupported_nic( + [ "I40E_10G-SFP_X710", "I40E_40G-QSFP_A", "I40E_40G-QSFP_B", @@ -310,149 +593,246 @@ class TestTSO(TestCase): "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", ] - save_file = "/tmp/save.pcap" - dump_pcap = "/tmp/tcpdump_%s.pcap" % rx_interface - - mac = self.dut.get_mac_address(self.dut_ports[0]) - - self.tester.send_expect( - "ethtool -K %s rx off tx off tso off gso off gro off lro off" - % tx_interface, - "# ", + ) + def test_tso_vlan_non_tunnel(self): + offload.execute_test_tso( + case=self, + testpmd=self.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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 " % 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", + "rx_vxlan_port add 4789 0", + "tso set %d 1" % TSO_SEGMENT_LENGTH, + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=TSO_VLAN_NON_TUNNEL_PACKETS + + UFO_VLAN_NON_TUNNEL_PACKETS + + TSO_VLAN_TUNNEL_PACKETS + + UFO_VLAN_TUNNEL_PACKETS, + packet_interval=TX_INTERVAL, + packet_mtu=TSO_MTU, + segment_length=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.tester.send_expect("ip l set %s up" % tx_interface, "# ") - cmd = ( - "%s %s -- -i --rxd=512 --txd=512 --burst=32 --rxfreet=64 --mbcache=128 --portmask=%s --max-pkt-len=%s --txpt=36 --txht=0 --txwt=0 --txfreet=32 --txrst=32 " - % (self.path, self.eal_param, self.portMask, TSO_MTU) - ) - self.dut.send_expect(cmd, "testpmd> ", 120) - self.dut.send_expect("set verbose 1", "testpmd> ", 120) - self.dut.send_expect("port stop all", "testpmd> ", 120) - self.dut.send_expect("csum set ip hw %d" % self.dut_ports[0], "testpmd> ", 120) - self.dut.send_expect("csum set udp hw %d" % self.dut_ports[0], "testpmd> ", 120) - self.dut.send_expect("csum set tcp hw %d" % self.dut_ports[0], "testpmd> ", 120) - self.dut.send_expect( - "csum set sctp hw %d" % self.dut_ports[0], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set outer-ip hw %d" % self.dut_ports[0], "testpmd> ", 120 - ) - if self.nic in Nic_list: - self.logger.warning( - "Warning: Intel® Ethernet 700 Series not support outer udp." - ) - else: - self.dut.send_expect( - "csum set outer-udp hw %d" % self.dut_ports[0], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum parse-tunnel on %d" % self.dut_ports[0], "testpmd> ", 120 + @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.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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 " % 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", + "rx_vxlan_port add 4789 0", + "tunnel_tso set %d 1" % TSO_SEGMENT_LENGTH, + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=TSO_VLAN_NON_TUNNEL_PACKETS + + UFO_VLAN_NON_TUNNEL_PACKETS + + TSO_VLAN_TUNNEL_PACKETS + + UFO_VLAN_TUNNEL_PACKETS, + packet_interval=TX_INTERVAL, + packet_mtu=TSO_MTU, + segment_length=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.dut.send_expect("csum set ip hw %d" % self.dut_ports[1], "testpmd> ", 120) - self.dut.send_expect("csum set udp hw %d" % self.dut_ports[1], "testpmd> ", 120) - self.dut.send_expect("csum set tcp hw %d" % self.dut_ports[1], "testpmd> ", 120) - self.dut.send_expect( - "csum set sctp hw %d" % self.dut_ports[1], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum set outer-ip hw %d" % self.dut_ports[1], "testpmd> ", 120 - ) - if self.nic in Nic_list: - self.logger.warning( - "Warning: Intel® Ethernet 700 Series not support outer udp." - ) - else: - self.dut.send_expect( - "csum set outer-udp hw %d" % self.dut_ports[1], "testpmd> ", 120 - ) - self.dut.send_expect( - "csum parse-tunnel on %d" % self.dut_ports[1], "testpmd> ", 120 + @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.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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 " % 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", + "rx_vxlan_port add 4789 0", + "tso set %d 1" % TSO_SEGMENT_LENGTH, + "tunnel_tso set %d 1" % TSO_SEGMENT_LENGTH, + "vlan set filter on 0", + "port start all", + "rx_vlan add 100 0", + ], + packets=TSO_VLAN_NON_TUNNEL_PACKETS + + UFO_VLAN_NON_TUNNEL_PACKETS + + TSO_VLAN_TUNNEL_PACKETS + + UFO_VLAN_TUNNEL_PACKETS, + packet_interval=TX_INTERVAL, + packet_mtu=TSO_MTU, + segment_length=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.dut.send_expect( - "tunnel_tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120 + @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.pmdout, + tester=self.tester, + tester_tx_interface=self.tester_intf[0], + tester_rx_interface=self.tester_intf[1], + testpmd_port_0=self.dut_pci[0], + testpmd_port_1=self.dut_pci[1], + 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 " % 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", + "rx_vxlan_port add 4789 0", + "tso set %d 1" % TSO_SEGMENT_LENGTH, + "tunnel_tso set %d 1" % TSO_SEGMENT_LENGTH, + "port start all", + ], + packets=self.packets_tso_non_tunnel + self.packets_tso_tunnel, + packet_interval=TX_INTERVAL, + packet_mtu=TSO_MTU, + segment_length=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.dut.send_expect("rx_vxlan_port add 4789 0", "testpmd> ", 120) - self.dut.send_expect("set fwd csum", "testpmd> ", 120) - self.dut.send_expect("port start all", "testpmd> ", 120) - self.dut.send_expect("set promisc all off", "testpmd> ", 120) - self.dut.send_expect("start", "testpmd> ") - - self.tester.scapy_foreground() - time.sleep(5) - - for loading_size in self.loading_sizes: - # Vxlan test - self.tcpdump_start_sniffing([tx_interface, rx_interface]) - out = self.dut.send_expect("clear port stats all", "testpmd> ", 120) - self.tester.scapy_append( - 'sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=4789)/VXLAN()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' - % (mac, mac, loading_size, tx_interface) - ) - out = self.tester.scapy_execute() - out = self.dut.send_expect("show port stats all", "testpmd> ", 120) - print(out) - self.tcpdump_stop_sniff() - rx_stats = self.number_of_packets(rx_interface) - tx_stats = self.number_of_packets(tx_interface) - tx_outlist = self.number_of_bytes(rx_interface) - self.logger.info(tx_outlist) - if loading_size <= 800: - self.verify( - rx_stats == tx_stats and int(tx_outlist[0]) == loading_size, - "Vxlan RX or TX packet number not correct", - ) - else: - num = int(loading_size / 800) - for i in range(num): - self.verify( - int(tx_outlist[i]) == 800, - "the packet segmentation incorrect, %s" % tx_outlist, - ) - if loading_size % 800 != 0: - self.verify( - int(tx_outlist[num]) == loading_size % 800, - "the packet segmentation incorrect, %s" % tx_outlist, - ) - self.get_chksum_value_and_verify(dump_pcap, Nic_list) - - for loading_size in self.loading_sizes: - # Nvgre test - self.tcpdump_start_sniffing([tx_interface, rx_interface]) - out = self.dut.send_expect("clear port stats all", "testpmd> ", 120) - self.tester.scapy_append( - 'sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/GRE(key_present=1,proto=0x6558,key=0x00001000)/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' - % (mac, mac, loading_size, tx_interface) - ) - out = self.tester.scapy_execute() - out = self.dut.send_expect("show port stats all", "testpmd> ", 120) - print(out) - self.tcpdump_stop_sniff() - rx_stats = self.number_of_packets(rx_interface) - tx_stats = self.number_of_packets(tx_interface) - tx_outlist = self.number_of_bytes(rx_interface) - self.logger.info(tx_outlist) - if loading_size <= 800: - self.verify( - rx_stats == tx_stats and int(tx_outlist[0]) == loading_size, - "Nvgre RX or TX packet number not correct", - ) - else: - num = int(loading_size / 800) - for i in range(num): - self.verify( - int(tx_outlist[i]) == 800, - "the packet segmentation incorrect, %s" % tx_outlist, - ) - if loading_size % 800 != 0: - self.verify( - int(tx_outlist[num]) == loading_size % 800, - "the packet segmentation incorrect, %s" % tx_outlist, - ) - self.get_chksum_value_and_verify(dump_pcap, Nic_list) def test_perf_TSO_2ports(self): """ From patchwork Tue Jul 18 01:26:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 129594 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 3363842E9F; Tue, 18 Jul 2023 03:26:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C6BF42D0D; Tue, 18 Jul 2023 03:26:42 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 798F340223 for ; Tue, 18 Jul 2023 03:26:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689643599; x=1721179599; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xOJT1JnR4MhD2H9mzdauwW8J+RMUEYTtdnrizGwv+gs=; b=LpZc0q7LKZDHynmh0ebrPKaYDUbMpiSUHYo0bfFqZNGqdN4ihoFHCgF0 9Vq7WjgP6L+u3RJ/mBfM0BHWkmvdtsV4DDNo+b4k4itGlJYc8+hbDnD3l c0MVl8CuXwQpvwCMvzaEGD6eON3CnjBLcazXBwgJj1axQhgmkhgPHqiDL LBdrpMamPPLl3FjOXp0pq8awWwK/AjZlXdUuQHL7wG8T1sjqWMjJkqN+i dwOKKjWHFQz0QpbQb9XmVcxfjvgTDGqGkqsBF46CyIz63nGPge2Yv8zVS TJGpn995GLo5ey2tu6lsSYtHL5PdGD9yDC60gSbdPqRUqQl1kaGjunZ/q g==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="366119542" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="366119542" 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:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="837089829" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="837089829" Received: from dpdk-xuke-host.sh.intel.com ([10.67.114.220]) by fmsmga002.fm.intel.com with ESMTP; 17 Jul 2023 18:26:37 -0700 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, tarcadia@qq.com Subject: [DTS][Patch V2 5/6] test_plans/vf_offload: Refactor checksum_offload case. Date: Tue, 18 Jul 2023 01:26:28 +0000 Message-Id: <20230718012629.2471811-6-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. Add Common test steps and packet organization table to better show the test steps. 2. 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. 3. Updated test cases and test scopes. Covering TSO tunnel, non-tunnel and combined scenario seperately. 4. Update cases for NIC comaptibility. Add description for VLAN, DCF VxLAN and AVX512 to fit specific testing scenarios required by several NICs. 5. 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 --- test_plans/vf_offload_test_plan.rst | 1356 ++++++++++++++++----------- 1 file changed, 794 insertions(+), 562 deletions(-) diff --git a/test_plans/vf_offload_test_plan.rst b/test_plans/vf_offload_test_plan.rst index 1c929371..daf9e7c0 100644 --- a/test_plans/vf_offload_test_plan.rst +++ b/test_plans/vf_offload_test_plan.rst @@ -1,13 +1,78 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright(c) 2015-2017 Intel Corporation + Copyright(c) 2015-2023 Intel Corporation ========== VF Offload ========== +Description +=========== -Prerequisites for checksum offload -================================== +The support of RX/TX L3/L4 checksum offload features by Poll Mode Drivers consists in: + +On the RX side: + +- Verify IPv4 checksum by hardware for received packets. +- Verify UDP/TCP/SCTP checksum by hardware for received packets. +- Verify tunneled outer IPv4 checksum by hardware for recieved packets. +- Verify tunneled outer UDP checksum by hardware for recieved packets. + +On the TX side: + +- IPv4 checksum insertion by hardware/software in transmitted packets. +- UDP/TCP/SCTP checksum insertion by hardware/software in transmitted packets (sctp length in 4 bytes). +- Tunneled outer IPv4 checksum insertion by hardware/software in transmitted packets. +- Tunneled outer UDP checksum insertion by hardware/software in transmitted packets. + +RX/TX side, the insertion of a L3/L4 or tunneled outer L3/L4 checksum by hardware can be enabled with the +following command of the ``testpmd`` application and running in a dedicated +tx checksum mode:: + + set fwd csum + csum set ip|tcp|udp|sctp|outer-ip|outer-udp hw|sw port_id + +The support of TX TSO features by Poll Mode Drivers consists in: + +On the TX side: + +- TCP/UDP segmentation. +- Tunneled inner TCP/UDP segmentation. + +RX/TX side, the TSO can be enabled with the following command of the ``testpmd`` application and running in tx +checksum mode with enabled checksum support:: + + set fwd csum + csum set ... + tso set + tunnel_tso set + +Please notice here that in DPDK TSO refers to both TCP Segmentation Offload (TSO) +and UDP Fragmentation Offload (UFO). DPDK TSO is also different from Generic Segmentation +Offload (GSO) for there is a GSO lib implemented elsewhere in DPDK. We will use TSO and UFO +to descripe packets and test steps, but only TSO configurations on ``testpmd`` are involved. + +The transmission of packet is done with the ``start`` command of the ``testpmd`` +application that will receive packets and then transmit the packet out on all +configured ports. + +Prerequisites +============= + +Topology +-------- + + dut_port_0 <---> tester_vm_port_0 + + dut_port_1 <---> tester_vm_port_1 + +Software +-------- + + - dpdk: http://dpdk.org/git/dpdk + - scapy: http://www.secdev.org/projects/scapy/ + +Configuration and Setup +----------------------- If using vfio the kernel must be >= 3.6+ and VT-d must be enabled in bios. When using vfio, use the following commands to load the vfio driver and bind it @@ -15,32 +80,27 @@ to the device under test:: modprobe vfio modprobe vfio-pci - usertools/dpdk-devbind.py --bind=vfio-pci device_bus_id + usertools/dpdk-devbind.py --bind=vfio-pci IP link set VF trust on and spoofchk off on DUT:: ip link set $PF_INTF vf 0 trust on ip link set $PF_INTF vf 0 spoofchk off -Assuming that ports ``0`` and ``1`` are connected to a traffic generator, -enable hardware rx checksum offload with "--enable-rx-cksum", -launch the ``testpmd`` with the following arguments: +If running TSO, on tester, all offload feature should be disabled on tx port, and start rx port capture:: - if test IAVF, start up VF port:: - - ./build/app/dpdk-testpmd -cffffff -n 1 -- -i --burst=1 --txpt`=32 \ - --txht=8 --txwt=0 --txfreet=0 --rxfreet=64 --mbcache=250 --portmask=0x5 - --enable-rx-cksum + ifconfig mtu 9000 + ethtool -K rx off tx off tso off gso off gro off lro off + ip l set up + tcpdump -n -e -i -s 0 -w /tmp/cap - if test DCF, set VF port to dcf and start up:: +Based on the topology, launch the ``testpmd`` with the following arguments:: - Enable kernel trust mode: + ./build/app/dpdk-testpmd -c <...> -n <...> -- -i <...> --enable-rx-cksum - ip link set $PF_INTF vf 0 trust on +For DCF mode:: - dpdk-testpmd -c 0x0f -n 4 -a 00:04.0,cap=dcf -a 00:05.0,cap=dcf -- -i --burst=1 --txpt=32 \ - --txht=8 --txwt=0 --txfreet=0 --rxfreet=64 --mbcache=250 --portmask=0x5 - --enable-rx-cksum + ./build/app/dpdk-testpmd -c <...> -n <...> -a <...>,cap=dcf -a <...>,cap=dcf -- -i <...> --enable-rx-cksum .. note:: @@ -50,621 +110,793 @@ Set the verbose level to 1 to display information for each received packet:: testpmd> set verbose 1 -Setup the ``csum`` forwarding mode:: +Due to DPDK 236bc417e2da(app/testpmd: fix MAC header in checksum forward engine) changes the checksum +functions adds switches to control whether to exchange MAC address. +Currently, our test scripts are based on not exchanging MAC addresses, mac-swap needs to be disabled: - testpmd> set fwd csum - Set csum packet forwarding mode + testpmd> csum mac-swap off 0 -Start the packet forwarding:: +Common test steps +================= + +This test uses ``Scapy`` to send out packages. The dut forwards packages with checksum offload enabled on +rx/tx port and TSO enabled on tx port. After packages send out by tx port, the tester receives packages +and verify them along with the verbose and stats. + +1. launch test-pmd to enable RX Checksum offload and for some NIC it enables a general set of RX Offloads:: + + ./dpdk/x86_64-native-linuxapp-gcc/app/dpdk-testpmd -c <...> -n <...> -a <...> -- -i --enable-rx-cksum + +2. config testpmd:: + + set csum fwd mode and stop all port:: + + testpmd> set fwd csum + testpmd> port stop all + + Modify the following commands to configure checksum offload according to the test scenario of each case: + + testpmd> csum set ip|tcp|udp|sctp|outer-ip|outer-udp hw|sw port_id + + start all ports and fwd: + + testpmd> port start all + testpmd> set verbose 1 + testpmd> start + +3. start to capture packets on tester:: + + tester: tcpdump -i -Q in -e ether src 52:00:00:00:00:00 -w /tmp/ens10.pcap + +4. send packets with scapy:: + + Configure the packet generator to send multiple combinations of inner and outer packet parts + according to the test scenario of each case, refer to the following table: + ++------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| Packet Types | Packet Names | Packet organizations | ++==================+===========================+==============================================================================================================================+ +| | IP/UDP | IP(src="10.0.0.1") / UDP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IP/TCP | IP(src="10.0.0.1") / TCP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IP/SCTP | IP(src="10.0.0.1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IPv6/UDP | IPv6(src="::1") / UDP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | IPv6/TCP | IPv6(src="::1") / TCP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| Inner Parts | IPv6/SCTP | IPv6(src="::1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IP/UDP | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IP/TCP | Dot1Q(vlan=100) / IP(src="10.0.0.1") / TCP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IP/SCTP | Dot1Q(vlan=100) / IP(src="10.0.0.1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IPv6/UDP | Dot1Q(vlan=100) / IPv6(src="::1") / UDP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IPv6/TCP | Dot1Q(vlan=100) / IPv6(src="::1") / TCP(sport=29999, dport=30000) / Raw(randstring(PAYLOAD_SIZE)) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| | VLAN/IPv6/SCTP | Dot1Q(vlan=100) / IPv6(src="::1") / SCTP(sport=29999, dport=30000, chksum=0x0000) / Raw(randstring(PAYLOAD_SIZE)) | ++------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/VXLAN | IP(src="10.0.0.1") / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/VXLAN | IPv6() / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/VXLAN-GPE | IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/VXLAN-GPE | IPv6() / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/VXLAN-GPE/Ether | IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/VXLAN-GPE/Ether | IPv6() / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GRE | IP(src="10.0.0.1", proto=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GRE | IPv6(nh=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GRE/Ether | IP(src="10.0.0.1", proto=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GRE/Ether | IPv6(nh=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/NVGRE | IP(src="10.0.0.1", proto=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/NVGRE | IPv6(nh=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GTPU | IP(src="10.0.0.1") / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GTPU | IPv6() / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP/GENEVE | IP(src="10.0.0.1") / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IPv6/GENEVE | IPv6() / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |IP | IP(src="10.0.0.1") | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| Outer Parts |IPv6 | IPv6() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/VXLAN | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/VXLAN | Dot1Q(vlan=100) / IPv6() / UDP(dport=4789) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/VXLAN-GPE | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/VXLAN-GPE | Dot1Q(vlan=100) / IPv6() / UDP(sport=4790, dport=4790) / VXLAN() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/VXLAN-GPE/Ether | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/VXLAN-GPE/Ether | Dot1Q(vlan=100) / IPv6() / UDP(sport=4790, dport=4790) / VXLAN() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GRE | Dot1Q(vlan=100) / IP(src="10.0.0.1", proto=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GRE | Dot1Q(vlan=100) / IPv6(nh=47) / GRE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GRE/Ether | Dot1Q(vlan=100) / IP(src="10.0.0.1", proto=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GRE/Ether | Dot1Q(vlan=100) / IPv6(nh=47) / GRE() / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/NVGRE | Dot1Q(vlan=100) / IP(src="10.0.0.1", proto=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/NVGRE | Dot1Q(vlan=100) / IPv6(nh=47) / GRE(key_present=1, proto=0x6558, key=0x00000100) / Ether() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GTPU | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GTPU | Dot1Q(vlan=100) / IPv6() / UDP(dport=2152) / GTP_U_Header(gtp_type=255, teid=0x123456) | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP/GENEVE | Dot1Q(vlan=100) / IP(src="10.0.0.1") / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6/GENEVE | Dot1Q(vlan=100) / IPv6() / UDP(dport=6081, sport=29999) / GENEVE() | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IP | Dot1Q(vlan=100) / IP(src="10.0.0.1") | +| +---------------------------+------------------------------------------------------------------------------------------------------------------------------+ +| |VLAN/IPv6 | Dot1Q(vlan=100) / IPv6() | ++------------------+---------------------------+------------------------------------------------------------------------------------------------------------------------------+ + ++------------------+------------------+----------------------------+ +| Scenarios | Packet Types | Packet Names | ++==================+==================+============================+ +| | | IP/UDP | +| | +----------------------------+ +| | | IP/TCP | +| | +----------------------------+ +| CSUM NON-TUNNEL | Inner parts | IP/SCTP | +| PACKETS | +----------------------------+ +| | | IPv6/UDP | +| | +----------------------------+ +| | | IPv6/TCP | +| | +----------------------------+ +| | | IPv6/SCTP | ++------------------+------------------+----------------------------+ +| | | IP/VXLAN | +| | Outer parts +----------------------------+ +| | | IPv6/VXLAN | +| +------------------+----------------------------+ +| CSUM TUNNEL | | IP/UDP | +| PACKETS | +----------------------------+ +| OF VXLAN | | IP/TCP | +| | +----------------------------+ +| | Inner parts | IP/SCTP | +| | +----------------------------+ +| | | IPv6/UDP | +| | +----------------------------+ +| | | IPv6/TCP | +| | +----------------------------+ +| | | IPv6/SCTP | ++------------------+------------------+----------------------------+ +| | | IP/VXLAN | +| | +----------------------------+ +| | | IPv6/VXLAN | +| | +----------------------------+ +| | | IP/VXLAN-GPE | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE | +| | +----------------------------+ +| | | IP/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IP/GRE | +| | +----------------------------+ +| CSUM TUNNEL | Outer parts | IPv6/GRE | +| PACKETS | +----------------------------+ +| | | IP/GRE/Ether | +| | +----------------------------+ +| | | IPv6/GRE/Ether | +| | +----------------------------+ +| | | IP/NVGRE | +| | +----------------------------+ +| | | IPv6/NVGRE | +| | +----------------------------+ +| | | IP/GTPU | +| | +----------------------------+ +| | | IPv6/GTPU | +| +------------------+----------------------------+ +| | | IP/UDP | +| | +----------------------------+ +| | | IP/TCP | +| | +----------------------------+ +| | Inner parts | IP/SCTP | +| | +----------------------------+ +| | | IPv6/UDP | +| | +----------------------------+ +| | | IPv6/TCP | +| | +----------------------------+ +| | | IPv6/SCTP | ++------------------+------------------+----------------------------+ +| | | VLAN/IP/UDP | +| | +----------------------------+ +| | | VLAN/IP/TCP | +| | +----------------------------+ +| CSUM NON-TUNNEL | Inner parts | VLAN/IP/SCTP | +| VLAN PACKETS | +----------------------------+ +| | | VLAN/IPv6/UDP | +| | +----------------------------+ +| | | VLAN/IPv6/TCP | +| | +----------------------------+ +| | | VLAN/IPv6/SCTP | ++------------------+------------------+----------------------------+ +| | | VLAN/IP/VXLAN | +| | Outer parts +----------------------------+ +| | | VLAN/IPv6/VXLAN | +| +------------------+----------------------------+ +| CSUM TUNNEL | | VLAN/IP/UDP | +| VLAN PACKETS | +----------------------------+ +| OF VXLAN | | VLAN/IP/TCP | +| | +----------------------------+ +| | Inner parts | VLAN/IP/SCTP | +| | +----------------------------+ +| | | VLAN/IPv6/UDP | +| | +----------------------------+ +| | | VLAN/IPv6/TCP | +| | +----------------------------+ +| | | VLAN/IPv6/SCTP | ++------------------+------------------+----------------------------+ +| | | VLAN/IP/VXLAN | +| | +----------------------------+ +| | | VLAN/IPv6/VXLAN | +| | +----------------------------+ +| | | VLAN/IP/VXLAN-GPE | +| | +----------------------------+ +| | | VLAN/IPv6/VXLAN-GPE | +| | +----------------------------+ +| | | VLAN/IP/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | VLAN/IPv6/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | VLAN/IP/GRE | +| | +----------------------------+ +| CSUM TUNNEL | Outer parts | VLAN/IPv6/GRE | +| VLAN PACKETS | +----------------------------+ +| | | VLAN/IP/GRE/Ether | +| | +----------------------------+ +| | | VLAN/IPv6/GRE/Ether | +| | +----------------------------+ +| | | VLAN/IP/NVGRE | +| | +----------------------------+ +| | | VLAN/IPv6/NVGRE | +| | +----------------------------+ +| | | VLAN/IP/GTPU | +| | +----------------------------+ +| | | VLAN/IPv6/GTPU | +| +------------------+----------------------------+ +| | | VLAN/IP/UDP | +| | +----------------------------+ +| | | VLAN/IP/TCP | +| | +----------------------------+ +| | Inner parts | VLAN/IP/SCTP | +| | +----------------------------+ +| | | VLAN/IPv6/UDP | +| | +----------------------------+ +| | | VLAN/IPv6/TCP | +| | +----------------------------+ +| | | VLAN/IPv6/SCTP | ++------------------+------------------+----------------------------+ +| TSO NON-TUNNEL | | IP/TCP | +| PACKETS | Inner parts +----------------------------+ +| | | IPv6/TCP | ++------------------+------------------+----------------------------+ +| | | IP/VXLAN-GPE | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE | +| | +----------------------------+ +| | | IP/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IP/GRE | +| | +----------------------------+ +| TSO TUNNEL | Outer parts | IPv6/GRE | +| PACKETS | +----------------------------+ +| | | IP/GRE/Ether | +| | +----------------------------+ +| | | IPv6/GRE/Ether | +| | +----------------------------+ +| | | IP/NVGRE | +| | +----------------------------+ +| | | IPv6/NVGRE | +| | +----------------------------+ +| | | IP/GTPU | +| | +----------------------------+ +| | | IPv6/GTPU | +| +------------------+----------------------------+ +| | | IP/TCP | +| | Inner parts +----------------------------+ +| | | IPv6/TCP | ++------------------+------------------+----------------------------+ +| UFO NON-TUNNEL | | IP/UDP | +| PACKETS | Inner parts +----------------------------+ +| | | IPv6/UDP | ++------------------+------------------+----------------------------+ +| | | IP/VXLAN-GPE | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE | +| | +----------------------------+ +| | | IP/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IPv6/VXLAN-GPE/Ether | +| | +----------------------------+ +| | | IP/GRE | +| | +----------------------------+ +| UFO TUNNEL | Outer parts | IPv6/GRE | +| PACKETS | +----------------------------+ +| | | IP/GRE/Ether | +| | +----------------------------+ +| | | IPv6/GRE/Ether | +| | +----------------------------+ +| | | IP/NVGRE | +| | +----------------------------+ +| | | IPv6/NVGRE | +| | +----------------------------+ +| | | IP/GTPU | +| | +----------------------------+ +| | | IPv6/GTPU | +| +------------------+----------------------------+ +| | | IP/UDP | +| | Inner parts +----------------------------+ +| | | IPv6/UDP | ++------------------+------------------+----------------------------+ + +5. stop capture packets and then stop fwd:: + + tester: pkill tcpdump + dut: testpmd> stop + +6. check rx and tx results:: + + Check if ``ol_flag`` contains these fields based on the checksum values of L3 and L4 in the sent packets, refer to the following table. + ++--------------+---------------------------------+--------------------------+ +| packet type | checksum value | check ol_flag | ++==============+=================================+==========================+ +| Inner | IPv4 (bad checksum) | `RX_IP_CKSUM_BAD` | +| +---------------------------------+--------------------------+ +| | IPv4 (good checksum) | `RX_IP_CKSUM GOOD` | +| +---------------------------------+--------------------------+ +| | TCP / UDP / SCTP (bad checksum) | `RX_L4_CKSUM_BAD` | +| +---------------------------------+--------------------------+ +| | TCP / UDP / SCTP (bad checksum) | `RX_L4_CKSUM_GOOD` | ++--------------+---------------------------------+--------------------------+ +| Outer | IPv4 (bad checksum) | `RX_OUTER_IP_CKSUM_BAD` | +| +---------------------------------+--------------------------+ +| | IPv4 (good checksum) | `RX_OUTER_IP_CKSUM GOOD` | +| +---------------------------------+--------------------------+ +| | UDP (bad checksum) | `RX_OUTER_L4_CKSUM_BAD` | +| +---------------------------------+--------------------------+ +| | UDP (good checksum) | `RX_OUTER_L4_CKSUM_GOOD` | ++--------------+---------------------------------+--------------------------+ + + + Check rx and tx statistics according to the checksum values of L3 and L4 in the sent packets. + ++------------------+-------------------------------------------------------------------+ +| entry | checkpoint | ++==================+===================================================================+ +| RX-packets | `RX-packets` = Num of sent packets | ++------------------+-------------------------------------------------------------------+ +| RX-total | `RX-total` = Num of sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-ipcsum | `Bad-ipcsum` = Sum of bad inner IP checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-l4csum | `Bad-l4csum` = Sum of bad inner L4 checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-outer-ipcsum | `Bad-outer-ipcsum` = Sum of bad outer IP checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| Bad-outer-l4csum | `Bad-outer-l4csum` = Sum of bad outer L4 checksum in sent packets | ++------------------+-------------------------------------------------------------------+ +| TX-packets | `TX-packets` = `RX-packets` (exclude tso cases) | ++------------------+-------------------------------------------------------------------+ +| TX-total | `TX-total` = `RX-total` (exclude tso cases) | ++------------------+-------------------------------------------------------------------+ + + Read pcap files with scapy and check if configured checksum values to insert of tx_packets are all correct:: + + >>> tx_pkts = rdpcap("/tmp/ens10.pcap") # tx_packets is of list of all tx pkts + >>> tx_pkts[0].show2() # will print all info about the first packet, compare the checksum with the ref checksum. + +1. For TSO cases, we verify if the segmented payload matches the send payload:: + + >>> tx_pkts[0].load == send_pkt.load[ : SEG_LENGTH ] + >>> tx_pkts[1].load == send_pkt.load[ SEG_LENGTH : 2*SEG_LENGTH ] + >>> ... + +Test case 1: HW IP non-tunneling +================================ + +This test is used to test non-tunneling packets and will enable hw ip checksum offload. +Configure the TX HW Offload:: + + csum set ip hw 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: + + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) + + +Test case 2: HW UDP non-tunneling +================================= + +This test is used to test non-tunneling packets and will enable hw udp checksum offload. +Configure the TX HW Offload:: + + csum set udp hw 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: + + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) + +Check for the correct checksum insertion at the correct place. + + +Test case 3: HW TCP non-tunneling +================================= + +This test is used to test non-tunneling packets and will enable hw tcp checksum offload. +Configure the TX HW Offload:: + + csum set tcp hw 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: + + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) + +Check for the correct checksum insertion at the correct place. + + +Test case 4: HW SCTP non-tunneling +================================== - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 +This test is used to test non-tunneling packets and will enable hw sctp checksum offload. +Configure the TX HW Offload:: -Verify that how many packets found with Bad-ipcsum or Bad-l4csum:: + csum set sctp hw 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: - testpmd> stop - ---------------------- Forward statistics for port 0 ---------------------- - RX-packets: 0 RX-dropped: 0 RX-total: 0 - Bad-ipcsum: 0 Bad-l4csum: 0 - TX-packets: 0 TX-dropped: 0 TX-total: 0 - ---------------------------------------------------------------------------- + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) +Check for the correct checksum insertion at the correct place. -Test Case: HW checksum offload check -==================================== -Start testpmd and enable checksum offload on rx port. -Setup the ``csum`` forwarding mode:: +Test case 5: HW IP + L4 non-tunneling (w/o VLAN) +================================================ - testpmd> set fwd csum - Set csum packet forwarding mode +This test is used to test non-tunneling packets and will enable IP and all L4 hw checksum offload. +Configure the TX HW Offload:: -Enable the IPv4/UDP/TCP/SCTP HW checksum offload on port 0:: + csum set ip hw 1 + csum set udp hw 1 + csum set tcp hw 1 + csum set sctp hw 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set sctp hw 0 - testpmd> port start all - testpmd> set promisc 0 - - Due to DPDK 236bc417e2da(app/testpmd: fix MAC header in checksum forward engine) changes the checksum - functions adds switches to control whether to exchange MAC address. - Currently, our test scripts are based on not exchanging MAC addresses, mac-swap needs to be disabled: - testpmd> csum mac-swap off 0 + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 - -Configure the traffic generator to send the multiple packets for the following -combination: - - +----------------+----------------------------------------+ - | packet type | packet organization | - +================+========================================+ - | | Ether / IPv4 / UDP / payload | - | +----------------------------------------+ - | | Ether / IPv4 / TCP / payload | - | +----------------------------------------+ - | packets | Ether / IPv4 / SCTP / payload | - | for checksum +----------------------------------------+ - | offload test | Ether / IPv6 / UDP / payload | - | +----------------------------------------+ - | | Ether / IPv6 / TCP / payload | - +----------------+----------------------------------------+ - -Send packets with incorrect checksum, -verify dpdk can rx it and report the checksum error, -verify that the same number of packet are correctly received on the traffic -generator side. And IPv4 checksum, TCP checksum, UDP checksum, SCTP checksum need -be validated as pass by the tester. - -The IPv4 source address will not be changed by testpmd. - - -Test Case: HW tunneling checksum offload check -============================================== -In DPDK 22.11 release, Intel® Ethernet 800 Series NIC with ICE supports HW -checksum offload for tunneling packets for checking both inner and outer -checksum. For the packets involved in this case, a ICE COMMON DDP Package -is required. - -Start testpmd and enable checksum offload on rx port. - -Setup the ``csum`` forwarding mode:: - - testpmd> set fwd csum - Set csum packet forwarding mode - -Enable the IPv4/UDP/TCP/SCTP HW checksum offload on port 0:: - - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set sctp hw 0 - testpmd> csum set outer-ip hw 0 - testpmd> csum set outer-udp hw 0 - testpmd> csum parse-tunnel on 0 - testpmd> port start all - testpmd> set promisc 0 on - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 - -Configure the traffic generator to send the multiple packets for the following -combination with inner package of: - - +----------------+----------------------------------------+ - | packet type | packet organization | - +================+========================================+ - | | IPv4 / UDP / payload | - | +----------------------------------------+ - | | IPv4 / TCP / payload | - | +----------------------------------------+ - | inner packets | IPv4 / SCTP / payload | - | for checksum +----------------------------------------+ - | offload test | IPv6 / UDP / payload | - | +----------------------------------------+ - | | IPv6 / TCP / payload | - | +----------------------------------------+ - | | IPv6 / SCTP / payload | - +----------------+----------------------------------------+ - -And outer or tunneling package of : - - +----------------+----------------------------------------+ - | packet type | packet organization | - +================+========================================+ - | | Ether / IPv4 / UDP / VXLAN / Ether | - | +----------------------------------------+ - | | Ether / IPv6 / UDP / VXLAN / Ether | - | +----------------------------------------+ - | | Ether / IPv4 / GRE | - | outer and +----------------------------------------+ - | tunneling | Ether / IPv4 / GRE / Ether | - | packets +----------------------------------------+ - | for checksum | Ether / IPv6 / GRE | - | offload test +----------------------------------------+ - | | Ether / IPv6 / GRE / Ether | - | +----------------------------------------+ - | | Ether / IPv4 / NVGRE | - | +----------------------------------------+ - | | Ether / IPv4 / NVGRE / Ether | - | +----------------------------------------+ - | | Ether / IPv6 / NVGRE | - | +----------------------------------------+ - | | Ether / IPv6 / NVGRE / Ether | - | +----------------------------------------+ - | | Ether / IPv4 / UDP / GTPU | - | +----------------------------------------+ - | | Ether / IPv6 / UDP / GTPU | - +----------------+----------------------------------------+ - -Notice that VxLAN needs DCF to configure, so testing of VxLAN may need to perform -on DCF. - -Send packets with incorrect checksum on outer IPv4, outer UDP (if exists), inner -IP, inner L4, verify dpdk can rx it and report the checksum error, -verify that the same number of packet are correctly received on the traffic -generator side. And IPv4 checksum, TCP checksum, UDP checksum, SCTP checksum need -be validated as pass by the tester. - -The IPv4 source address will not be changed by testpmd. - - -Test Case: SW checksum offload check -==================================== - -Enable SW checksum offload, send same packet with incorrect checksum -and verify checksum is valid. - -Setup the ``csum`` forwarding mode:: - - testpmd> set fwd csum - Set csum packet forwarding mode - -Enable the IPv4/UDP/TCP/SCTP SW checksum offload on port 0:: - - testpmd> port stop all - testpmd> csum set ip sw 0 - testpmd> csum set tcp sw 0 - testpmd> csum set udp sw 0 - testpmd> csum set sctp sw 0 - testpmd> port start all - testpmd> set promisc 0 on - - Due to DPDK 236bc417e2da(app/testpmd: fix MAC header in checksum forward engine) changes the checksum - functions adds switches to control whether to exchange MAC address. - Currently, our test scripts are based on not exchanging MAC addresses, mac-swap needs to be disabled: - testpmd> csum mac-swap off 0 +Check for the correct checksum insertion at the correct place. - testpmd> start - csum packet forwarding - CRC stripping disabled - packets/burst=32 - nb forwarding cores=1 - nb forwarding ports=10 - RX queues=1 - RX desc=128 - RX free threshold=64 - RX threshold registers: pthresh=8 hthresh=8 wthresh=4 - TX queues=1 - TX desc=512 - TX free threshold=0 - TX threshold registers: pthresh=32 hthresh=8 wthresh=8 - -Configure the traffic generator to send the multiple packets for the following -combination: - - +----------------+----------------------------------------+ - | packet type | packet organization | - +================+========================================+ - | | Ether / IPv4 / UDP / payload | - | +----------------------------------------+ - | packets | Ether / IPv4 / TCP / payload | - | for checksum +----------------------------------------+ - | offload test | Ether / IPv6 / UDP / payload | - | +----------------------------------------+ - | | Ether / IPv6 / TCP / payload | - +----------------+----------------------------------------+ - -Send packets with incorrect checksum, -verify dpdk can rx it and report the checksum error, -verify that the same number of packet are correctly received on the traffic -generator side. And IPv4 checksum, TCP checksum, UDP checksum need -be validated as pass by the tester. - -The first byte of source IPv4 address will be increased by testpmd. The checksum -is indeed recalculated by software algorithms. - - -Test Case: HW checksum offload check with vlan -============================================== -Start testpmd and enable checksum offload on rx port. Based on test steps of -HW checksum offload check, configure the traffic generator to send the multiple -packets for the following combination: - - +----------------+----------------------------------------+ - | packet type | packet organization | - +================+========================================+ - | | Ether / VLAN / IPv4 / UDP / payload | - | +----------------------------------------+ - | | Ether / VLAN / IPv4 / TCP / payload | - | +----------------------------------------+ - | packets | Ether / VLAN / IPv4 / SCTP / payload | - | for checksum +----------------------------------------+ - | offload test | Ether / VLAN / IPv6 / UDP / payload | - | +----------------------------------------+ - | | Ether / VLAN / IPv6 / TCP / payload | - +----------------+----------------------------------------+ - - -Test Case: HW tunneling checksum offload check with vlan -======================================================== -Based on test steps of HW tunneling checksum offload check, configure the -traffic generator to send the multiple packets combination with outer or -tunneling package of: - - +----------------+--------------------------------------------+ - | packet type | packet organization | - +================+============================================+ - | | Ether / VLAN / IPv4 / UDP / VXLAN / Ether | - | +--------------------------------------------+ - | | Ether / VLAN / IPv6 / UDP / VXLAN / Ether | - | +--------------------------------------------+ - | | Ether / VLAN / IPv4 / GRE | - | outer and +--------------------------------------------+ - | tunneling | Ether / VLAN / IPv4 / GRE / Ether | - | packets +--------------------------------------------+ - | for checksum | Ether / VLAN / IPv6 / GRE | - | offload test +--------------------------------------------+ - | | Ether / VLAN / IPv6 / GRE / Ether | - | +--------------------------------------------+ - | | Ether / VLAN / IPv4 / NVGRE | - | +--------------------------------------------+ - | | Ether / VLAN / IPv4 / NVGRE / Ether | - | +--------------------------------------------+ - | | Ether / VLAN / IPv6 / NVGRE | - | +--------------------------------------------+ - | | Ether / VLAN / IPv6 / NVGRE / Ether | - | +--------------------------------------------+ - | | Ether / VLAN / IPv4 / UDP / GTPU | - | +--------------------------------------------+ - | | Ether / VLAN / IPv6 / UDP / GTPU | - +----------------+--------------------------------------------+ - - -Test Case: HW checksum offload check on scalar path -=================================================== -These set of cases based on existing cases are designed for better case managment for -regression test. - -Start testpmd with eal parameter --force-max-simd-bitwidth=64. Based on test steps of -'HW checksum offload check'. - -Test Case: HW checksum offload check on sse path -================================================ -Start testpmd with eal parameter --force-max-simd-bitwidth=128. Based on test steps of -'HW checksum offload check'. +For PMD not supporting VLAN defaultly, we run an extra case:: + + 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 + rx_vlan add 100 0 -Test Case: HW checksum offload check on avx2 path -================================================= -Start testpmd with eal parameter --force-max-simd-bitwidth=256. Based on test steps of -'HW checksum offload check'. +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: -Test Case: HW checksum offload check on avx512 path -=================================================== -Start testpmd with eal parameter --force-max-simd-bitwidth=512. Based on test steps of -'HW checksum offload check'. + CSUM NON-TUNNEL VLAN PACKETS -Test Case: HW checksum offload check with vlan on scalar path -============================================================= +Check for the correct checksum insertion at the correct place. -Test Case: HW checksum offload check with vlan on sse path -============================================================= -Test Case: HW checksum offload check with vlan on avx2 path -============================================================= +Test case 6: HW Outer-IP tunneling +================================== -Test Case: HW checksum offload check with vlan on avx512 path -============================================================= +After DPDK v22.11, Intel® Ethernet 800 Series NIC with ICE supports tunneling packets on VF. +This test is used to test tunneling scenario and will enable Outer-IP checksum offload. +Configure the TX HW Offload:: -Test Case: HW tunneling checksum offload check on scalar path -============================================================= + 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 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: -Test Case: HW tunneling checksum offload check on sse path -========================================================== + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS -Test Case: HW tunneling checksum offload check on avx2 path -=========================================================== +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 +checksum, bad all checksum, good all checksum, each packet for multiple times, 10 times usually:: -Test Case: HW tunneling checksum offload check on avx512 path -============================================================= + CSUM TUNNEL PACKETS + CSUM TUNNEL VLAN PACKETS -Test Case: HW tunneling checksum offload check with vlan on scalar path -======================================================================= +Check for the correct checksum insertion at the correct place. -Test Case: HW tunneling checksum offload check with vlan on sse path -==================================================================== -Test Case: HW tunneling checksum offload check with vlan on avx2 path -===================================================================== +Test case 7: HW Outer-UDP tunneling +=================================== -Test Case: HW tunneling checksum offload check with vlan on avx512 path -======================================================================= +After DPDK v22.11, Intel® Ethernet 800 Series NIC with ICE supports tunneling packets on VF. +This test is used to test tunneling scenario and will enable Outer-UDP checksum offload. +Configure the TX HW Offload:: -Test Case: SW checksum offload check on scalar path -=================================================== + 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 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: -Test Case: SW checksum offload check on sse path -================================================ + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS -Test Case: SW checksum offload check on avx2 path -================================================= +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 +checksum, bad all checksum, good all checksum, each packet for multiple times, 10 times usually:: -Test Case: SW checksum offload check on avx512 path -=================================================== + CSUM TUNNEL PACKETS + CSUM TUNNEL VLAN PACKETS +Check for the correct checksum insertion at the correct place. -Prerequisites for TSO -===================== -The DUT must take one of the Ethernet controller ports connected to a port on another -device that is controlled by the Scapy packet generator. +Test case 8: HW Outer-IP + Outer-UDP tunneling with SW Inner +============================================================ -The Ethernet interface identifier of the port that Scapy will use must be known. -On tester, all offload feature should be disabled on tx port, and start rx port capture:: +After DPDK v22.11, Intel® Ethernet 800 Series NIC with ICE supports tunneling packets on VF. +This test is used to test tunneling scenario and will enable Outer-IP and Outer-UDP checksum offload. +Configure the TX HW Offload:: - ethtool -K rx off tx off tso off gso off gro off lro off - ip l set up - tcpdump -n -e -i -s 0 -w /tmp/cap + csum set outer-ip hw 1 + csum set outer-udp hw 1 + csum parse-tunnel on 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS -On DUT, run pmd with parameter "--enable-rx-cksum". Then enable TSO on tx port -and checksum on rx port. The test commands is below:: - - # Enable hw checksum on rx port - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set sctp hw 0 - testpmd> port start all - testpmd> set promisc 0 on - testpmd> set fwd csum - - # Enable TSO on tx port - testpmd> tso set 800 1 - -For tunneling cases on Intel® Ethernet 800 Series NIC with ICE, add tunneling support -on csum and enable tunnel tso as below:: - - # Enable hw checksum for tunneling on rx port - testpmd> port stop all - testpmd> csum set outer-ip hw 0 - testpmd> csum set outer-udp hw 0 - testpmd> csum parse-tunnel on 0 - testpmd> port start all - testpmd> tunnel_tso set 800 1 - -Configure the traffic generator to send the multiple packets for the following -combination, each combination for several times: - - +----------------+----------------------------------------+---------------+ - | packet type | packet organization | packet count | - +================+========================================+===============+ - | | Ether / IPv4 / TCP / payload len 128 | 10 | - | +----------------------------------------+---------------+ - | | Ether / IPv4 / TCP / payload len 800 | 10 | - | +----------------------------------------+---------------+ - | | Ether / IPv4 / TCP / payload len 801 | 10 | - | +----------------------------------------+---------------+ - | | Ether / IPv4 / TCP / payload len 1700 | 10 | - | +----------------------------------------+---------------+ - | | Ether / IPv4 / TCP / payload len 2500 | 10 | - | non-tunneling +----------------------------------------+---------------+ - | packets for | Ether / IPv4 / TCP / payload len 8500 | 1000 | - | TSO test +----------------------------------------+---------------+ - | | Ether / IPv6 / TCP / payload len 128 | 10 | - | +----------------------------------------+---------------+ - | | Ether / IPv6 / TCP / payload len 800 | 10 | - | +----------------------------------------+---------------+ - | | Ether / IPv6 / TCP / payload len 801 | 10 | - | +----------------------------------------+---------------+ - | | Ether / IPv6 / TCP / payload len 1700 | 10 | - | +----------------------------------------+---------------+ - | | Ether / IPv6 / TCP / payload len 2500 | 10 | - | +----------------------------------------+---------------+ - | | Ether / IPv6 / TCP / payload len 8500 | 1000 | - +----------------+----------------------------------------+---------------+ - | | Ether / IPv4 / UDP / VXLAN / Ether | N/A | - | +----------------------------------------+---------------+ - | | Ether / IPv6 / UDP / VXLAN / Ether | N/A | - | +----------------------------------------+---------------+ - | | Ether / IPv4 / GRE | N/A | - | outer and +----------------------------------------+---------------+ - | tunneling | Ether / IPv4 / GRE / Ether | N/A | - | packets +----------------------------------------+---------------+ - | for tso test | Ether / IPv6 / GRE | N/A | - | +----------------------------------------+---------------+ - | | Ether / IPv6 / GRE / Ether | N/A | - | +----------------------------------------+---------------+ - | | Ether / IPv4 / NVGRE | N/A | - | +----------------------------------------+---------------+ - | | Ether / IPv4 / NVGRE / Ether | N/A | - | +----------------------------------------+---------------+ - | | Ether / IPv6 / NVGRE | N/A | - | +----------------------------------------+---------------+ - | | Ether / IPv6 / NVGRE / Ether | N/A | - | +----------------------------------------+---------------+ - | | Ether / IPv4 / UDP / GTPU | N/A | - | +----------------------------------------+---------------+ - | | Ether / IPv6 / UDP / GTPU | N/A | - +----------------+----------------------------------------+---------------+ - | | IPv4 / TCP / payload len 128 | 10 | - | +----------------------------------------+---------------+ - | | IPv4 / TCP / payload len 800 | 10 | - | +----------------------------------------+---------------+ - | | IPv4 / TCP / payload len 801 | 10 | - | +----------------------------------------+---------------+ - | | IPv4 / TCP / payload len 1700 | 10 | - | +----------------------------------------+---------------+ - | | IPv4 / TCP / payload len 2500 | 10 | - | +----------------------------------------+---------------+ - | inner packets | IPv4 / TCP / payload len 8500 | 1000 | - | for TSO test +----------------------------------------+---------------+ - | | IPv6 / TCP / payload len 128 | 10 | - | +----------------------------------------+---------------+ - | | IPv6 / TCP / payload len 800 | 10 | - | +----------------------------------------+---------------+ - | | IPv6 / TCP / payload len 801 | 10 | - | +----------------------------------------+---------------+ - | | IPv6 / TCP / payload len 1700 | 10 | - | +----------------------------------------+---------------+ - | | IPv6 / TCP / payload len 2500 | 10 | - | +----------------------------------------+---------------+ - | | IPv6 / TCP / payload len 8500 | 1000 | - +----------------+----------------------------------------+---------------+ - -Notice that VxLAN needs DCF to configure, so testing of VxLAN may need to perform -on DCF. - - -Test case: csum fwd engine, use TSO -=================================== +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 +checksum, bad all checksum, good all checksum, each packet for multiple times, 10 times usually:: -This test uses ``Scapy`` to send out one large TCP package. The dut forwards package -with TSO enable on tx port while rx port turns checksum on. After package send out -by TSO on tx port, the tester receives multiple small TCP package. + CSUM TUNNEL PACKETS + CSUM TUNNEL VLAN PACKETS -Turn off tx port by ethtool on tester:: +Check for the correct checksum insertion at the correct place. - ethtool -K rx off tx off tso off gso off gro off lro off - ip l set up -Capture package rx port on tester:: +Test case 9: HW Outer-IP + Outer-UDP tunneling with HW Inner (w/o DCF, w/o AVX512) +=================================================================================== - tcpdump -n -e -i -s 0 -w /tmp/cap +Test for both default path and for AVX512 path by adding EAL Parameter '--force-max-simd-bitwidth=512'. -Launch the userland ``testpmd`` application on DUT as follows:: +After DPDK v22.11, Intel® Ethernet 800 Series NIC with ICE supports tunneling packets on VF. +This test is used to test tunneling scenario and will enable Outer-IP and Outer-UDP checksum offload. +Configure the TX HW Offload:: - testpmd> set verbose 1 - # Enable hw checksum on rx port - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set sctp hw 0 - testpmd> set promisc 0 on - testpmd> port start all - - # Enable TSO on tx port - testpmd> tso set 800 1 - # Set fwd engine and start - - testpmd> set fwd csum - - Due to DPDK 236bc417e2da(app/testpmd: fix MAC header in checksum forward engine) changes the checksum - functions adds switches to control whether to exchange MAC address. - Currently, our test scripts are based on not exchanging MAC addresses, mac-swap needs to be disabled: - testpmd> csum mac-swap off 0 + 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 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: - testpmd> start + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS -Test IPv4() in scapy:: +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 +checksum, bad all checksum, good all checksum, each packet for multiple times, 10 times usually:: - sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/Raw(load=RandString(size=%s))], iface="%s", count = %s) + CSUM TUNNEL PACKETS + CSUM TUNNEL VLAN PACKETS -Test IPv6() in scapy:: +Check for the correct checksum insertion at the correct place. - sendp([Ether(dst="%s", src="52:00:00:00:00:00")/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/Raw(load=RandString(size=%s))], iface="%s", count = %s) +For VXLAN packets, we run an extra case on DCF:: + + 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 -Test case: csum fwd engine, use tunnel TSO -========================================== -In DPDK 22.11 release, Intel® Ethernet 800 Series NIC with ICE supports HW -TSO for tunneling packets. For the packets involved in this case, a ICE COMMON -DDP Package is required. +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 +checksum, bad all checksum, good all checksum, each packet for multiple times, 10 times usually:: -This test uses ``Scapy`` to send out one large tunneled TCP package. The dut -forwards package with tunnel TSO enable on tx port while rx port turns checksum -on. After package send out by TSO on tx port, the tester receives multiple small -TCP package. + CSUM TUNNEL PACKETS OF VXLAN + CSUM TUNNEL VLAN PACKETS OF VXLAN -Turn off tx port by ethtool on tester:: +Check for the correct checksum insertion at the correct place. - ethtool -K rx off tx off tso off gso off gro off lro off - ip l set up -Capture package rx port on tester:: +Test case 10: SW non-tunneling (w/o VLAN) +========================================= - tcpdump -n -e -i -s 0 -w /tmp/cap +This test is used to test tunneling scenario and will enable no checksum offload. +Configured in default. +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: -Launch the userland ``testpmd`` application on DUT as follows:: + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) - testpmd> set verbose 1 - # Enable hw checksum on rx port - testpmd> port stop all - testpmd> csum set ip hw 0 - testpmd> csum set tcp hw 0 - testpmd> csum set udp hw 0 - testpmd> csum set sctp hw 0 - testpmd> csum set outer-ip hw 0 - testpmd> csum set outer-udp hw 0 - testpmd> csum parse-tunnel on 0 - testpmd> set promisc 0 on - testpmd> port start all +Check for the correct checksum insertion at the correct place. + +For PMD not supporting VLAN defaultly, we run an extra case:: + + vlan set filter on 0 + rx_vlan add 100 0 - # Enable TSO on tx port - testpmd> tunnel_tso set 800 1 - # Set fwd engine and start +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: - testpmd> set fwd csum - testpmd> start + CSUM NON-TUNNEL VLAN PACKETS -Test IPv4() in scapy:: +Check for the correct checksum insertion at the correct place. - for one_outer_packet in outer_packet_list: - sendp([Ether(dst="%s", src="52:00:00:00:00:00")/one_outer_packet/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/Raw(load=RandString(size=%s))], iface="%s", count = %s) -Test IPv6() in scapy:: +Test case 11: SW tunneling (w/o DCF, w/o AVX512) +================================================= - for one_outer_packet in outer_packet_list: - sendp([Ether(dst="%s", src="52:00:00:00:00:00")/one_outer_packet/IPv6(src="FE80:0:0:0:200:1FF:FE00:200", dst="3555:5555:6666:6666:7777:7777:8888:8888")/TCP(sport=1021,dport=1021)/Raw(load=RandString(size=%s))], iface="%s", count = %s) +Test for both default path and for AVX512 path by adding EAL Parameter '--force-max-simd-bitwidth=512'. -Test case: csum fwd engine, use TSO, on scalar path -=================================================== -These set of cases based on existing cases are designed for better case managment for -regression test. +After DPDK v22.11, Intel® Ethernet 800 Series NIC with ICE supports tunneling packets on VF. +This test is used to test tunneling scenario and will enable no checksum offload. +Configure the TX HW Offload:: -Start testpmd with eal parameter --force-max-simd-bitwidth=64. Based on test steps of -'csum fwd engine, use TSO'. + csum parse-tunnel on 1 + +Send packets of below with bad IP checksum, bad L4 checksum, bad all checksum, good all checksum, +each packet for multiple times, 10 times usually:: -Test case: csum fwd engine, use TSO, on sse path -================================================ + CSUM NON-TUNNEL PACKETS + CSUM NON-TUNNEL VLAN PACKETS (for i40e and ice) + +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 +checksum, bad all checksum, good all checksum, each packet for multiple times, 10 times usually:: + + CSUM TUNNEL PACKETS (common packets for common DDP) + CSUM TUNNEL VLAN PACKETS (for i40e and ice, common packets for common DDP) + +Check for the correct checksum insertion at the correct place. + +For VXLAN packets, we run an extra case on DCF:: + + csum parse-tunnel on 1 + rx_vxlan_port add 4789 0 -Test case: csum fwd engine, use TSO, on avx2 path +Send packets of below with bad Outer-IP checksum, bad Outer-L4 checksum, bad IP checksum, bad L4 +checksum, bad all checksum, good all checksum, each packet for multiple times, 10 times usually:: + + CSUM TUNNEL PACKETS OF VXLAN + CSUM TUNNEL VLAN PACKETS OF VXLAN + +Check for the correct checksum insertion at the correct place. + + +Test case 12: TSO (w/o VLAN, w/o DCF) ================================================= -Test case: csum fwd engine, use TSO, on avx512 path -=================================================== +This test is used to test TSO and will enable all HW checksum offload with TSO. +Configure the TX HW Offload:: -Test case: csum fwd engine, use tunnel TSO, on scalar path -========================================================== + 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 800 1 + +Send packets of below with bad all checksum, good all checksum, payload size ranges +in 128, 800, 801, 1700, 2500, 8500, each packet for multiple times, 10 times usually:: -Test case: csum fwd engine, use tunnel TSO, on sse path -======================================================= + TSO NON-TUNNEL PACKETS + TSO TUNNEL PACKETS + UFO NON-TUNNEL PACKETS + UFO TUNNEL PACKETS + +Check for the correct checksum insertion at the correct place, check for the correct payload segmentation. + + +Test case 13: TSO tunneling (w/o VLAN, w/o DCF) +=========================================================== -Test case: csum fwd engine, use tunnel TSO, on avx2 path -======================================================== +This test is used to test Tunnel TSO and will enable all HW checksum offload with Tunnel TSO. +Configure the TX HW Offload:: + + 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 800 1 + +Send packets of below with bad all checksum, good all checksum, payload size ranges +in 128, 800, 801, 1700, 2500, 8500, each packet for multiple times, 10 times usually:: + + TSO NON-TUNNEL PACKETS + TSO TUNNEL PACKETS + UFO NON-TUNNEL PACKETS + UFO TUNNEL PACKETS + +Check for the correct checksum insertion at the correct place, check for the correct payload segmentation. + + +Test case 14: TSO combine (w/o VLAN, w/o DCF, w/o AVX512) +========================================================= + +This test is used to test TSO and Tunnel TSO, will enable all HW checksum offload with TSO and Tunnel TSO. +Configure the TX HW Offload:: + + 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 800 1 + tunnel_tso set 800 1 + +Send packets of below with bad all checksum, good all checksum, payload size ranges +in 128, 800, 801, 1700, 2500, 8500, each packet for multiple times, 10 times usually:: + + TSO NON-TUNNEL PACKETS + TSO TUNNEL PACKETS + UFO NON-TUNNEL PACKETS + UFO TUNNEL PACKETS + +Check for the correct checksum insertion at the correct place, check for the correct payload segmentation. -Test case: csum fwd engine, use tunnel TSO, on avx512 path -========================================================== 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", "# ")