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 20DE04586E; Mon, 26 Aug 2024 22:06:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 38DE740A81; Mon, 26 Aug 2024 22:06:40 +0200 (CEST) Received: from mail-pl1-f228.google.com (mail-pl1-f228.google.com [209.85.214.228]) by mails.dpdk.org (Postfix) with ESMTP id F39C14003C for ; Mon, 26 Aug 2024 22:06:38 +0200 (CEST) Received: by mail-pl1-f228.google.com with SMTP id d9443c01a7336-2021537a8e6so42085295ad.2 for ; Mon, 26 Aug 2024 13:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1724702798; x=1725307598; 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=Q8TxTvOGadljbUn31yujCB0BqQtc89HLPaIm+BtAmgI=; b=ahwy0X9bW8KHhXfJd3nkZTH54eTmtTpd1hTPmsxeMPICj7DCZ+eiTZtJx85EXmG8N3 MjxxKs9cRs8vU5kPD+k+3v4P17MTRJzrc6UAMK0qbm/rbXcd8QV7HehEzi9MxvOG/3xw CQDRX4aj81nQiAx5insaSTumGDPPW1tN4a3WU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724702798; x=1725307598; 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=Q8TxTvOGadljbUn31yujCB0BqQtc89HLPaIm+BtAmgI=; b=KQ8UMW+LEx4EYXaDuWw+vyWa9XiaAukGcqlBrP7sRFX/w+eisa9wb5aRmS9/f7+tC1 4uE7J5BQz2Y0TDCCTPmHOlcCrLzV+mHqyR9vmgqGCalAkfAihjFf+3cXtUawndKZjuHR 1LKZAe2YT40gGe7sExrLEdfI02NtcohkcGzuu7Nt6ouovKvGu4MpXf8oS1Rf3lLb58R9 6u+I/9fZSGBqVjkH3MDe+9583fVmW8b8QG6etBwyKNeKdPPS+RRYd+gPE08Ve/EwKZAO 5+/vqpY9ZlY8uhu5JcTPj5BaXh3RFjXTKPUtCinxu9qkXe55lxHzNZG7eAv0M50xGef/ 2Ukg== X-Gm-Message-State: AOJu0Yy9ZvXMPecUe+BM4YshWwjHhmqZs+qkOV3Yi/5R5C7srn5Paiqv /r6HVZaDKr37d0esNUWq+RzzB7uDd4Thl/a+fbkdzsrkp04t7+zswJ1P/ckYROP4iuQHZ0mGECR bsUreDpTUKaVAWhBvT0HVj6eW4+MXbjOo X-Google-Smtp-Source: AGHT+IHOl+FTiQ4lyYglAvgN9QyZVvOe48RYEOtEpUZc7d1HLzj9N4n/xNXexqlyq1Fjf8A7Z98Fnf2rV89x X-Received: by 2002:a17:902:f64b:b0:1fa:4b9:d00f with SMTP id d9443c01a7336-2039e51b70fmr119691585ad.53.1724702798053; Mon, 26 Aug 2024 13:06:38 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [132.177.123.84]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-2038560d27bsm5615665ad.132.2024.08.26.13.06.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Aug 2024 13:06:38 -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 81DED605C352; Mon, 26 Aug 2024 16:06:36 -0400 (EDT) From: jspewock@iol.unh.edu To: juraj.linkes@pantheon.tech, Luca.Vizzarro@arm.com, Honnappa.Nagarahalli@arm.com, npratte@iol.unh.edu, paul.szczepanek@arm.com, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, yoan.picchi@foss.arm.com, alex.chapman@arm.com Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v1 1/1] dts: add methods for modifying MTU to testpmd shell Date: Mon, 26 Aug 2024 16:02:03 -0400 Message-ID: <20240826200203.13560-2-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240826200203.13560-1-jspewock@iol.unh.edu> References: <20240826200203.13560-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 | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index ca24b28070..0d2c972b8f 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -888,6 +888,33 @@ 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 we first stop ports, + then update the MTU, then start the ports again afterwards. + + 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 _close(self) -> None: """Overrides :meth:`~.interactive_shell.close`.""" self.stop() -- 2.46.0