From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4EBBE456B8; Fri, 26 Jul 2024 16:14:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3BC4E42ED5; Fri, 26 Jul 2024 16:14:15 +0200 (CEST) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by mails.dpdk.org (Postfix) with ESMTP id F296842E7B for ; Fri, 26 Jul 2024 16:14:13 +0200 (CEST) Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-6ad8265e889so1068436d6.3 for ; Fri, 26 Jul 2024 07:14:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1722003253; x=1722608053; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l+LZ1Zgw7VQehF8bteqb2PAYzSokzN6hn4inm22LptM=; b=TBmhaxdSCyI4O4BvOfTdGiNvG40VWcs9DV8YLZt5MKA57liBfVGwoX2s0qSTGF3fw2 ejF2LjzercAzLjqqlMKOnH8ItCVze+s/WsIMtEBtdEf+1AkgdxNhvZyFmQdkLfCzmp+L bGG553LlzU5yec+JihLKALl6A/mk3sd4PeA+k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722003253; x=1722608053; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l+LZ1Zgw7VQehF8bteqb2PAYzSokzN6hn4inm22LptM=; b=PJdcOF8BM8NIJNXkPJX99kAqt8jdrYs2SDo3wxVM2wMgSoxCyc3ma98VXWD2FkOx2i yOFOPqH0rgirSZT3uQWKkUqUu2q6JjmJsM9zY9tkvcVgmA6YGQl9FtTuEE7hoaI14IDM LaLQGtZ/9T15S5zyeOd96Jsij2roY91GfSJhVKUpX5haOvohif1xIBWuMGGNNFuFsd7b KBk+rvm/mvE5FMcZJA9QIF5FRnDQZie9282S39JcYoxCNgPBMGcOuWvGs8LG06OQMbye AK7OHMG9TGf6CG6xHt0MDMGIILxWGyQSzzU7+p9rtXTr5uHfYhkpGNDc4Z7qqRqdkY/O y1ZQ== X-Gm-Message-State: AOJu0Yx/5dnpZnpOGu0pGYoZGJ1TYsDHdYPrGo48A1qTMkhaFNAGXlQN Ov9776PELj1vHE3E4fDIv9cUg2zt5TVf4+HGuyYyU7Go0M/Q2U9SRSOsps8stN0= X-Google-Smtp-Source: AGHT+IGb4jqLxJRfB+1jRvq3qFx2obXzQVEnDIUld78bU1hQujVv1mY9wdHxfIvxA7Y/HF+HP/2G1A== X-Received: by 2002:a05:6214:528a:b0:6b5:ddf3:c142 with SMTP id 6a1803df08f44-6bb3e31770amr40271556d6.5.1722003253099; Fri, 26 Jul 2024 07:14:13 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1257::1003]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb3fb01b05sm16781266d6.134.2024.07.26.07.14.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 07:14:12 -0700 (PDT) From: Nicholas Pratte To: probb@iol.unh.edu, dmarx@iol.unh.edu, jspewock@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech Cc: dev@dpdk.org, Nicholas Pratte Subject: [RFC PATCH v3 2/2] dts: Initial Implementation For Jumbo Frames Test Suite Date: Fri, 26 Jul 2024 10:13:07 -0400 Message-ID: <20240726141307.14410-3-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240726141307.14410-1-npratte@iol.unh.edu> References: <20240524183604.6925-1-npratte@iol.unh.edu> <20240726141307.14410-1-npratte@iol.unh.edu> 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 The following test suite reflects the fundamental outline for how the jumbo frames test suite may be designed. The test suite consists of five individual test cases, each of which assesses the behavior of packet transmissions for both 1518 byte and 9000 byte frames. The edge cases are ripped directly from the old DTS framework, and the general methodology is the same as well. The process, at this point, has been refactored to operate within the new DTS framework. Bugzilla ID: 1421 Signed-off-by: Nicholas Pratte --- dts/framework/config/conf_yaml_schema.json | 3 +- dts/tests/TestSuite_jumboframes.py | 182 +++++++++++++++++++++ 2 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 dts/tests/TestSuite_jumboframes.py diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json index f02a310bb5..a1028f128b 100644 --- a/dts/framework/config/conf_yaml_schema.json +++ b/dts/framework/config/conf_yaml_schema.json @@ -187,7 +187,8 @@ "enum": [ "hello_world", "os_udp", - "pmd_buffer_scatter" + "pmd_buffer_scatter", + "jumboframes" ] }, "test_target": { diff --git a/dts/tests/TestSuite_jumboframes.py b/dts/tests/TestSuite_jumboframes.py new file mode 100644 index 0000000000..dd8092f2a4 --- /dev/null +++ b/dts/tests/TestSuite_jumboframes.py @@ -0,0 +1,182 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2023-2024 University of New Hampshire +"""Jumbo frame consistency and compatibility test suite. + +The test suite ensures the consistency of jumbo frames transmission within +Poll Mode Drivers using a series of individual test cases. If a Poll Mode +Driver receives a packet that is greater than its assigned MTU length, then +that packet will be dropped, and thus not received. Likewise, if a Poll Mode Driver +receives a packet that is less than or equal to a its designated MTU length, then the +packet should be transmitted by the Poll Mode Driver, completing a cycle within the +testbed and getting received by the traffic generator. Thus, the following test suite +evaluates the behavior within all possible edge cases, ensuring that a test Poll +Mode Driver strictly abides by the above implications. +""" + +from scapy.layers.inet import IP # type: ignore[import-untyped] +from scapy.layers.l2 import Ether # type: ignore[import-untyped] +from scapy.packet import Raw # type: ignore[import-untyped] + +from framework.remote_session.testpmd_shell import TestPmdShell +from framework.test_suite import TestSuite + +IP_HEADER_LEN = 20 +ETHER_STANDARD_FRAME = 1500 +ETHER_JUMBO_FRAME_MTU = 9000 + + +class TestJumboframes(TestSuite): + """DPDK PMD jumbo frames test suite. + + Asserts the expected behavior of frames greater than, less then, or equal to + a designated MTU size in the testpmd application. If a packet size greater + than the designated testpmd MTU length is retrieved, the test fails. If a + packet size less than or equal to the designated testpmd MTU length is retrieved, + the test passes. + """ + + def set_up_suite(self) -> None: + """Set up the test suite. + + Setup: + Set traffic generator MTU lengths to a size greater than scope of all + test cases. + """ + self.tg_node.main_session.configure_port_mtu( + ETHER_JUMBO_FRAME_MTU + 200, self._tg_port_egress + ) + self.tg_node.main_session.configure_port_mtu( + ETHER_JUMBO_FRAME_MTU + 200, self._tg_port_ingress + ) + + def send_packet_and_verify(self, pktsize: int, should_receive: bool = True) -> None: + """Generate, send, and capture packets to verify that the sent packet was received or not. + + Generates a packet based on a specified size and sends it to the SUT. The desired packet's + payload size is calculated, and arbitrary, byte-sized characters are inserted into the + packet before sending. Packets are captured, and depending on the test case, packet + payloads are checked to determine if the sent payload was received. + + Args: + pktsize: Size of packet to be generated and sent. + should_receive: Indicate whether the test case expects to receive the packet or not. + """ + padding = pktsize - IP_HEADER_LEN + # Insert extra space for placeholder 'CRC' Error correction. + packet = Ether() / Raw(" ") / IP(len=pktsize) / Raw(load="X" * padding) + received_packets = self.send_packet_and_capture(packet) + found = any( + ("X" * padding) in str(packets.load) + for packets in received_packets + if hasattr(packets, "load") + ) + + if should_receive: + self.verify(found, "Did not receive packet") + else: + self.verify(not found, "Received packet") + + def test_jumboframes_normal_nojumbo(self) -> None: + """Assess the boundaries of packets sent less than or equal to the standard MTU length. + + PMDs are set to the standard MTU length of 1518 to assess behavior of sent packets less than + or equal to this size. Sends two packets: one that is less than 1518 bytes, and another that + is equal to 1518 bytes. The test case expects to receive both packets. + + Test: + Start testpmd and send packets of sizes 1517 and 1518. + """ + with TestPmdShell( + self.sut_node, tx_offloads=0x8000, mbuf_size=[9200], mbcache=200 + ) as testpmd: + testpmd.configure_port_mtu_all(ETHER_STANDARD_FRAME) + testpmd.start() + + self.send_packet_and_verify(ETHER_STANDARD_FRAME - 5) + self.send_packet_and_verify(ETHER_STANDARD_FRAME) + + def test_jumboframes_jumbo_nojumbo(self) -> None: + """Assess the boundaries of packets sent greater than standard MTU length. + + PMDs are set to the standard MTU length of 1518 bytes to assess behavior of sent packets + greater than this size. Sends one packet with a frame size of 1519. The test cases does + not expect to receive this packet. + + Test: + Start testpmd with standard MTU size of 1518. Send a packet of 1519 and verify it was + not received. + """ + with TestPmdShell( + self.sut_node, tx_offloads=0x8000, mbuf_size=[9200], mbcache=200 + ) as testpmd: + testpmd.configure_port_mtu_all(ETHER_STANDARD_FRAME) + testpmd.start() + + self.send_packet_and_verify(ETHER_STANDARD_FRAME + 5, False) + + def test_jumboframes_normal_jumbo(self) -> None: + """Assess the consistency of standard 1518 byte packets using a 9000 byte jumbo MTU length. + + PMDs are set to a jumbo frame size of 9000 bytes. Packets of sizes 1517 and 1518 are sent + to assess the boundaries of packets less than or equal to the standard MTU length of 1518. + The test case expects to receive both packets. + + Test: + Start testpmd with a jumbo frame size of 9000 bytes. Send a packet of 1517 and 1518 + and verify they were received. + """ + with TestPmdShell( + self.sut_node, tx_offloads=0x8000, mbuf_size=[9200], mbcache=200 + ) as testpmd: + testpmd.configure_port_mtu_all(ETHER_JUMBO_FRAME_MTU) + testpmd.start() + + self.send_packet_and_verify(ETHER_STANDARD_FRAME - 5) + self.send_packet_and_verify(ETHER_STANDARD_FRAME) + + def test_jumboframes_jumbo_jumbo(self) -> None: + """Assess the boundaries packets sent at an MTU size of 9000 bytes. + + PMDs are set to a jumbo frames size of 9000 bytes. Packets of size 1519, 8999, and 9000 + are sent. The test expects to receive all packets. + + Test: + Start testpmd with an MTU length of 9000 bytes. Send packets of size 1519, 8999, + and 9000 and verify that all packets were received. + """ + with TestPmdShell( + self.sut_node, tx_offloads=0x8000, mbuf_size=[9200], mbcache=200 + ) as testpmd: + testpmd.configure_port_mtu_all(ETHER_JUMBO_FRAME_MTU) + testpmd.start() + + self.send_packet_and_verify(ETHER_STANDARD_FRAME + 5) + self.send_packet_and_verify(ETHER_JUMBO_FRAME_MTU - 5) + self.send_packet_and_verify(ETHER_JUMBO_FRAME_MTU) + + def test_jumboframes_bigger_jumbo(self) -> None: + """Assess the behavior of packets send greater than a specified MTU length of 9000 bytes. + + PMDs are set to a jumbo frames size of 9000 bytes. A packet of size 9001 is sent to the SUT. + The test case does not expect to receive the packet. + + Test: + Start testpmd with an MTU length of 9000 bytes. Send a packet of 9001 bytes and verify + it was not received. + """ + with TestPmdShell( + self.sut_node, tx_offloads=0x8000, mbuf_size=[9200], mbcache=200 + ) as testpmd: + testpmd.configure_port_mtu_all(ETHER_JUMBO_FRAME_MTU) + testpmd.start() + + self.send_packet_and_verify(ETHER_JUMBO_FRAME_MTU + 5, False) + + def tear_down_suite(self) -> None: + """Tear down the test suite. + + Teardown: + Set the MTU size of the traffic generator back to the standard 1518 byte size. + """ + self.tg_node.main_session.configure_port_mtu(ETHER_STANDARD_FRAME, self._tg_port_egress) + self.tg_node.main_session.configure_port_mtu(ETHER_STANDARD_FRAME, self._tg_port_ingress) -- 2.44.0