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 7DAE845920; Fri, 6 Sep 2024 20:00:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0663942FA1; Fri, 6 Sep 2024 20:00:48 +0200 (CEST) Received: from mail-yw1-f225.google.com (mail-yw1-f225.google.com [209.85.128.225]) by mails.dpdk.org (Postfix) with ESMTP id 6D47442FA1 for ; Fri, 6 Sep 2024 20:00:46 +0200 (CEST) Received: by mail-yw1-f225.google.com with SMTP id 00721157ae682-6cdae28014dso17562167b3.1 for ; Fri, 06 Sep 2024 11:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1725645646; x=1726250446; 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=yBwjvf2AucBUAYBgIaHRqUac9x91sdPOLSjO+IHrbgU=; b=EGsYEhu15ZO/Mls3MWhs27V6U88YRm/R6Zyea3loQSeoY9H0X2ZUAAGS9iRWzbsTN6 BeYE62IwZ8mkqoOKpAk7CZNmLaKT9cnDOnivdf/US1jbiBThM1OWsJwL9hehG7EpZ1qI P+pU9IhVc4GKLfFK/Yc2a/cviSuFZp4kb1lo0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725645646; x=1726250446; 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=yBwjvf2AucBUAYBgIaHRqUac9x91sdPOLSjO+IHrbgU=; b=X+mWXrM82K+sLEkKeRMgn5OhhXK9ShaRmR0kEs14Cv8ozlINtlwzXLXlKjZkFZbh5s s/1vQQCNvpgAUbQeJxlKXeQhVZ4Dwxri2iWrGQ3twBdZWqRZ/s5ODxJF8LyssQPow5G3 VLjHmhXWCeoWP2zmovY169AKwWMGAMYnUdX/iftAflNQDvnBAwoDaDtuBeSH8wfeTsLT 7HpKaeyBXqeWYqiKYxnCN/J8ysxmGrDNb5jXxcNMcoM60k1aYFho3cZ0zf2KASkzFPeL c6lz6IhTCMvKc/JJKrPj9+QMs3BP/pCDovkvKv85Xxpr4eF2qpP3KsrfWJDz3dHa3tDo 0GEw== X-Gm-Message-State: AOJu0YybOTueJyheQBcXnJJCzEzakjQmMp5bFHFGkK8krHISEcto4DP8 Zy9Mc/3baEW3LWiwi8slfKnGENaESXt/YwF/EbR/zcPxG7676cd00JsJhYdsnElGEJ4LK7RWWWb il3Q+4skPzIh5xaEKqroruUB5S6xnCtut X-Google-Smtp-Source: AGHT+IE6KBd4qRuYW63kkPqw3KO+5bmNP5UI9DSkzDKj/ij4+x9hDHZ6DA0sen+L8BnK2IAtlbjRVz+7Fmzv X-Received: by 2002:a05:690c:7201:b0:6d5:bde:d7f7 with SMTP id 00721157ae682-6db25f787bdmr90143727b3.9.1725645645613; Fri, 06 Sep 2024 11:00:45 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id 00721157ae682-6db565da3b6sm217057b3.69.2024.09.06.11.00.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Sep 2024 11:00:45 -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 8570A6050A6D; Fri, 6 Sep 2024 14:00:44 -0400 (EDT) From: jspewock@iol.unh.edu To: thomas@monjalon.net, alex.chapman@arm.com, Luca.Vizzarro@arm.com, yoan.picchi@foss.arm.com, paul.szczepanek@arm.com, probb@iol.unh.edu, Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, wathsala.vithanage@arm.com, npratte@iol.unh.edu Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v4 1/1] dts: add methods for modifying MTU to testpmd shell Date: Fri, 6 Sep 2024 14:00:36 -0400 Message-ID: <20240906180036.19446-2-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240906180036.19446-1-jspewock@iol.unh.edu> References: <20240826200203.13560-1-jspewock@iol.unh.edu> <20240906180036.19446-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 There are methods within DTS currently that support updating the MTU of ports on a node, but the methods for doing this in a linux session rely on the ip command and the port being bound to the kernel driver. Since test suites are run while bound to the driver for DPDK, there needs to be a way to modify the value while bound to said driver as well. This is done by using testpmd to modify the MTU. Depends-on: patch-142952 ("dts: add ability to start/stop testpmd ports") Depends-on: patch-143360 ("dts: add testpmd port information caching") Signed-off-by: Jeremy Spewock --- dts/framework/remote_session/testpmd_shell.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index 349282d4c5..b4e1fcb75f 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -915,6 +915,50 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats: return TestPmdPortStats.parse(output) + @requires_stopped_ports + def set_port_mtu(self, port_id: int, mtu: int, verify: bool = True) -> None: + """Change the MTU of a port using testpmd. + + Some PMDs require that the port be stopped before changing the MTU, and it does no harm to + stop the port before configuring in cases where it isn't required, so ports are stopped + prior to changing their MTU. + + Args: + port_id: ID of the port to adjust the MTU on. + mtu: Desired value for the MTU to be set to. + verify: If `verify` is :data:`True` then the output will be scanned in an attempt to + verify that the mtu was properly set on the port. Defaults to :data:`True`. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the MTU was not + properly updated on the port matching `port_id`. + """ + set_mtu_output = self.send_command(f"port config mtu {port_id} {mtu}") + if verify and (f"MTU: {mtu}" not in self.send_command(f"show port info {port_id}")): + self._logger.debug( + f"Failed to set mtu to {mtu} on port {port_id}." f" Output was:\n{set_mtu_output}" + ) + raise InteractiveCommandExecutionError( + f"Test pmd failed to update mtu of port {port_id} to {mtu}" + ) + + def set_port_mtu_all(self, mtu: int, verify: bool = True) -> None: + """Change the MTU of all ports using testpmd. + + Runs :meth:`set_port_mtu` for every port that testpmd is aware of. + + Args: + mtu: Desired value for the MTU to be set to. + verify: Whether to verify that setting the MTU on each port was successful or not. + Defaults to :data:`True`. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the MTU was not + properly updated on at least one port. + """ + for port in self.ports: + self.set_port_mtu(port.id, mtu, verify) + def _close(self) -> None: """Overrides :meth:`~.interactive_shell.close`.""" self.stop() -- 2.46.0