From patchwork Mon Mar 11 15:43:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Spewock X-Patchwork-Id: 138159 X-Patchwork-Delegate: thomas@monjalon.net 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 89B1543C89; Mon, 11 Mar 2024 16:44:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 46D5740A87; Mon, 11 Mar 2024 16:44:54 +0100 (CET) Received: from mail-pj1-f100.google.com (mail-pj1-f100.google.com [209.85.216.100]) by mails.dpdk.org (Postfix) with ESMTP id 6381040A87 for ; Mon, 11 Mar 2024 16:44:53 +0100 (CET) Received: by mail-pj1-f100.google.com with SMTP id 98e67ed59e1d1-29bbff1505dso1341254a91.0 for ; Mon, 11 Mar 2024 08:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1710171892; x=1710776692; 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=azS1COg8qyO8b0ezY6bm30EXaPEL2CnFBabHOARvho4=; b=EUVYXhZm0e3q9InBlVdBwNKAbKyqnHUvcceQClyzTbdIlocaj/RO0uyNo5KO/hEI87 I3sw6o2fyfwamYe4qBEDmhKZookszcIT8NMooXQ0/+2mbOLP76v/ajJY3/5mj2AE/Zjh 4zVZom8BiA7lXbQwTZtmRQ++lR0UwBSgN2J7I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171892; x=1710776692; 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=azS1COg8qyO8b0ezY6bm30EXaPEL2CnFBabHOARvho4=; b=rlRDk5r3mjw3AeTkI1taMBzGg1+FEmLssueFCJ893CKLKQJOAoE+mSCX5PH9QQaFxU fONRFEyR6WcNuVms3FkpVO0smM/2xm3sJgM6H5SN5VX6sARWXuYBEWIA5Ie2/CnQRkF2 ga7VSq+hQsSDmWRIz/3U4UbDJuMBFFTtA6QKIqnzphze2bdxbbZbj+pLs1eQCAf9fW/k CGPtN+o4YT4Nhb0eyc8MaHZQyQRVh9r7hXfiqeYfPXJ4YuAIhzaGNjYA7Olg3n4b8Dn1 JrIXaxPEHk/EWzJlNeUlx5cp16wHdFmoEX22GgjUA3MNRgFOBoDGYsPCxKQugsAyjsAP x0jA== X-Gm-Message-State: AOJu0YyE1viU+a2HnX/JsUWEKuhZedaO+oPv9iXX/Walw8bzgX3SQbO5 PZqNsR551R73Pu8C58sR5axkgQU26i4NBTCk8FBGLQfHI78bE0JRgnHCqNMHLn9WbyKV80KKYSO qgD6bu0GKqOd1Y96OZ9Vhryd9u3RVMieeiEQRmB7b+OemFr8h X-Google-Smtp-Source: AGHT+IFq6SIPzx938h5YwR9GcH1Pux9Or8rMbBUBMw4K9Lx1nUnvVbPiFOSsIuWtjgW30f6zr9OqEojql4+5 X-Received: by 2002:a17:90a:f417:b0:299:a69:1f8b with SMTP id ch23-20020a17090af41700b002990a691f8bmr4884355pjb.23.1710171892577; Mon, 11 Mar 2024 08:44:52 -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 w12-20020a17090ad60c00b0029b47c6149csm458647pju.6.2024.03.11.08.44.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2024 08:44:52 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f]) by postal.iol.unh.edu (Postfix) with ESMTP id A32876052471; Mon, 11 Mar 2024 11:44:51 -0400 (EDT) From: jspewock@iol.unh.edu To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v9 1/7] dts: add startup verification and forwarding modes to testpmd shell Date: Mon, 11 Mar 2024 11:43:59 -0400 Message-ID: <20240311154405.13269-2-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240311154405.13269-1-jspewock@iol.unh.edu> References: <20240110144249.20719-1-jspewock@iol.unh.edu> <20240311154405.13269-1-jspewock@iol.unh.edu> MIME-Version: 1.0 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 Added commonly used methods in testpmd such as starting and stopping packet forwarding, changing forward modes, and verifying link status of ports so that developers can configure testpmd and start forwarding through the provided class rather than sending commands to the testpmd session directly. Signed-off-by: Jeremy Spewock --- dts/framework/exception.py | 7 + dts/framework/remote_session/testpmd_shell.py | 149 +++++++++++++++++- 2 files changed, 155 insertions(+), 1 deletion(-) diff --git a/dts/framework/exception.py b/dts/framework/exception.py index 658eee2c38..cce1e0231a 100644 --- a/dts/framework/exception.py +++ b/dts/framework/exception.py @@ -146,6 +146,13 @@ def __str__(self) -> str: return f"Command {self.command} returned a non-zero exit code: {self._command_return_code}" +class InteractiveCommandExecutionError(DTSError): + """An unsuccessful execution of a remote command in an interactive environment.""" + + #: + severity: ClassVar[ErrorSeverity] = ErrorSeverity.REMOTE_CMD_EXEC_ERR + + class RemoteDirectoryExistsError(DTSError): """A directory that exists on a remote node.""" diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index 0184cc2e71..3a66907394 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -15,9 +15,15 @@ testpmd_shell.close() """ +import time +from enum import auto from pathlib import PurePath from typing import Callable, ClassVar +from framework.exception import InteractiveCommandExecutionError +from framework.settings import SETTINGS +from framework.utils import StrEnum + from .interactive_shell import InteractiveShell @@ -43,14 +49,51 @@ def __str__(self) -> str: return self.pci_address +class TestPmdForwardingModes(StrEnum): + r"""The supported packet forwarding modes for :class:`~TestPmdShell`\s.""" + + #: + io = auto() + #: + mac = auto() + #: + macswap = auto() + #: + flowgen = auto() + #: + rxonly = auto() + #: + txonly = auto() + #: + csum = auto() + #: + icmpecho = auto() + #: + ieee1588 = auto() + #: + noisy = auto() + #: + fivetswap = "5tswap" + #: + shared_rxq = "shared-rxq" + #: + recycle_mbufs = auto() + + class TestPmdShell(InteractiveShell): """Testpmd interactive shell. The testpmd shell users should never use the :meth:`~.interactive_shell.InteractiveShell.send_command` method directly, but rather call specialized methods. If there isn't one that satisfies a need, it should be added. + + Attributes: + number_of_ports: The number of ports which were allowed on the command-line when testpmd + was started. """ + number_of_ports: int + #: The path to the testpmd executable. path: ClassVar[PurePath] = PurePath("app", "dpdk-testpmd") @@ -65,9 +108,66 @@ class TestPmdShell(InteractiveShell): _command_extra_chars: ClassVar[str] = "\n" def _start_application(self, get_privileged_command: Callable[[str], str] | None) -> None: - self._app_args += " -- -i" + """Overrides :meth:`~.interactive_shell._start_application`. + + Add flags for starting testpmd in interactive mode and disabling messages for link state + change events before starting the application. Link state is verified before starting + packet forwarding and the messages create unexpected newlines in the terminal which + complicates output collection. + + Also find the number of pci addresses which were allowed on the command line when the app + was started. + """ + self._app_args += " -- -i --mask-event intr_lsc" + self.number_of_ports = self._app_args.count("-a ") super()._start_application(get_privileged_command) + def start(self, verify: bool = True) -> None: + """Start packet forwarding with the current configuration. + + Args: + verify: If :data:`True` , a second start command will be sent in an attempt to verify + packet forwarding started as expected. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and forwarding fails to + start or ports fail to come up. + """ + self.send_command("start") + if verify: + # If forwarding was already started, sending "start" again should tell us + start_cmd_output = self.send_command("start") + if "Packet forwarding already started" not in start_cmd_output: + self._logger.debug(f"Failed to start packet forwarding: \n{start_cmd_output}") + raise InteractiveCommandExecutionError("Testpmd failed to start packet forwarding.") + + for port_id in range(self.number_of_ports): + if not self.wait_link_status_up(port_id): + raise InteractiveCommandExecutionError( + "Not all ports came up after starting packet forwarding in testpmd." + ) + + def stop(self, verify: bool = True) -> None: + """Stop packet forwarding. + + Args: + verify: If :data:`True` , the output of the stop command is scanned to verify that + forwarding was stopped successfully or not started. If neither is found, it is + considered an error. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the command to stop + forwarding results in an error. + """ + stop_cmd_output = self.send_command("stop") + if verify: + if ( + "Done." not in stop_cmd_output + and "Packet forwarding not started" not in stop_cmd_output + ): + self._logger.debug(f"Failed to stop packet forwarding: \n{stop_cmd_output}") + raise InteractiveCommandExecutionError("Testpmd failed to stop packet forwarding.") + def get_devices(self) -> list[TestPmdDevice]: """Get a list of device names that are known to testpmd. @@ -82,3 +182,50 @@ def get_devices(self) -> list[TestPmdDevice]: if "device name:" in line.lower(): dev_list.append(TestPmdDevice(line)) return dev_list + + def wait_link_status_up(self, port_id: int, timeout=SETTINGS.timeout) -> bool: + """Wait until the link status on the given port is "up". + + Arguments: + port_id: Port to check the link status on. + timeout: Time to wait for the link to come up. The default value for this + argument may be modified using the :option:`--timeout` command-line argument + or the :envvar:`DTS_TIMEOUT` environment variable. + + Returns: + Whether the link came up in time or not. + """ + time_to_stop = time.time() + timeout + port_info: str = "" + while time.time() < time_to_stop: + port_info = self.send_command(f"show port info {port_id}") + if "Link status: up" in port_info: + break + time.sleep(0.5) + else: + self._logger.error(f"The link for port {port_id} did not come up in the given timeout.") + return "Link status: up" in port_info + + def set_forward_mode(self, mode: TestPmdForwardingModes, verify: bool = True): + """Set packet forwarding mode. + + Args: + mode: The forwarding mode to use. + verify: If :data:`True` the output of the command will be scanned in an attempt to + verify that the forwarding mode was set to `mode` properly. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the forwarding mode + fails to update. + """ + set_fwd_output = self.send_command(f"set fwd {mode.value}") + if f"Set {mode.value} packet forwarding mode" not in set_fwd_output: + self._logger.debug(f"Failed to set fwd mode to {mode.value}:\n{set_fwd_output}") + raise InteractiveCommandExecutionError( + f"Test pmd failed to set fwd mode to {mode.value}" + ) + + def close(self) -> None: + """Overrides :meth:`~.interactive_shell.close`.""" + self.send_command("quit", "") + return super().close() From patchwork Mon Mar 11 15:44:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Spewock X-Patchwork-Id: 138160 X-Patchwork-Delegate: thomas@monjalon.net 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 EE91043C89; Mon, 11 Mar 2024 16:45:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DC69240DC9; Mon, 11 Mar 2024 16:44:57 +0100 (CET) Received: from mail-qv1-f98.google.com (mail-qv1-f98.google.com [209.85.219.98]) by mails.dpdk.org (Postfix) with ESMTP id 7672A40A8A for ; Mon, 11 Mar 2024 16:44:54 +0100 (CET) Received: by mail-qv1-f98.google.com with SMTP id 6a1803df08f44-68ee2c0a237so29514506d6.1 for ; Mon, 11 Mar 2024 08:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1710171894; x=1710776694; 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=2ugSq6yZnVJ/8C03p8ipTsvI2OSe9gLyymNSwNRkdc8=; b=D1ugAS1lw7xK9kbWwpuvQIy7fvIGK+MDa5tJ5SPyN3zsy5ViCqjZxk516mymrobHzK 1nL2T8UuHiYHixvo6Vdis1GGgIlcuMgcNSW8veTWGuqH48GCcu7fkYLJf74gqMHeroFP fAzd20GnAXzQiJJMVisSJJrykvz/iWsy+758w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171894; x=1710776694; 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=2ugSq6yZnVJ/8C03p8ipTsvI2OSe9gLyymNSwNRkdc8=; b=KJ6kkQgTvkhd9BTE9UWZUz5m2mkiRmpa1T+glPHLp/nV5ZG3SzmE1WgoFwPswQuNHD LDxMuqRVDbT6koJjQONfDRrFpuGq0pnMOL08l8XS46OEzanVoVplHUZeGNOyZ3qqTFRt NWxfKhY27Ii9VSo8Voleym+N/R/zVzAmXkmzQbg9/VZ43ofD6vZ9fu8K4HVOIrruQhzr vZJoY0J4RixWxFxGwZrKuw+EZ5QvEVWSPRfDLiG8+Aj68SiLtWQdgILzennBqDZ4M6NX CCAYWuyJp7Dor2h59AE04XMSwVf9YdtclgqRGyn/pl8F7ZYswnDK1F9VRntYD4GAIVGk VKLA== X-Gm-Message-State: AOJu0YwwmpGQocrYbxBOXWC67dVCxuBceAHagjJell/F+fY9q6sBlznl Ug12OYSGiuJGC0pP3J/vJwtkIQI1avEia262QHF7NMcr01LO93T01im6/39F7zabEJRc4HydHdO fKk+ulqGDrllqHR1agUw6y1VhNQhFs6Ew X-Google-Smtp-Source: AGHT+IFREV2lsIzAdI6Pg8JwRAl5A9f2gIDsFn3ELB4kfMScQqP0Y219h1hzkVbXbXupIkuTr/xpUiily8xe X-Received: by 2002:a05:6214:2501:b0:690:c56b:5878 with SMTP id gf1-20020a056214250100b00690c56b5878mr14051156qvb.16.1710171893881; Mon, 11 Mar 2024 08:44:53 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id kl18-20020a056214519200b0068fa33effcbsm262128qvb.39.2024.03.11.08.44.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2024 08:44:53 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f]) by postal.iol.unh.edu (Postfix) with ESMTP id 6E9E66052471; Mon, 11 Mar 2024 11:44:53 -0400 (EDT) From: jspewock@iol.unh.edu To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v9 2/7] dts: limit EAL parameters to DPDK apps and add parameters to all apps Date: Mon, 11 Mar 2024 11:44:00 -0400 Message-ID: <20240311154405.13269-3-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240311154405.13269-1-jspewock@iol.unh.edu> References: <20240110144249.20719-1-jspewock@iol.unh.edu> <20240311154405.13269-1-jspewock@iol.unh.edu> MIME-Version: 1.0 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 Changed the factory method for creating interactive apps in the SUT Node so that EAL parameters would only be passed into DPDK apps since non-DPDK apps wouldn't be able to process them. Also modified interactive apps to allow for the ability to pass parameters into the app on startup so that the applications can be started with certain configuration steps passed on the command line. Signed-off-by: Jeremy Spewock --- dts/framework/remote_session/testpmd_shell.py | 2 +- dts/framework/testbed_model/sut_node.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index 3a66907394..cb2ab6bd00 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -118,7 +118,7 @@ def _start_application(self, get_privileged_command: Callable[[str], str] | None Also find the number of pci addresses which were allowed on the command line when the app was started. """ - self._app_args += " -- -i --mask-event intr_lsc" + self._app_args += " -i --mask-event intr_lsc" self.number_of_ports = self._app_args.count("-a ") super()._start_application(get_privileged_command) diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py index c4acea38d1..909394e756 100644 --- a/dts/framework/testbed_model/sut_node.py +++ b/dts/framework/testbed_model/sut_node.py @@ -430,7 +430,8 @@ def create_interactive_shell( shell_cls: Type[InteractiveShellType], timeout: float = SETTINGS.timeout, privileged: bool = False, - eal_parameters: EalParameters | str | None = None, + app_parameters: str = "", + eal_parameters: EalParameters | None = None, ) -> InteractiveShellType: """Extend the factory for interactive session handlers. @@ -449,20 +450,23 @@ def create_interactive_shell( eal_parameters: List of EAL parameters to use to launch the app. If this isn't provided or an empty string is passed, it will default to calling :meth:`create_eal_parameters`. + app_parameters: Additional arguments to pass into the application on the + command-line. Returns: An instance of the desired interactive application shell. """ - if not eal_parameters: - eal_parameters = self.create_eal_parameters() - - # We need to append the build directory for DPDK apps + # We need to append the build directory and add EAL parameters for DPDK apps if shell_cls.dpdk_app: + if not eal_parameters: + eal_parameters = self.create_eal_parameters() + app_parameters = f"{eal_parameters} -- {app_parameters}" + shell_cls.path = self.main_session.join_remote_path( self.remote_dpdk_build_dir, shell_cls.path ) - return super().create_interactive_shell(shell_cls, timeout, privileged, str(eal_parameters)) + return super().create_interactive_shell(shell_cls, timeout, privileged, app_parameters) def bind_ports_to_driver(self, for_dpdk: bool = True) -> None: """Bind all ports on the SUT to a driver. From patchwork Mon Mar 11 15:44:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Spewock X-Patchwork-Id: 138161 X-Patchwork-Delegate: thomas@monjalon.net 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 5BDE443C89; Mon, 11 Mar 2024 16:45:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C25A40DDE; Mon, 11 Mar 2024 16:44:59 +0100 (CET) Received: from mail-yw1-f226.google.com (mail-yw1-f226.google.com [209.85.128.226]) by mails.dpdk.org (Postfix) with ESMTP id 1927B40DC9 for ; Mon, 11 Mar 2024 16:44:56 +0100 (CET) Received: by mail-yw1-f226.google.com with SMTP id 00721157ae682-60a0599f6e5so23687607b3.3 for ; Mon, 11 Mar 2024 08:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1710171895; x=1710776695; 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=ueLJchuHLzRxe7Q7ngU5MUP/hh+6sJ2JANcrcuwQlyE=; b=O11x2szguc23uNXUjag3paDkml4kxR+aJR6Irb3LmiiHj4piQm61ZN8x4MYAb7MKUo gWmxTq+kfCDD+6eyVEH/wY/HWru9dr0VH9YkA3Z3JBCQcQ6vvY3vbavOivtEbhzP/b8k dee6b3k/qxhDeXuQLYc6RyT4NBIqT6NZmuG+0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171895; x=1710776695; 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=ueLJchuHLzRxe7Q7ngU5MUP/hh+6sJ2JANcrcuwQlyE=; b=NB/Ez39nUjjeAv+BYuVqi0D4UdKE2Pls7Cd7HCp+u6cFrrGsBq7eobcjgGjGTkn9hU GxFso5o67W+RZV/0/BBFczHhXEK4GXzvdODtCUyH6HGL7H7rX8uD0zfK8gmBRcVcyhrw W0tekNfau1fH8+nciK0Iwm0X1OWw/9YC1+uZmXClEapRN0MkmgbcxxNU1GnHXgFri4Rw KbA+Iae97sn4T+qM0FYnzBN8lpb7rEhssIKYvw87STBsCqxjWCa/WNFZBc2jFs8jF8LC x0TSrfq0lpb6XgNnUzJ+/wGDWfbd/ci2hWKhr2SPie+c07U4dgAb5/c5nZEuIj/KSdee kwHw== X-Gm-Message-State: AOJu0YylcAmnkpuve+ISiQSveWqgJWsKGgnus0w90TVEpiQ9ZV66ffHF V+lbBdOnCfKHqQCvb7Vz9wEVciS/ObbUOcIiNgv+a2Kqhdu5M07BJB6stluUymmYfcxMVBbuO3q xa6WonbaUsj6y0bWpCUZHTM/ISZonuqgT X-Google-Smtp-Source: AGHT+IHNamw73JyJV19OytyzDpJHN5QXfNfeT9k3tQ3VzM2zmmUP63kfOfsK/yz/ZXwl3ilHnDrGfTaThCyB X-Received: by 2002:a81:4f54:0:b0:609:f8d3:c1fe with SMTP id d81-20020a814f54000000b00609f8d3c1femr6462874ywb.47.1710171895423; Mon, 11 Mar 2024 08:44:55 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id b134-20020a0dd98c000000b006079f5e97b4sm291249ywe.38.2024.03.11.08.44.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2024 08:44:55 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f]) by postal.iol.unh.edu (Postfix) with ESMTP id ECCA66052471; Mon, 11 Mar 2024 11:44:54 -0400 (EDT) From: jspewock@iol.unh.edu To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v9 3/7] dts: add optional packet filtering to scapy sniffer Date: Mon, 11 Mar 2024 11:44:01 -0400 Message-ID: <20240311154405.13269-4-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240311154405.13269-1-jspewock@iol.unh.edu> References: <20240110144249.20719-1-jspewock@iol.unh.edu> <20240311154405.13269-1-jspewock@iol.unh.edu> MIME-Version: 1.0 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 Added the options to filter out LLDP and ARP packets when sniffing for packets with scapy. This was done using BPF filters to ensure that the noise these packets provide does not interfere with test cases. Signed-off-by: Jeremy Spewock --- dts/framework/test_suite.py | 15 +++++++++-- dts/framework/testbed_model/tg_node.py | 14 ++++++++-- .../traffic_generator/__init__.py | 7 ++++- .../capturing_traffic_generator.py | 22 ++++++++++++++- .../testbed_model/traffic_generator/scapy.py | 27 +++++++++++++++++++ 5 files changed, 79 insertions(+), 6 deletions(-) diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index 1957ea7328..9c3b516002 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -23,6 +23,7 @@ from .exception import TestCaseVerifyError from .logger import DTSLogger, get_dts_logger from .testbed_model import Port, PortLink, SutNode, TGNode +from .testbed_model.traffic_generator import PacketFilteringConfig from .utils import get_packet_summaries @@ -174,7 +175,12 @@ def configure_testbed_ipv4(self, restore: bool = False) -> None: def _configure_ipv4_forwarding(self, enable: bool) -> None: self.sut_node.configure_ipv4_forwarding(enable) - def send_packet_and_capture(self, packet: Packet, duration: float = 1) -> list[Packet]: + def send_packet_and_capture( + self, + packet: Packet, + filter_config: PacketFilteringConfig = PacketFilteringConfig(), + duration: float = 1, + ) -> list[Packet]: """Send and receive `packet` using the associated TG. Send `packet` through the appropriate interface and receive on the appropriate interface. @@ -182,6 +188,7 @@ def send_packet_and_capture(self, packet: Packet, duration: float = 1) -> list[P Args: packet: The packet to send. + filter_config: The filter to use when capturing packets. duration: Capture traffic for this amount of time after sending `packet`. Returns: @@ -189,7 +196,11 @@ def send_packet_and_capture(self, packet: Packet, duration: float = 1) -> list[P """ packet = self._adjust_addresses(packet) return self.tg_node.send_packet_and_capture( - packet, self._tg_port_egress, self._tg_port_ingress, duration + packet, + self._tg_port_egress, + self._tg_port_ingress, + filter_config, + duration, ) def get_expected_packet(self, packet: Packet) -> Packet: diff --git a/dts/framework/testbed_model/tg_node.py b/dts/framework/testbed_model/tg_node.py index f269d4c585..d3206e87e0 100644 --- a/dts/framework/testbed_model/tg_node.py +++ b/dts/framework/testbed_model/tg_node.py @@ -15,7 +15,11 @@ from .node import Node from .port import Port -from .traffic_generator import CapturingTrafficGenerator, create_traffic_generator +from .traffic_generator import ( + CapturingTrafficGenerator, + PacketFilteringConfig, + create_traffic_generator, +) class TGNode(Node): @@ -53,6 +57,7 @@ def send_packet_and_capture( packet: Packet, send_port: Port, receive_port: Port, + filter_config: PacketFilteringConfig = PacketFilteringConfig(), duration: float = 1, ) -> list[Packet]: """Send `packet`, return received traffic. @@ -65,13 +70,18 @@ def send_packet_and_capture( packet: The packet to send. send_port: The egress port on the TG node. receive_port: The ingress port in the TG node. + filter_config: The filter to use when capturing packets. duration: Capture traffic for this amount of time after sending `packet`. Returns: A list of received packets. May be empty if no packets are captured. """ return self.traffic_generator.send_packet_and_capture( - packet, send_port, receive_port, duration + packet, + send_port, + receive_port, + filter_config, + duration, ) def close(self) -> None: diff --git a/dts/framework/testbed_model/traffic_generator/__init__.py b/dts/framework/testbed_model/traffic_generator/__init__.py index 11e2bd7d97..0eaf0355cd 100644 --- a/dts/framework/testbed_model/traffic_generator/__init__.py +++ b/dts/framework/testbed_model/traffic_generator/__init__.py @@ -14,11 +14,16 @@ and a capturing traffic generator is required. """ +# pylama:ignore=W0611 + from framework.config import ScapyTrafficGeneratorConfig, TrafficGeneratorType from framework.exception import ConfigurationError from framework.testbed_model.node import Node -from .capturing_traffic_generator import CapturingTrafficGenerator +from .capturing_traffic_generator import ( + CapturingTrafficGenerator, + PacketFilteringConfig, +) from .scapy import ScapyTrafficGenerator diff --git a/dts/framework/testbed_model/traffic_generator/capturing_traffic_generator.py b/dts/framework/testbed_model/traffic_generator/capturing_traffic_generator.py index 0246590333..e5a1560e90 100644 --- a/dts/framework/testbed_model/traffic_generator/capturing_traffic_generator.py +++ b/dts/framework/testbed_model/traffic_generator/capturing_traffic_generator.py @@ -11,6 +11,7 @@ import uuid from abc import abstractmethod +from dataclasses import dataclass import scapy.utils # type: ignore[import] from scapy.packet import Packet # type: ignore[import] @@ -26,6 +27,19 @@ def _get_default_capture_name() -> str: return str(uuid.uuid4()) +@dataclass(slots=True, frozen=True) +class PacketFilteringConfig: + """The supported filtering options for :class:`CapturingTrafficGenerator`. + + Attributes: + no_lldp: If :data:`True`, LLDP packets will be filtered out when capturing. + no_arp: If :data:`True`, ARP packets will be filtered out when capturing. + """ + + no_lldp: bool = True + no_arp: bool = True + + class CapturingTrafficGenerator(TrafficGenerator): """Capture packets after sending traffic. @@ -54,6 +68,7 @@ def send_packet_and_capture( packet: Packet, send_port: Port, receive_port: Port, + filter_config: PacketFilteringConfig, duration: float, capture_name: str = _get_default_capture_name(), ) -> list[Packet]: @@ -68,6 +83,7 @@ def send_packet_and_capture( packet: The packet to send. send_port: The egress port on the TG node. receive_port: The ingress port in the TG node. + filter_config: Filters to apply when capturing packets. duration: Capture traffic for this amount of time after sending the packet. capture_name: The name of the .pcap file where to store the capture. @@ -75,7 +91,7 @@ def send_packet_and_capture( The received packets. May be empty if no packets are captured. """ return self.send_packets_and_capture( - [packet], send_port, receive_port, duration, capture_name + [packet], send_port, receive_port, filter_config, duration, capture_name ) def send_packets_and_capture( @@ -83,6 +99,7 @@ def send_packets_and_capture( packets: list[Packet], send_port: Port, receive_port: Port, + filter_config: PacketFilteringConfig, duration: float, capture_name: str = _get_default_capture_name(), ) -> list[Packet]: @@ -99,6 +116,7 @@ def send_packets_and_capture( packets: The packets to send. send_port: The egress port on the TG node. receive_port: The ingress port in the TG node. + filter_config: Filters to apply when capturing packets. duration: Capture traffic for this amount of time after sending the packets. capture_name: The name of the .pcap file where to store the capture. @@ -113,6 +131,7 @@ def send_packets_and_capture( packets, send_port, receive_port, + filter_config, duration, ) @@ -126,6 +145,7 @@ def _send_packets_and_capture( packets: list[Packet], send_port: Port, receive_port: Port, + filter_config: PacketFilteringConfig, duration: float, ) -> list[Packet]: """The implementation of :method:`send_packets_and_capture`. diff --git a/dts/framework/testbed_model/traffic_generator/scapy.py b/dts/framework/testbed_model/traffic_generator/scapy.py index 5b60f66237..df3069d516 100644 --- a/dts/framework/testbed_model/traffic_generator/scapy.py +++ b/dts/framework/testbed_model/traffic_generator/scapy.py @@ -32,6 +32,7 @@ from .capturing_traffic_generator import ( CapturingTrafficGenerator, + PacketFilteringConfig, _get_default_capture_name, ) @@ -69,6 +70,7 @@ def scapy_send_packets_and_capture( send_iface: str, recv_iface: str, duration: float, + sniff_filter: str, ) -> list[bytes]: """The RPC function to send and capture packets. @@ -90,6 +92,7 @@ def scapy_send_packets_and_capture( iface=recv_iface, store=True, started_callback=lambda *args: scapy.all.sendp(scapy_packets, iface=send_iface), + filter=sniff_filter, ) sniffer.start() time.sleep(duration) @@ -260,11 +263,34 @@ def _send_packets(self, packets: list[Packet], port: Port) -> None: packets = [packet.build() for packet in packets] self.rpc_server_proxy.scapy_send_packets(packets, port.logical_name) + def _create_packet_filter(self, filter_config: PacketFilteringConfig) -> str: + """Combines filter settings from `filter_config` into a BPF that scapy can use. + + Scapy allows for the use of Berkeley Packet Filters (BPFs) to filter what packets are + collected based on various attributes of the packet. + + Args: + filter_config: Config class that specifies which filters should be applied. + + Returns: + A string representing the combination of BPF filters to be passed to scapy. For + example: + + "ether[12:2] != 0x88cc && ether[12:2] != 0x0806" + """ + bpf_filter = [] + if filter_config.no_arp: + bpf_filter.append("ether[12:2] != 0x0806") + if filter_config.no_lldp: + bpf_filter.append("ether[12:2] != 0x88cc") + return " && ".join(bpf_filter) + def _send_packets_and_capture( self, packets: list[Packet], send_port: Port, receive_port: Port, + filter_config: PacketFilteringConfig, duration: float, capture_name: str = _get_default_capture_name(), ) -> list[Packet]: @@ -277,6 +303,7 @@ def _send_packets_and_capture( send_port.logical_name, receive_port.logical_name, duration, + self._create_packet_filter(filter_config), ) # type: ignore[assignment] scapy_packets = [Ether(packet.data) for packet in xmlrpc_packets] From patchwork Mon Mar 11 15:44:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Spewock X-Patchwork-Id: 138162 X-Patchwork-Delegate: thomas@monjalon.net 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 3461543C89; Mon, 11 Mar 2024 16:45:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0E2D40E40; Mon, 11 Mar 2024 16:45:00 +0100 (CET) Received: from mail-il1-f225.google.com (mail-il1-f225.google.com [209.85.166.225]) by mails.dpdk.org (Postfix) with ESMTP id E471640DDA for ; Mon, 11 Mar 2024 16:44:57 +0100 (CET) Received: by mail-il1-f225.google.com with SMTP id e9e14a558f8ab-3665a067d5eso3850715ab.1 for ; Mon, 11 Mar 2024 08:44:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1710171897; x=1710776697; 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=EK+fLSZ7+PZ2TL6EKNJX9oEiRnCVvRn1M80svle2Ces=; b=T36NX2+7n3BVX+r4jcE6D/MGvnf5tcfIt97FYf/SWMb2HAgkyQnr0lj5atZQ9khF+0 q8tINH3oqpHmTXsy8LfLbad7oAm1inrFo7mKOJ+u9FHrcRWrvqgdMJJPgpoI0lSWdCYR pZMpXEX3Db+RRkqhx0UL1mqRL+bx1YRlXFfh4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171897; x=1710776697; 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=EK+fLSZ7+PZ2TL6EKNJX9oEiRnCVvRn1M80svle2Ces=; b=TRCGNCBM4j2G0r1R14PrLanpOzE77w33xf7WlK8Wz+rU5itq2D9gTI+uGh3KikA4uU JdBTqauIEYDhNKG7TvRgWD3X6LkudZUka+PsDS7oLlcqqpCeb8EAYx3KAzxa6hXFp8SY 5DZGlG7kmJmwoCsG3GmeUz+Ey+BYkn1wqx0MTULz09jheD9ZyQYerOJe6d6EwRmsRe1Q PNOEq8ubq2qXbDh6cQ412XzYV3zN29R7eTuW2f6hMp9uHO72i1FGv3jMR5tMt91RSuFF 1JUY6vM8eSnD2AdzL+y6nHiYBiEua3x0NQJ5vhx2c0H/M7hnx15PqqgDFoXzK/ATUpqk ATSA== X-Gm-Message-State: AOJu0YyPf0pyfoRnfywO3oC9cFt2J/vJeG2f1yb0/NR93skVFs+7ypwp tnLx9p1Wf+36XQqvqpLTFkGpugvGjwPOj0ODLt1P8AmLGwanAwFpwgo/a2oj5F9IWH1zIbULQhh lFCy5PFPJT6EXgWjD1Jl1i+qus9Z7WYntcR0E1sGf5j1uKNgW X-Google-Smtp-Source: AGHT+IHVrZYWIJiG/EoNVPRfTxRYOq+TQk/Aw7tYZVCYC8/Kn5kksFjKw35KZafX3HU34ExhjRikd9CZa4YT X-Received: by 2002:a05:6e02:1a4d:b0:365:1459:e1ed with SMTP id u13-20020a056e021a4d00b003651459e1edmr8234240ilv.4.1710171897320; Mon, 11 Mar 2024 08:44:57 -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 el19-20020a0566384d9300b00476cea22e85sm142448jab.6.2024.03.11.08.44.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2024 08:44:57 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f]) by postal.iol.unh.edu (Postfix) with ESMTP id AB2846052471; Mon, 11 Mar 2024 11:44:56 -0400 (EDT) From: jspewock@iol.unh.edu To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v9 4/7] dts: add pci addresses to EAL parameters Date: Mon, 11 Mar 2024 11:44:02 -0400 Message-ID: <20240311154405.13269-5-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240311154405.13269-1-jspewock@iol.unh.edu> References: <20240110144249.20719-1-jspewock@iol.unh.edu> <20240311154405.13269-1-jspewock@iol.unh.edu> MIME-Version: 1.0 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 Added allow list to the EAL parameters created in DTS to ensure that only the relevant PCI devices are considered when launching DPDK applications. Signed-off-by: Jeremy Spewock --- dts/framework/testbed_model/sut_node.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py index 909394e756..97aa26d419 100644 --- a/dts/framework/testbed_model/sut_node.py +++ b/dts/framework/testbed_model/sut_node.py @@ -30,6 +30,7 @@ from .cpu import LogicalCoreCount, LogicalCoreList from .node import Node from .os_session import InteractiveShellType, OSSession +from .port import Port from .virtual_device import VirtualDevice @@ -46,6 +47,7 @@ def __init__( prefix: str, no_pci: bool, vdevs: list[VirtualDevice], + ports: list[Port], other_eal_param: str, ): """Initialize the parameters according to inputs. @@ -63,6 +65,7 @@ def __init__( VirtualDevice('net_ring0'), VirtualDevice('net_ring1') ] + ports: The list of ports to allow. other_eal_param: user defined DPDK EAL parameters, e.g.: ``other_eal_param='--single-file-segments'`` """ @@ -73,6 +76,7 @@ def __init__( self._prefix = f"--file-prefix={prefix}" self._no_pci = "--no-pci" if no_pci else "" self._vdevs = " ".join(f"--vdev {vdev}" for vdev in vdevs) + self._ports = " ".join(f"-a {port.pci}" for port in ports) self._other_eal_param = other_eal_param def __str__(self) -> str: @@ -83,6 +87,7 @@ def __str__(self) -> str: f"{self._prefix} " f"{self._no_pci} " f"{self._vdevs} " + f"{self._ports} " f"{self._other_eal_param}" ) @@ -347,6 +352,7 @@ def create_eal_parameters( append_prefix_timestamp: bool = True, no_pci: bool = False, vdevs: list[VirtualDevice] | None = None, + ports: list[Port] | None = None, other_eal_param: str = "", ) -> "EalParameters": """Compose the EAL parameters. @@ -370,6 +376,8 @@ def create_eal_parameters( VirtualDevice('net_ring0'), VirtualDevice('net_ring1') ] + ports: The list of ports to allow. If :data:`None`, all ports listed in `self.ports` + will be allowed. other_eal_param: user defined DPDK EAL parameters, e.g.: ``other_eal_param='--single-file-segments'``. @@ -388,12 +396,16 @@ def create_eal_parameters( if vdevs is None: vdevs = [] + if ports is None: + ports = self.ports + return EalParameters( lcore_list=lcore_list, memory_channels=self.config.memory_channels, prefix=prefix, no_pci=no_pci, vdevs=vdevs, + ports=ports, other_eal_param=other_eal_param, ) From patchwork Mon Mar 11 15:44:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Spewock X-Patchwork-Id: 138163 X-Patchwork-Delegate: thomas@monjalon.net 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 E9A6343C89; Mon, 11 Mar 2024 16:45:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 969C840E6E; Mon, 11 Mar 2024 16:45:01 +0100 (CET) Received: from mail-il1-f225.google.com (mail-il1-f225.google.com [209.85.166.225]) by mails.dpdk.org (Postfix) with ESMTP id 2E5DD40DF8 for ; Mon, 11 Mar 2024 16:44:59 +0100 (CET) Received: by mail-il1-f225.google.com with SMTP id e9e14a558f8ab-36663cc77eeso337405ab.2 for ; Mon, 11 Mar 2024 08:44:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1710171898; x=1710776698; 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=3RK5kuzo0Jq6RyRhe77VtFxJ613Gmy3kqJRnJ/Uz8bs=; b=fMqnpJnhn1LfDiK8WQOVQTJuzKBF4m6iALtj8q96LozUjCrw50AYoDmnaZQdyeww+w W94eUQbyR+dgRWZnpPqOmzWpk21192Nio+HdhK4UdAXK+FfjXFpr5/Ari+BkbN/DkDKp dyXrAEO1CiM94ruXwTibFMlVYBx1gbraE7taE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171898; x=1710776698; 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=3RK5kuzo0Jq6RyRhe77VtFxJ613Gmy3kqJRnJ/Uz8bs=; b=d9XMG/FSwMyDMLt9Abv3g+/dI/mEldQ+fBGGQLYRzOtA6IOwfTpBjf8aYzOo/wcqLQ lTLo38U+xckuFiOjqu7wellne9GpT2WCpyu4mua9PIMzcKahvCGZxQjz5dGZU/rDiXJt 0f5HqDOE3/1aO5kGkQEGK8dR0roEqxCIJ8+txqdTnmFnFhL9W25UkEltkK6qPpND5oEk 6hvXsS/r6cidA4B2S376Mlv0ykZotSLdVf9+5Sl1hEjsDPW6rDIE4mLBQxEIDGfjKFa5 lz2cpR7vpgtOxN7CEXuqf2xWLSxMrNw2XEJy1hiSXJ2huMA9dMYmHvZAC8wVRMBqQWVD AyQg== X-Gm-Message-State: AOJu0YzxUkkZY9PJSvP16LGVzhDVV2ZslbU+0EhXrNEWBm45aqhJHUUv 7yqkSsKhvigBIEX5ivF+gEUjU6TyyqMUsCvONa3rThZrNW7blG8fmZ7+9ED+oC4MIZE57KXxahm UNuwODIyFXAeIWBXv0ihpiLvt2DfaUlVtBfaz1CSoW+EEfeI3 X-Google-Smtp-Source: AGHT+IFROF+HTRaAidtoWPU7yo/k1U62sVx2zjAfcChidVHHRFwQHxJ26FuQfkxXcgLWi1MOtRR1L7knY1Ng X-Received: by 2002:a05:6602:1d1a:b0:7c8:bc7a:bef6 with SMTP id hh26-20020a0566021d1a00b007c8bc7abef6mr2727492iob.15.1710171898603; Mon, 11 Mar 2024 08:44:58 -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 n28-20020a056602341c00b007c8875fb2acsm222982ioz.28.2024.03.11.08.44.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2024 08:44:58 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f]) by postal.iol.unh.edu (Postfix) with ESMTP id 0E1006052471; Mon, 11 Mar 2024 11:44:58 -0400 (EDT) From: jspewock@iol.unh.edu To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v9 5/7] dts: allow configuring MTU of ports Date: Mon, 11 Mar 2024 11:44:03 -0400 Message-ID: <20240311154405.13269-6-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240311154405.13269-1-jspewock@iol.unh.edu> References: <20240110144249.20719-1-jspewock@iol.unh.edu> <20240311154405.13269-1-jspewock@iol.unh.edu> MIME-Version: 1.0 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 Adds methods in both os_session and linux session to allow for setting MTU of port interfaces so that suites that require the sending and receiving of packets of a specific size, or the rejection of packets over a certain size, can configure this maximum as needed. Signed-off-by: Jeremy Spewock --- dts/framework/testbed_model/linux_session.py | 8 ++++++++ dts/framework/testbed_model/os_session.py | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py index 0ab59cef85..5d24030c3d 100644 --- a/dts/framework/testbed_model/linux_session.py +++ b/dts/framework/testbed_model/linux_session.py @@ -198,6 +198,14 @@ def configure_port_ip_address( verify=True, ) + def configure_port_mtu(self, mtu: int, port: Port) -> None: + """Overrides :meth:`~.os_session.OSSession.configure_port_mtu`.""" + self.send_command( + f"ip link set dev {port.logical_name} mtu {mtu}", + privileged=True, + verify=True, + ) + def configure_ipv4_forwarding(self, enable: bool) -> None: """Overrides :meth:`~.os_session.OSSession.configure_ipv4_forwarding`.""" state = 1 if enable else 0 diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py index 6983aa4a77..d5bf7e0401 100644 --- a/dts/framework/testbed_model/os_session.py +++ b/dts/framework/testbed_model/os_session.py @@ -412,6 +412,15 @@ def configure_port_ip_address( delete: If :data:`True`, remove the IP address, otherwise configure it. """ + @abstractmethod + def configure_port_mtu(self, mtu: int, port: Port) -> None: + """Configure `mtu` on `port`. + + Args: + mtu: Desired MTU value. + port: Port to set `mtu` on. + """ + @abstractmethod def configure_ipv4_forwarding(self, enable: bool) -> None: """Enable IPv4 forwarding in the operating system. From patchwork Mon Mar 11 15:44:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Spewock X-Patchwork-Id: 138164 X-Patchwork-Delegate: thomas@monjalon.net 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 2B18743C89; Mon, 11 Mar 2024 16:45:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4A2A40E96; Mon, 11 Mar 2024 16:45:06 +0100 (CET) Received: from mail-qk1-f228.google.com (mail-qk1-f228.google.com [209.85.222.228]) by mails.dpdk.org (Postfix) with ESMTP id 52D0840E8A for ; Mon, 11 Mar 2024 16:45:02 +0100 (CET) Received: by mail-qk1-f228.google.com with SMTP id af79cd13be357-78831914027so128637785a.1 for ; Mon, 11 Mar 2024 08:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1710171902; x=1710776702; 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=TYcSWh3DMEcpGuVA6RV6FRBCfuObNN8WQYpbxk1Pi0M=; b=gAyWdpAICta4+wi1lReB8bOtGK47ga2lZv3DetgKzjmcnp2VOgifbGYfe1uVVlmUBf 86fuHA+IzuNsKiCO/+N21abblTXR3Qvi01LTedzimQEBcio1knwT0rDdg/zvlI9nEz8V zycXuSwewKgRQPD7R49vBWaX3762FlnKBkbso= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171902; x=1710776702; 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=TYcSWh3DMEcpGuVA6RV6FRBCfuObNN8WQYpbxk1Pi0M=; b=MONUFPvGZvQzo9fIFtj5NBtgFJU+rq1YgwYOSJIAD8eOjApGa8xyFRkDN1aNmhrw0T XgTEI9AmIzgr8oi6ZzYvdAjqAQVVfaKghB9fz460VKGe0KnxkU5kZbuCS0OalNF08D4Q PLaLubKU8+DBm+LsySjBwGKOvSPch/FSO3x4k4d+6qooIEpqxikDM1R6KZRPhn539q5D 6GHlMDfGcCDUCfz51t0ackpncaTDRSRS0QyF6jvBsRdooMUc3PnkNtnL50wPDao1urL+ zKaez0R27hqiN0nn+f0PcDWrdxbp6xB/In5Nmsv+DN82CAz9fIQJNw9xhbnklhx9090N mJ1w== X-Gm-Message-State: AOJu0YyfaRoliavB0Nx5rHZhNnRIuEdwoNjONSOP0aWzZplnXhJNlNo1 V2M3hAtOId2A2PJzVaaW6MbbFGp58mME85Jsn16Of8sEIVKg/Wyx+fQRE7NSCJAr1D3XNoBTRHY uYLfhiKfxVHq1iHT+QIixS5MjPmEGnh42 X-Google-Smtp-Source: AGHT+IFoXhKBdA8zQYSX9sOd7MrOCrHwj99pHC5FXL7e2Oo30XCcGsbixUj9IXGtP5mTHlDmeXoIfAjQQKzd X-Received: by 2002:a05:622a:118f:b0:42f:1443:df08 with SMTP id m15-20020a05622a118f00b0042f1443df08mr9348434qtk.64.1710171901759; Mon, 11 Mar 2024 08:45:01 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id t19-20020ac85893000000b0042ede8cde9csm249786qta.28.2024.03.11.08.45.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2024 08:45:01 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f]) by postal.iol.unh.edu (Postfix) with ESMTP id 4B44E6052471; Mon, 11 Mar 2024 11:45:01 -0400 (EDT) From: jspewock@iol.unh.edu To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v9 6/7] dts: add scatter to the yaml schema Date: Mon, 11 Mar 2024 11:44:04 -0400 Message-ID: <20240311154405.13269-7-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240311154405.13269-1-jspewock@iol.unh.edu> References: <20240110144249.20719-1-jspewock@iol.unh.edu> <20240311154405.13269-1-jspewock@iol.unh.edu> MIME-Version: 1.0 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 Allow for scatter to be specified in the configuration file. Signed-off-by: Jeremy Spewock --- dts/framework/config/conf_yaml_schema.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json index 051b079fe4..4731f4511d 100644 --- a/dts/framework/config/conf_yaml_schema.json +++ b/dts/framework/config/conf_yaml_schema.json @@ -186,7 +186,8 @@ "type": "string", "enum": [ "hello_world", - "os_udp" + "os_udp", + "pmd_buffer_scatter" ] }, "test_target": { From patchwork Mon Mar 11 15:44:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Spewock X-Patchwork-Id: 138165 X-Patchwork-Delegate: thomas@monjalon.net 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 7278C43C89; Mon, 11 Mar 2024 16:45:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D841340ED1; Mon, 11 Mar 2024 16:45:07 +0100 (CET) Received: from mail-qv1-f100.google.com (mail-qv1-f100.google.com [209.85.219.100]) by mails.dpdk.org (Postfix) with ESMTP id 70B1B40E8A for ; Mon, 11 Mar 2024 16:45:03 +0100 (CET) Received: by mail-qv1-f100.google.com with SMTP id 6a1803df08f44-690b100da62so31794716d6.1 for ; Mon, 11 Mar 2024 08:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1710171903; x=1710776703; 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=M+wLiC6KkIoezNXInsP8UoQDPl4cZskSzrM6ZKajZWM=; b=AnP5qpW6ibZ8hwmBTZ0MuMWm1tGWCI4TCxWwAQWnNSDfvZM9HTn1baEn7pckTxZ/dB Mk9D8QBmffWCU4DqOWkZ9W2RrypIU62TJvsK3urhOgzUv5Rx4LHSU17qToiL0l2mlTsi I1Xe1Xiw51Fclv5820SKgaTLir6kq3ZsG2ZsQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171903; x=1710776703; 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=M+wLiC6KkIoezNXInsP8UoQDPl4cZskSzrM6ZKajZWM=; b=KEIVMD1nH2Dkdv0RPBvxQRAEL9GEXijesgGo96vFWdYOyAuXtnAhH/rq9JuP+Ki10C /BqQI8meF112JmIUpwHWC+TG8CV+KKRF84FLpm9fwUWn9VcICkUqb7a5zooDaVGBicva ANdW4ciCkAT/rC5FwdrILJ5/1B6FDqjTKDUxBexweqaXo5fxDfdmquP7hgqAH3wsbfK4 XKukn2w4Oj8iBLHVZNgvUg1gK0rPvg2Se85sxdIFE6ogQKWAV0ewzQaGQPBe3iC3/RrF 7d7fbUCqbuclpSJubYK0YqC67XmWlZLIBCK0L5S527uAIdcB8A1MNi116BfK9StNrQVw 2+EQ== X-Gm-Message-State: AOJu0YwzFcZjBs4p45clIkYaqJ/DtD2b/h1MLyCY+8zvL6G8EPr81ZWc P+e8MiC3OepwosET00ClACDxL2s+Qoct+X0Rl025ltQO8Y3hMNu7cPvsS9K0fnJyGhQIRAz4NqC r0S2sg+PG7ddHX9T5AQIdZiQranYNUEEC9fNr5ZNKZZKrL3mR X-Google-Smtp-Source: AGHT+IFEhmhLPhsnsCX4AjpfWJoRFEE/Aph7QY1ZafiHfPzku0ipVFG6h/haD6gn7zd3gguyL8daOtOqbjzS X-Received: by 2002:a05:6214:140b:b0:690:c04c:98b with SMTP id pr11-20020a056214140b00b00690c04c098bmr6922865qvb.6.1710171902872; Mon, 11 Mar 2024 08:45:02 -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 c11-20020ad45aeb000000b006903c83219esm289161qvh.2.2024.03.11.08.45.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2024 08:45:02 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f]) by postal.iol.unh.edu (Postfix) with ESMTP id 6C9626052471; Mon, 11 Mar 2024 11:45:02 -0400 (EDT) From: jspewock@iol.unh.edu To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v9 7/7] dts: add pmd_buffer_scatter test suite Date: Mon, 11 Mar 2024 11:44:05 -0400 Message-ID: <20240311154405.13269-8-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240311154405.13269-1-jspewock@iol.unh.edu> References: <20240110144249.20719-1-jspewock@iol.unh.edu> <20240311154405.13269-1-jspewock@iol.unh.edu> MIME-Version: 1.0 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 test suite provides testing of the support of scattered packets by Poll Mode Drivers using testpmd, verifying the ability to receive and transmit scattered multi-segment packets made up of multiple non-contiguous memory buffers. This is tested through 5 different cases in which the length of the packets sent are less than the mbuf size, equal to the mbuf size, and 1, 4, and 5 bytes greater than the mbuf size in order to show both the CRC and the packet data are capable of existing in the first, second, or both buffers. Naturally, if the PMD is capable of forwarding scattered packets which it receives as input, this shows it is capable of both receiving and transmitting scattered packets. Signed-off-by: Jeremy Spewock --- dts/tests/TestSuite_pmd_buffer_scatter.py | 132 ++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 dts/tests/TestSuite_pmd_buffer_scatter.py diff --git a/dts/tests/TestSuite_pmd_buffer_scatter.py b/dts/tests/TestSuite_pmd_buffer_scatter.py new file mode 100644 index 0000000000..6c035595c2 --- /dev/null +++ b/dts/tests/TestSuite_pmd_buffer_scatter.py @@ -0,0 +1,132 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2023-2024 University of New Hampshire + +"""Multi-segment packet scattering testing suite. + +This testing suite tests the support of transmitting and receiving scattered packets. This is shown +by the Poll Mode Driver being able to forward scattered multi-segment packets composed of multiple +non-contiguous memory buffers. To ensure the receipt of scattered packets, the DMA rings of the +port's RX queues must be configured with mbuf data buffers whose size is less than the maximum +length. + +If it is the case that the Poll Mode Driver can forward scattered packets which it receives, then +this suffices to show the Poll Mode Driver is capable of both receiving and transmitting scattered +packets. +""" + +import struct + +from scapy.layers.inet import IP # type: ignore[import] +from scapy.layers.l2 import Ether # type: ignore[import] +from scapy.packet import Raw # type: ignore[import] +from scapy.utils import hexstr # type: ignore[import] + +from framework.remote_session.testpmd_shell import TestPmdForwardingModes, TestPmdShell +from framework.test_suite import TestSuite + + +class TestPmdBufferScatter(TestSuite): + """DPDK PMD packet scattering test suite. + + Configure the Rx queues to have mbuf data buffers whose sizes are smaller than the maximum + packet size. Specifically, set mbuf data buffers to have a size of 2048 to fit a full 1512-byte + (CRC included) ethernet frame in a mono-segment packet. The testing of scattered packets is + done by sending a packet whose length is greater than the size of the configured size of mbuf + data buffers. There are a total of 5 packets sent within test cases which have lengths less + than, equal to, and greater than the mbuf size. There are multiple packets sent with lengths + greater than the mbuf size in order to test cases such as: + + 1. A single byte of the CRC being in a second buffer while the remaining 3 bytes are stored in + the first buffer alongside packet data. + 2. The entire CRC being stored in a second buffer while all of the packet data is stored in the + first. + 3. Most of the packet data being stored in the first buffer and a single byte of packet data + stored in a second buffer alongside the CRC. + """ + + def set_up_suite(self) -> None: + """Set up the test suite. + + Setup: + Verify that we have at least 2 port links in the current execution and increase the MTU + of both ports on the traffic generator to 9000 to support larger packet sizes. + """ + self.verify( + len(self._port_links) > 1, + "There must be at least two port links to run the scatter test suite", + ) + + self.tg_node.main_session.configure_port_mtu(9000, self._tg_port_egress) + self.tg_node.main_session.configure_port_mtu(9000, self._tg_port_ingress) + + def scatter_pktgen_send_packet(self, pktsize: int) -> str: + """Generate and send a packet to the SUT then capture what is forwarded back. + + Generate an IP packet of a specific length and send it to the SUT, then capture the + resulting received packet and extract its payload. The desired length of the packet is met + by packing its payload with the letter "X" in hexadecimal. + + Args: + pktsize: Size of the packet to generate and send. + + Returns: + The payload of the received packet as a string. + """ + packet = Ether() / IP() / Raw() + packet.getlayer(2).load = "" + payload_len = pktsize - len(packet) - 4 + payload = ["58"] * payload_len + # pack the payload + for X_in_hex in payload: + packet.load += struct.pack("=B", int("%s%s" % (X_in_hex[0], X_in_hex[1]), 16)) + received_packets = self.send_packet_and_capture(packet) + self.verify(len(received_packets) > 0, "Did not receive any packets.") + load = hexstr(received_packets[0].getlayer(2), onlyhex=1) + + return load + + def pmd_scatter(self, mbsize: int) -> None: + """Testpmd support of receiving and sending scattered multi-segment packets. + + Support for scattered packets is shown by sending 5 packets of differing length + where the length of the packet is calculated by taking mbuf-size + an offset. The + offsets used in the test are -1, 0, 1, 4, 5 respectively. + + Test: + Start testpmd and run functional test with preset mbsize. + """ + testpmd = self.sut_node.create_interactive_shell( + TestPmdShell, + app_parameters=( + "--mbcache=200 " + f"--mbuf-size={mbsize} " + "--max-pkt-len=9000 " + "--port-topology=paired " + "--tx-offloads=0x00008000" + ), + privileged=True, + ) + testpmd.set_forward_mode(TestPmdForwardingModes.mac) + testpmd.start() + + for offset in [-1, 0, 1, 4, 5]: + recv_payload = self.scatter_pktgen_send_packet(mbsize + offset) + self._logger.debug(f"Payload of scattered packet after forwarding: \n{recv_payload}") + self.verify( + ("58 " * 8).strip() in recv_payload, + f"Payload of scattered packet did not match expected payload with offset {offset}.", + ) + testpmd.stop() + + def test_scatter_mbuf_2048(self) -> None: + """Run the :meth:`pmd_scatter` test with `mbsize` set to 2048.""" + self.pmd_scatter(mbsize=2048) + + def tear_down_suite(self) -> None: + """Tear down the test suite. + + Teardown: + Set the MTU of the tg_node back to a more standard size of 1500 + """ + self.tg_node.main_session.configure_port_mtu(1500, self._tg_port_egress) + self.tg_node.main_session.configure_port_mtu(1500, self._tg_port_ingress)