From patchwork Wed Jul 12 20:33:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 129513 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 D70C242E58; Wed, 12 Jul 2023 22:33:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D0C2540F17; Wed, 12 Jul 2023 22:33:33 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 88A09400D5 for ; Wed, 12 Jul 2023 22:33:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689194011; x=1720730011; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=47MdeBddIPFx3MhPlUVxwgl5+jsvQU16HMUR6NikoCc=; b=GMGIUBqiVsT8wKk2tG4eJ1lWU8+vDqpaAYCAiv3LJprJEv2oe1c7L5Mb ouCx3Q2r5kKt7scQEvaGBwx00Xc/EeecfJqTAa1DMqZ2SvdhfIhpbSHUD GNr9sBcoHhVQLsfwD5JlkFmml5b2+iFYDvv7UDh7r2LFiVIPpGsuxOdlK hP/I7Gev14wNUeKKy4RfnHpU3QRYCQFsvD9DP+0OD/9VWyfvVQssJtq84 aSoVNT+eRQLrl/NLAARbuc+aUro15i6pN4NgmphIV+DxXHjQP/wppyDCx 1K63PjWkwfaGWpgV5z/ia4uS+pOchj6A9SWmouLBAcYLOlzf2AaJAJE55 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10769"; a="362467056" X-IronPort-AV: E=Sophos;i="6.01,200,1684825200"; d="scan'208";a="362467056" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 13:33:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10769"; a="715696959" X-IronPort-AV: E=Sophos;i="6.01,200,1684825200"; d="scan'208";a="715696959" Received: from dpdk-xuke-host.sh.intel.com ([10.67.114.220]) by orsmga007.jf.intel.com with ESMTP; 12 Jul 2023 13:33:28 -0700 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, tarcadia@qq.com, Jin Ling Subject: [DTS][Patch V1 1/2] test_plans/checksum_offload: Refactor checksum_offload case. Date: Wed, 12 Jul 2023 20:33:33 +0000 Message-Id: <20230712203334.2032445-2-ke1.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230712203334.2032445-1-ke1.xu@intel.com> References: <20230712203334.2032445-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 Wed Jul 12 20:33:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ke Xu X-Patchwork-Id: 129514 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 0F78042E58; Wed, 12 Jul 2023 22:33:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 094084114A; Wed, 12 Jul 2023 22:33:36 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 237DB4114A for ; Wed, 12 Jul 2023 22:33:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689194014; x=1720730014; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XgzpKhGj9h7oCkrZo5SYPCIZLfst2+FFxF5Cu1vmD00=; b=g8f57qjSgtCfkmMgFA89rHG/aQftcw2HBrMJZt0G7CqOAVHNXE9FCKcC g+MM8h2GHinNRffF9K2iIdf+Y0z9i6UTxKvbVxcXV1TEYbwNsltxCQk76 FzAZ9pFjniBHKpcdx1fZMliZbZNCOMoiUm9kUT/1up2V1bhWp4aVt4WGX qZR2HE7io9del6o15LEAHWq/db4Y5jk1cAMA25IXNewJQCSgwX4K9+eku ksT9GJZsFd9O7ZHLCdS9H4u3wmZ1ZCs3E0WqG4WR70pERFdhL4FJ46d09 h18GE1zPcIA2vkaOPc68FQVobbG8QQQh1gcQzFjy2GluyFDgf4bZcn48M w==; X-IronPort-AV: E=McAfee;i="6600,9927,10769"; a="362467076" X-IronPort-AV: E=Sophos;i="6.01,200,1684825200"; d="scan'208";a="362467076" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 13:33:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10769"; a="715696962" X-IronPort-AV: E=Sophos;i="6.01,200,1684825200"; d="scan'208";a="715696962" Received: from dpdk-xuke-host.sh.intel.com ([10.67.114.220]) by orsmga007.jf.intel.com with ESMTP; 12 Jul 2023 13:33:30 -0700 From: Ke Xu To: dts@dpdk.org Cc: ke1.xu@intel.com, tarcadia@qq.com Subject: [DTS][Patch V1 2/2] tests/checksum_offload: Refactor checksum_offload case. Date: Wed, 12 Jul 2023 20:33:34 +0000 Message-Id: <20230712203334.2032445-3-ke1.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230712203334.2032445-1-ke1.xu@intel.com> References: <20230712203334.2032445-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 | 1766 ++++++++++++++------------- 1 file changed, 941 insertions(+), 825 deletions(-) diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py index 0214231c..c41b1d65 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 +import tests.offload_common as offload +from framework.dut import Dut from framework.exception import VerifyFailure 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,775 @@ 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 + 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): + 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=(self.kdriver != "ice"), + allow_rx_bad_outer_l4=(self.kdriver != "ice"), ) - sniff_src = "52:00:00:00:00:00" - result = dict() + def test_checksum_tunnel_hw_outer_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 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=(self.kdriver != "ice"), + allow_rx_bad_outer_l4=(self.kdriver != "ice"), + ) - 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): + 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=(self.kdriver != "ice"), + allow_rx_bad_outer_l4=(self.kdriver != "ice"), ) - 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): + 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=(self.kdriver != "ice"), + allow_rx_bad_outer_l4=(self.kdriver != "ice"), + ) - 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): + 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=(self.kdriver != "ice"), + allow_rx_bad_outer_l4=(self.kdriver != "ice"), ) - 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 +1149,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): """