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 2BB784590E; Thu, 5 Sep 2024 16:21:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C4FA42E9C; Thu, 5 Sep 2024 16:21:47 +0200 (CEST) Received: from mail-pf1-f227.google.com (mail-pf1-f227.google.com [209.85.210.227]) by mails.dpdk.org (Postfix) with ESMTP id 9667D42E95 for ; Thu, 5 Sep 2024 16:21:45 +0200 (CEST) Received: by mail-pf1-f227.google.com with SMTP id d2e1a72fcca58-7177e6cd298so757451b3a.3 for ; Thu, 05 Sep 2024 07:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1725546105; x=1726150905; 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=fPRIOrQfsZCN4+COnCAGJGp2Nf2IVzheuzrFLxijbmY=; b=O4irxhxyc65PUriEj3CGxRKlFBj94okDdGZjQximUT8cMh1R7NMq3d5fBlZRF4fWt8 v9u7Mqlzy9J+GUQJ7qgOw1BU1WkkBdReZFoWzPWOh0XQgGYYnarCWJJypysN3MBr38HU PYi7OtwSTra3fT5jtWtyRsPUiCtvPOVKUc73I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725546105; x=1726150905; 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=fPRIOrQfsZCN4+COnCAGJGp2Nf2IVzheuzrFLxijbmY=; b=xLabOp6COheqBsfxrdu2J8DcYjKmE9cHeWBmZpX+sDm9X7PGrXfrxUlIaaXfpTg9sz Mh3L2sgkms2/lvCeHBiU4CDnerlY4DQ1iI0vnDELPNOGDJIWmFJUlFcuvr81cUAugS/p FLGGz7/Yu3iQgeTYmbOlXbSo7iyGQ1EhGXNRIlCkI2o8TmpMjQ70fovgBk3OU6M7yjff rwHPrZqFrAh2ggbamB3xDwE0kitP6ULcsLxsF4C+PKaAUH3P+XFtC0FmuZbNiaV9KlB+ 7E+bKVzGtRO7x5iphWM2Q/iYPL2giR07ioB9QmuZMpkW2aJIM0UeJyYjxMeIkVVqQabk mQHw== X-Gm-Message-State: AOJu0YwwkrK6HU4B1ZL+fo0OPavmPxvHC0XoH1pTBkvdVdd0ioWKNP6W HmXHK4Xf/u+mkaJyZ35n+yW+9bCMlLDQt8Gacak/d2wOtAsHH5FSiIVSYHmb6ih6fbAfRGp+ktV u08wop8tujkdwsH/WuoAt3Ur+NRDEOyGffoY+fSHo669+O7Rt X-Google-Smtp-Source: AGHT+IEsp2DtqA2jHOjlHaTD3HnGWF7NMjzZ7q15O36HeoSAWtIjVPQbH1RPVCMGVHaT9oKOgEAeNm01jHe0 X-Received: by 2002:a05:6a00:1989:b0:714:340c:b9ee with SMTP id d2e1a72fcca58-7174574094fmr17285339b3a.1.1725546104581; Thu, 05 Sep 2024 07:21:44 -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 41be03b00d2f7-7d4fbd8f664sm210399a12.15.2024.09.05.07.21.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Sep 2024 07:21:44 -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 3F2756050A6B; Thu, 5 Sep 2024 10:21:43 -0400 (EDT) From: jspewock@iol.unh.edu To: Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, wathsala.vithanage@arm.com, probb@iol.unh.edu, yoan.picchi@foss.arm.com, Luca.Vizzarro@arm.com, thomas@monjalon.net, alex.chapman@arm.com, npratte@iol.unh.edu, juraj.linkes@pantheon.tech Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v3 1/1] dts: add methods for modifying MTU to testpmd shell Date: Thu, 5 Sep 2024 10:21:23 -0400 Message-ID: <20240905142123.31342-2-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240905142123.31342-1-jspewock@iol.unh.edu> References: <20240826200203.13560-1-jspewock@iol.unh.edu> <20240905142123.31342-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 | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index ca24b28070..c1462ba2d3 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -888,6 +888,51 @@ 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. + """ + if self._app_params.ports is not None: + 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