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 0291045920; Fri, 6 Sep 2024 18:52:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2709242FCB; Fri, 6 Sep 2024 18:52:30 +0200 (CEST) Received: from mail-qv1-f97.google.com (mail-qv1-f97.google.com [209.85.219.97]) by mails.dpdk.org (Postfix) with ESMTP id D5DA942FC1 for ; Fri, 6 Sep 2024 18:52:28 +0200 (CEST) Received: by mail-qv1-f97.google.com with SMTP id 6a1803df08f44-6c358b725feso12589036d6.1 for ; Fri, 06 Sep 2024 09:52:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1725641548; x=1726246348; 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=gLLqJsovZATzXUo+Xw9nPYIKQgPrpxcQ/X5sVfDTG/g=; b=SVpjxBA/LM6YzbsQREZySr1LTJhKGomc6qNG7YDZYsoFD6Be6NKFsNT56KLL37Cg6v 8w5FV2UPUU91aeKVGIq2NeR5bFkNUi7ElJDo6r7KIz/BgTxyqkmJlxdAOC/eGs6N1wIJ 4EIu7tkDSirdhGUkij6dmIUWlCEN7Eeo2iWnA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725641548; x=1726246348; 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=gLLqJsovZATzXUo+Xw9nPYIKQgPrpxcQ/X5sVfDTG/g=; b=xH67RYkS505kAup9CWg8vbFfRsp5w1trwxd4oT/CjYUh8cTk/0hL2ZORIjjl69qNqq Tz6cYbevBoxB4arWTMLoRAjbYmazob4FLrtN6IhOGgdrPMgojCplqw1qsiHPZFNiC4XT 8uNe55IL1MXfUREAF627bs7lZbtBgdGS7Qm4r5TFVN/rH21wenuNILbFQgjrnOfvh+pp nT/RkLKLKn7HFcAeqxXQAxTEH8Swrpu0o/O8R5smhh1vvglwP5OvJR2oO80Q8KfZHugH hGqkeodMO+KUP9uThnBtE5xJkiWeiHaoML2Pv/03iXcWR6L8u14H2zE2Wp+hVeozTIha Wj8w== X-Gm-Message-State: AOJu0YwDn64Bla7xwYLwJH2J9OWgMqOWr7EIwviKRwi/seY2DCQj/VGi d/RJrQHQD5V+DVndIV/WkCRYNk51bto5nueqscIquIReT9Sq/YWKmNmxaFW9WfqGLcbrtUFn4J2 Al0YcCQLrdArGhWH4alMZVKGXI1oc2mUNAhbvy8XWWQho1dbm X-Google-Smtp-Source: AGHT+IE7LbeT/+DrQobMfV262Wqj8ld0MBPFX/DEh3obNg3LFTfbghg8gbcAu3LVLGGqxncm0UVB2ITERwro X-Received: by 2002:a05:6214:3bca:b0:6c3:6de3:fa06 with SMTP id 6a1803df08f44-6c36de3fb89mr198104436d6.9.1725641548134; Fri, 06 Sep 2024 09:52:28 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id 6a1803df08f44-6c520417920sm2258056d6.49.2024.09.06.09.52.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Sep 2024 09:52:28 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1257::1083]) by postal.iol.unh.edu (Postfix) with ESMTP id 5601E6050A6D; Fri, 6 Sep 2024 12:52:27 -0400 (EDT) From: jspewock@iol.unh.edu To: npratte@iol.unh.edu, juraj.linkes@pantheon.tech, Honnappa.Nagarahalli@arm.com, wathsala.vithanage@arm.com, alex.chapman@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, Luca.Vizzarro@arm.com, thomas@monjalon.net Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v2 2/2] dts: add pf smoke testing suite Date: Fri, 6 Sep 2024 12:51:51 -0400 Message-ID: <20240906165151.14668-3-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240906165151.14668-1-jspewock@iol.unh.edu> References: <20240806185631.335737-1-jspewock@iol.unh.edu> <20240906165151.14668-1-jspewock@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 From: Jeremy Spewock This patch adds a smoke testing suite for Physical Function features. The goal of this suite is to test some of the most basic features of DPDK on a physical function and bail out early if any of these features aren't supported as expected. Unlike DTS smoke tests, these ones are not included as a switch in the config file and thus are an additional test suite that developers can include alongside others at their own discretion. Depends-on: patch-143594 ("dts: add send_packets to test suites and rework packet addressing") Signed-off-by: Jeremy Spewock --- dts/framework/config/conf_yaml_schema.json | 3 +- dts/tests/TestSuite_pf_smoke_tests.py | 121 +++++++++++++++++++++ 2 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 dts/tests/TestSuite_pf_smoke_tests.py diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json index f02a310bb5..910134f9e4 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", + "pf_smoke_tests" ] }, "test_target": { diff --git a/dts/tests/TestSuite_pf_smoke_tests.py b/dts/tests/TestSuite_pf_smoke_tests.py new file mode 100644 index 0000000000..287132e9dd --- /dev/null +++ b/dts/tests/TestSuite_pf_smoke_tests.py @@ -0,0 +1,121 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 University of New Hampshire +"""Physical Function (PF) smoke testing suite. + +This test suite tests some of the more common DPDK functionality on a PF. Things such as +jumbroframes, Receive Side Scaling (RSS) functions, and being able to modify the number of queues +at runtime should all be supported by PMDs that are capable of running DPDK. Since this is a smoke +testing suite, it is considered a blocking suite that will stop following ones from running. +""" + +from typing import ClassVar + +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.exception import InteractiveCommandExecutionError, TestCaseVerifyError +from framework.params.testpmd import SimpleForwardingModes +from framework.remote_session.testpmd_shell import TestPmdShell +from framework.test_suite import TestSuite + + +class TestPfSmokeTests(TestSuite): + """DPDK Physical Function Testing Suite. + + This test suite is designed to verify the basic functions of DPDK on a PF. The MTU of the ports + on the traffic generator are increased to 9000 to support jumboframes for one of the test + cases, and then reverted back to 1500 once the test suite is complete. + + Attributes: + is_blocking: This test suite will block the execution of all other test suites + in the build target after it. + """ + + is_blocking: ClassVar[bool] = True + jumbo_frame_len: ClassVar[int] = 9000 + num_queues: int = 4 + + def set_up_suite(self) -> None: + """Increase the MTU of the traffic generator to support jumboframes.""" + for port_link in self._port_links: + self.tg_node.main_session.configure_port_mtu(self.jumbo_frame_len, port_link.tg_port) + + def test_jumbo_frame_support(self) -> None: + """Verify that the PF is able to send and receive jumboframes.""" + with TestPmdShell( + self.sut_node, + max_pkt_len=self.jumbo_frame_len, + mbuf_size=[self.jumbo_frame_len + 128], + forward_mode=SimpleForwardingModes.mac, + ) as testpmd: + testpmd.start() + # Take 26 bytes off the MTU size to account for Ethernet headers + payload_len = self.jumbo_frame_len - 26 + packet = Ether() / Raw("X" * payload_len) + recv = self.send_packet_and_capture(packet) + self.verify( + any(hasattr(p, "load") and "X" * 20 in str(p.load) for p in recv), + f"Jumboframe was not received even when MTU was set to {self.jumbo_frame_len}.", + ) + + def test_rss_functionality(self) -> None: + """Test that Receive Side Scaling functions are working as intended. + + The primary things to test in this case are that packets that are sent with different + destination IP addresses are handled by different queues and that the RSS hash of every + packet is unique. Verification of these functionalities is done by sending packets with + a unique source MAC addresses so that the packets sent by this test suite can be + differentiated from other packets sent to the same port. + """ + with TestPmdShell( + self.sut_node, + forward_mode=SimpleForwardingModes.rxonly, + rx_queues=self.num_queues, + tx_queues=self.num_queues, + ) as testpmd: + testpmd.set_verbose(1) + src_max = "00:00:00:00:00:01" + send_pkts = [ + Ether(src=src_max) / IP(dst=f"192.168.0.{i+1}") for i in range(self.num_queues * 4) + ] + testpmd.start() + self.send_packets(send_pkts) + verbose_stats = TestPmdShell.extract_verbose_output(testpmd.stop()) + # Filter down the packets to only the ones with the correct source MAC + verbose_stats = list(filter(lambda x: x.src_mac == src_max, verbose_stats)) + self.verify( + len(verbose_stats) > 0, "Testpmd did not receive any packets from the test case." + ) + rss_hashes = [p.rss_hash for p in verbose_stats] + self.verify( + all(rss_h is not None for rss_h in rss_hashes), + "At least one packet did not have an RSS hash.", + ) + self.verify( + len(set(rss_hashes)) == len(rss_hashes), + "RSS hashes were not unique.", + ) + self.verify( + all(any(q == p.queue_id for p in verbose_stats) for q in range(self.num_queues)), + "Not all ports were used when packets were sent with different destination " + "addresses.", + ) + + def test_runtime_modify_num_queues(self) -> None: + """Ensure that the number of queues on a port can be changed at runtime.""" + with TestPmdShell( + self.sut_node, rx_queues=self.num_queues, tx_queues=self.num_queues + ) as testpmd: + try: + testpmd.set_num_queues_all(2, True, verify=True) + testpmd.set_num_queues_all(2, False, verify=True) + except InteractiveCommandExecutionError as e: + raise TestCaseVerifyError( + "Failed to change the number of queues on a port at runtime." + ) from e + + def tear_down_suite(self) -> None: + """Revert MTU back to a standard value of 1500.""" + for port_link in self._port_links: + self.tg_node.main_session.configure_port_mtu(1500, port_link.tg_port) -- 2.46.0