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 6C7854586E; Mon, 26 Aug 2024 23:14:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8AE5F40B91; Mon, 26 Aug 2024 23:14:03 +0200 (CEST) Received: from mail-oa1-f100.google.com (mail-oa1-f100.google.com [209.85.160.100]) by mails.dpdk.org (Postfix) with ESMTP id BBA6040B90 for ; Mon, 26 Aug 2024 23:14:01 +0200 (CEST) Received: by mail-oa1-f100.google.com with SMTP id 586e51a60fabf-273c8514254so3547696fac.0 for ; Mon, 26 Aug 2024 14:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1724706841; x=1725311641; 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=RHVx+XcHwi+EUYbZsDzyjfLRYJ1VsTp9J+RkCccHBTw=; b=MToBdqvz1UQ2TayLkjSVeFZGcRPe8crG8/uwVwpOYFcznOo5VKV41qjUIZjv5CU9Cc esZlxfv+J9cotOCdpfEKbEWe89G3akF4kRAirM6XyortXzgUNoJA2gvUkOaro92vTPGB ciUIbvGAyu/5SOlEfptQ8F/IE72CbXDTQj3HQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724706841; x=1725311641; 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=RHVx+XcHwi+EUYbZsDzyjfLRYJ1VsTp9J+RkCccHBTw=; b=JQdtrIeSs9/Ukbru4Q7EUDCWSCPV1Jo6E4xj2YwNDbCVbIsi+0AOlTtqUaOQOd0obf AgOZE/wuqNl+dXtke68fNQX3q6RLodJpn9IJrZM31IeGrpPz4nQSIXyXXd6iHXaBHEqX 3f/9AXP7zT+x2tdbh/gecwFrdIvVoCw6Pt0oFc+26WWJEE+l4AUB/xJhtOxmFDQ0xpUP 5820ZphH1c8Q3UCNTUb2u+fgUzRr6PC0cN9wrwNZZ+Xa0MRj05XkpO03GtQLJb7doGHx ATpaEcT41K8A+ZZFEahqQ6m7F2F9+6FGtqsNYukfgSDMJOPo9YgZpYFdKmZ6ar/aX535 tA9w== X-Gm-Message-State: AOJu0YxtDc4I9vWtiHmA5ZeXrA447+npJmsg3h/5ZZaNGbpP0k7fyG7V Dw6l0491reHcmR2JhQNtyc21uJYdlHbJei+bMXB34n5KjV3TBS6qrTSuD8UDWfO7g0XGmfxJH65 krRurRkfBjeyGHe555AleA2U5CUBSOTVp X-Google-Smtp-Source: AGHT+IHScAeN4JEv6nb4Vm11gq8gCJBMmFad/SmalnWS/6ep7ZRVCfi17DGq4YiAx53H2HZVjI4vRhGNRtLX X-Received: by 2002:a05:6870:b428:b0:268:3afe:54f with SMTP id 586e51a60fabf-273e64b7b9cmr11932514fac.11.1724706840765; Mon, 26 Aug 2024 14:14:00 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id 586e51a60fabf-273ce96689dsm666226fac.7.2024.08.26.14.14.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Aug 2024 14:14:00 -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 CEB9F605C351; Mon, 26 Aug 2024 17:13:59 -0400 (EDT) From: jspewock@iol.unh.edu To: paul.szczepanek@arm.com, alex.chapman@arm.com, Honnappa.Nagarahalli@arm.com, npratte@iol.unh.edu, wathsala.vithanage@arm.com, juraj.linkes@pantheon.tech, probb@iol.unh.edu, Luca.Vizzarro@arm.com, yoan.picchi@foss.arm.com, thomas@monjalon.net Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v2 1/1] dts: add methods for modifying MTU to testpmd shell Date: Mon, 26 Aug 2024 17:13:27 -0400 Message-ID: <20240826211327.16082-2-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240826211327.16082-1-jspewock@iol.unh.edu> References: <20240826200203.13560-1-jspewock@iol.unh.edu> <20240826211327.16082-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") 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 ca24b28070..6891f63bef 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -888,6 +888,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_id in range(len(self._app_params.ports)): + self.set_port_mtu(port_id, mtu, verify) + def _close(self) -> None: """Overrides :meth:`~.interactive_shell.close`.""" self.stop() -- 2.46.0