From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (unknown [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96891460A4; Thu, 16 Jan 2025 19:43:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 780B740E22; Thu, 16 Jan 2025 19:43:23 +0100 (CET) Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) by mails.dpdk.org (Postfix) with ESMTP id C43B7402D6 for ; Thu, 16 Jan 2025 19:43:22 +0100 (CET) Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-7be3d681e74so104111185a.0 for ; Thu, 16 Jan 2025 10:43:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1737053002; x=1737657802; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=lz+j3XWA271pgKAjjUhtT+1yCDcBcbFo2EfHtNjyjrY=; b=F79LtWgiJiMOg+AztLisHC0WYaPV0uw+Wwz7Ax/EQKdFtw/g0mJiMK5NMnamq0B5e4 IT8gwW4qQNQeNOhm/EoOsQvIe+zw4AzJUAgNnr9lQ5M0YkoPY4rwAjHI52y1Ke28pKR8 VeIMvupRs/rVm8NXL7U0waPHCjfwqwFFWS/uM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737053002; x=1737657802; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lz+j3XWA271pgKAjjUhtT+1yCDcBcbFo2EfHtNjyjrY=; b=ozOAn3zLNCC0b7XiYacQFiLqqugHWRelImolkdC9MFcoCOQK7Z+7fpmktmfmQV/lL1 80QZtFO9VgJUuS9umTyiva8bvtluS/zK/7RPZ8XSIPv0oqS+G6/kGQZC4qH2mP02kZMy k6+HSVJrc0XyWb2jPScKpH5P1U8OxqLGi0/9MsDy5DfA9f1P2RHuQrT94f28Q7RSh6fG nnfIdr0B3oPXxvYV3L3W8AmL/A2zZKaSai2kuoYMX66//Ottcm5ltAk+l3GBXSm4PC4r i4I2s0KArf/2M8TqQk1ADvX8eo6gUz+ZpO4XBb5FNkuHv8IZXyXEt2uFpanLLgc94jUj f8hA== X-Gm-Message-State: AOJu0Yws+zHsYeHVsErypB23lZWJSMILGax9bOA5yOR29st93LqsHC8y dRBCUJmehknnGJ2/w0iCOBOtePNfsLVRE2tiDcb0nY1OPAzBY0w1em1Tlyj18wU= X-Gm-Gg: ASbGncvWZQA8wiUdsz6ua/63RiKuzdW9WIQoK0plHsRcPA2U78P0EcL2GKDncgnL2PA nOHZpbALLq10pvv8krFKzkZW4GvKOjoRYE5+YMQYfRGFot8EwW9KHm0oaycAJzJfL3Og3OahHb1 YBL0hfr1P+ksa2cmN7+mMBXKZShlP+Rg/1e+19dvnWL/+vDIwACTRdMHG969wkmNa7zc7t2Qs7q aVuGbbeLdH7JWfFVakF0a5c46yriV91UjOVUcNOEW/4MmQhF+sowc4JGwUDy55RblkIWa4akKMB EURbSkpyEMBc5apX4GSRo7w7paE= X-Google-Smtp-Source: AGHT+IFcWKyQ6xOoxw1rm28kguv1FdfPvDtLeFMEcuQqsKp66Po2Yp78O8eFzVHnNPk4/Y+wEsT7uA== X-Received: by 2002:a05:620a:31a9:b0:7b6:ea91:d886 with SMTP id af79cd13be357-7bcd97b5a4amr5265960785a.39.1737053002011; Thu, 16 Jan 2025 10:43:22 -0800 (PST) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614897d6sm30371085a.62.2025.01.16.10.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 10:43:21 -0800 (PST) From: Dean Marx To: probb@iol.unh.edu, npratte@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com Cc: dev@dpdk.org, Dean Marx Subject: [PATCH v1] dts: fix checksum suite docstring/variable format Date: Thu, 16 Jan 2025 13:43:22 -0500 Message-ID: <20250116184322.2750-1-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Fixes checksum offload test suite docstring format by adding steps and verify sections. Changes variables formatted in camel case to snake case to fit python standards. Fixes: 8c9a7471a0e6 ("dts: add checksum offload test suite") Signed-off-by: Dean Marx --- dts/tests/TestSuite_checksum_offload.py | 127 ++++++++++++++++++------ 1 file changed, 99 insertions(+), 28 deletions(-) diff --git a/dts/tests/TestSuite_checksum_offload.py b/dts/tests/TestSuite_checksum_offload.py index c1680bd388..4c9520917a 100644 --- a/dts/tests/TestSuite_checksum_offload.py +++ b/dts/tests/TestSuite_checksum_offload.py @@ -57,7 +57,7 @@ def send_packets_and_verify( packet_list: List of Scapy packets to send and verify. load: Raw layer load attribute in the sent packet. should_receive: Indicates whether the packet should be received - by the traffic generator. + by the traffic generator. """ for i in range(0, len(packet_list)): received_packets = self.send_packet_and_capture(packet=packet_list[i]) @@ -70,15 +70,15 @@ def send_packets_and_verify( ) def send_packet_and_verify_checksum( - self, packet: Packet, goodL4: bool, goodIP: bool, testpmd: TestPmdShell, id: str + self, packet: Packet, good_L4: bool, good_IP: bool, testpmd: TestPmdShell, id: str ) -> None: """Send packet and verify verbose output matches expected output. Args: packet: Scapy packet to send to DUT. - goodL4: Verifies RTE_MBUF_F_RX_L4_CKSUM_GOOD in verbose output + good_L4: Verifies RTE_MBUF_F_RX_L4_CKSUM_GOOD in verbose output if :data:`True`, or RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN if :data:`False`. - goodIP: Verifies RTE_MBUF_F_RX_IP_CKSUM_GOOD in verbose output + good_IP: Verifies RTE_MBUF_F_RX_IP_CKSUM_GOOD in verbose output if :data:`True`, or RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN if :data:`False`. testpmd: Testpmd shell session to analyze verbose output of. id: The destination mac address that matches the sent packet in verbose output. @@ -88,10 +88,10 @@ def send_packet_and_verify_checksum( verbose_output = testpmd.extract_verbose_output(testpmd.stop()) for testpmd_packet in verbose_output: if testpmd_packet.dst_mac == id: - isIP = PacketOffloadFlag.RTE_MBUF_F_RX_IP_CKSUM_GOOD in packet.ol_flags - isL4 = PacketOffloadFlag.RTE_MBUF_F_RX_L4_CKSUM_GOOD in packet.ol_flags - self.verify(isL4 == goodL4, "Layer 4 checksum flag did not match expected checksum flag.") - self.verify(isIP == goodIP, "IP checksum flag did not match expected checksum flag.") + is_IP = PacketOffloadFlag.RTE_MBUF_F_RX_IP_CKSUM_GOOD in packet.ol_flags + is_L4 = PacketOffloadFlag.RTE_MBUF_F_RX_L4_CKSUM_GOOD in packet.ol_flags + self.verify(is_L4 == good_L4, "Layer 4 checksum flag did not match expected checksum flag.") + self.verify(is_IP == good_IP, "IP checksum flag did not match expected checksum flag.") def setup_hw_offload(self, testpmd: TestPmdShell) -> None: """Sets IP, UDP, and TCP layers to hardware offload. @@ -108,7 +108,18 @@ def setup_hw_offload(self, testpmd: TestPmdShell) -> None: @func_test def test_insert_checksums(self) -> None: - """Enable checksum offload insertion and verify packet reception.""" + """Enable checksum offload insertion and verify packet reception. + + Steps: + Create a list of packets to send. + Launch testpmd with the necessary configuration. + Enable checksum hardware offload. + Send list of packets. + + Verify: + Verify packets are received. + Verify packet checksums match the expected flags. + """ mac_id = "00:00:00:00:00:01" payload = b"xxxxx" packet_list = [ @@ -125,12 +136,22 @@ def test_insert_checksums(self) -> None: self.send_packets_and_verify(packet_list=packet_list, load=payload, should_receive=True) for i in range(0, len(packet_list)): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=True, goodIP=True, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=True, good_IP=True, testpmd=testpmd, id=mac_id ) @func_test def test_no_insert_checksums(self) -> None: - """Disable checksum offload insertion and verify packet reception.""" + """Disable checksum offload insertion and verify packet reception. + + Steps: + Create a list of packets to send. + Launch testpmd with the necessary configuration. + Send list of packets. + + Verify: + Verify packets are received. + Verify packet checksums match the expected flags. + """ mac_id = "00:00:00:00:00:01" payload = b"xxxxx" packet_list = [ @@ -146,12 +167,22 @@ def test_no_insert_checksums(self) -> None: self.send_packets_and_verify(packet_list=packet_list, load=payload, should_receive=True) for i in range(0, len(packet_list)): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=True, goodIP=True, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=True, good_IP=True, testpmd=testpmd, id=mac_id ) @func_test def test_l4_rx_checksum(self) -> None: - """Tests L4 Rx checksum in a variety of scenarios.""" + """Tests L4 Rx checksum in a variety of scenarios. + + Steps: + Create a list of packets to send with UDP/TCP fields. + Launch testpmd with the necessary configuration. + Enable checksum hardware offload. + Send list of packets. + + Verify: + Verify packet checksums match the expected flags. + """ mac_id = "00:00:00:00:00:01" packet_list = [ Ether(dst=mac_id) / IP() / UDP(), @@ -165,16 +196,26 @@ def test_l4_rx_checksum(self) -> None: self.setup_hw_offload(testpmd=testpmd) for i in range(0, 2): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=True, goodIP=True, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=True, good_IP=True, testpmd=testpmd, id=mac_id ) for i in range(2, 4): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=False, goodIP=True, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=False, good_IP=True, testpmd=testpmd, id=mac_id ) @func_test def test_l3_rx_checksum(self) -> None: - """Tests L3 Rx checksum hardware offload.""" + """Tests L3 Rx checksum hardware offload. + + Steps: + Create a list of packets to send with IP fields. + Launch testpmd with the necessary configuration. + Enable checksum hardware offload. + Send list of packets. + + Verify: + Verify packet checksums match the expected flags. + """ mac_id = "00:00:00:00:00:01" packet_list = [ Ether(dst=mac_id) / IP() / UDP(), @@ -188,16 +229,26 @@ def test_l3_rx_checksum(self) -> None: self.setup_hw_offload(testpmd=testpmd) for i in range(0, 2): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=True, goodIP=True, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=True, good_IP=True, testpmd=testpmd, id=mac_id ) for i in range(2, 4): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=True, goodIP=False, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=True, good_IP=False, testpmd=testpmd, id=mac_id ) @func_test def test_validate_rx_checksum(self) -> None: - """Verify verbose output of Rx packets matches expected behavior.""" + """Verify verbose output of Rx packets matches expected behavior. + + Steps: + Create a list of packets to send. + Launch testpmd with the necessary configuration. + Enable checksum hardware offload. + Send list of packets. + + Verify: + Verify packet checksums match the expected flags. + """ mac_id = "00:00:00:00:00:01" packet_list = [ Ether(dst=mac_id) / IP() / UDP(), @@ -215,21 +266,31 @@ def test_validate_rx_checksum(self) -> None: self.setup_hw_offload(testpmd=testpmd) for i in range(0, 4): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=True, goodIP=True, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=True, good_IP=True, testpmd=testpmd, id=mac_id ) for i in range(4, 6): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=False, goodIP=False, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=False, good_IP=False, testpmd=testpmd, id=mac_id ) for i in range(6, 8): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=False, goodIP=True, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=False, good_IP=True, testpmd=testpmd, id=mac_id ) @requires(NicCapability.RX_OFFLOAD_VLAN) @func_test def test_vlan_checksum(self) -> None: - """Test VLAN Rx checksum hardware offload and verify packet reception.""" + """Test VLAN Rx checksum hardware offload and verify packet reception. + + Steps: + Create a list of packets to send with VLAN fields. + Launch testpmd with the necessary configuration. + Enable checksum hardware offload. + Send list of packets. + + Verify: + Verify packet checksums match the expected flags. + """ mac_id = "00:00:00:00:00:01" payload = b"xxxxx" packet_list = [ @@ -246,17 +307,27 @@ def test_vlan_checksum(self) -> None: self.send_packets_and_verify(packet_list=packet_list, load=payload, should_receive=True) for i in range(0, 2): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=False, goodIP=False, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=False, good_IP=False, testpmd=testpmd, id=mac_id ) for i in range(2, 4): self.send_packet_and_verify_checksum( - packet=packet_list[i], goodL4=False, goodIP=True, testpmd=testpmd, id=mac_id + packet=packet_list[i], good_L4=False, good_IP=True, testpmd=testpmd, id=mac_id ) @requires(NicCapability.RX_OFFLOAD_SCTP_CKSUM) @func_test def test_validate_sctp_checksum(self) -> None: - """Test SCTP Rx checksum hardware offload and verify packet reception.""" + """Test SCTP Rx checksum hardware offload and verify packet reception. + + Steps: + Create a list of packets to send with SCTP fields. + Launch testpmd with the necessary configuration. + Enable checksum hardware offload. + Send list of packets. + + Verify: + Verify packet checksums match the expected flags. + """ mac_id = "00:00:00:00:00:01" packet_list = [ Ether(dst=mac_id) / IP() / SCTP(), @@ -268,8 +339,8 @@ def test_validate_sctp_checksum(self) -> None: testpmd.csum_set_hw(layers=ChecksumOffloadOptions.sctp) testpmd.start() self.send_packet_and_verify_checksum( - packet=packet_list[0], goodL4=True, goodIP=True, testpmd=testpmd, id=mac_id + packet=packet_list[0], good_L4=True, good_IP=True, testpmd=testpmd, id=mac_id ) self.send_packet_and_verify_checksum( - packet=packet_list[1], goodL4=False, goodIP=True, testpmd=testpmd, id=mac_id + packet=packet_list[1], good_L4=False, good_IP=True, testpmd=testpmd, id=mac_id ) -- 2.44.0