DPDK patches and discussions
 help / color / mirror / Atom feed
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 <jspewock@iol.unh.edu>
Subject: [PATCH v1 1/1] dts: add methods for modifying MTU to testpmd shell
Date: Mon, 26 Aug 2024 16:02:03 -0400	[thread overview]
Message-ID: <20240826200203.13560-2-jspewock@iol.unh.edu> (raw)
In-Reply-To: <20240826200203.13560-1-jspewock@iol.unh.edu>

From: Jeremy Spewock <jspewock@iol.unh.edu>

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 <jspewock@iol.unh.edu>
---
 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


  reply	other threads:[~2024-08-26 20:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26 20:02 [PATCH v1 0/1] dts: allow for updating MTU with testpmd jspewock
2024-08-26 20:02 ` jspewock [this message]
2024-08-26 21:13 ` [PATCH v2 " jspewock
2024-08-26 21:13   ` [PATCH v2 1/1] dts: add methods for modifying MTU to testpmd shell jspewock
2024-09-05 14:21 ` [PATCH v3 0/1] dts: allow for updating MTU with testpmd jspewock
2024-09-05 14:21   ` [PATCH v3 1/1] dts: add methods for modifying MTU to testpmd shell jspewock
2024-09-06 13:58     ` Juraj Linkeš
2024-09-06 14:28       ` Jeremy Spewock
2024-09-06 18:00 ` [PATCH v4 0/1] dts: allow for updating MTU with testpmd jspewock
2024-09-06 18:00   ` [PATCH v4 1/1] dts: add methods for modifying MTU to testpmd shell jspewock
2024-09-09 12:32     ` Luca Vizzarro
2024-09-09 12:33     ` Luca Vizzarro
2024-09-09 15:52   ` [PATCH v4 0/1] dts: allow for updating MTU with testpmd Juraj Linkeš

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240826200203.13560-2-jspewock@iol.unh.edu \
    --to=jspewock@iol.unh.edu \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=Luca.Vizzarro@arm.com \
    --cc=alex.chapman@arm.com \
    --cc=dev@dpdk.org \
    --cc=juraj.linkes@pantheon.tech \
    --cc=npratte@iol.unh.edu \
    --cc=paul.szczepanek@arm.com \
    --cc=probb@iol.unh.edu \
    --cc=thomas@monjalon.net \
    --cc=wathsala.vithanage@arm.com \
    --cc=yoan.picchi@foss.arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).