DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1 0/1] dts: allow for updating MTU with testpmd
@ 2024-08-26 20:02 jspewock
  2024-08-26 20:02 ` [PATCH v1 1/1] dts: add methods for modifying MTU to testpmd shell jspewock
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: jspewock @ 2024-08-26 20:02 UTC (permalink / raw)
  To: juraj.linkes, Luca.Vizzarro, Honnappa.Nagarahalli, npratte,
	paul.szczepanek, thomas, wathsala.vithanage, probb, yoan.picchi,
	alex.chapman
  Cc: dev, Jeremy Spewock

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

There are mechanisms to update the MTU of ports in the framework
already, but only when those ports are bound to their kernel drivers.
This series adds the functionality needed within testpmd to change the
MTU of ports on the SUT which are bound to their DPDK driver.

Jeremy Spewock (1):
  dts: add methods for modifying MTU to testpmd shell

 dts/framework/remote_session/testpmd_shell.py | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)

-- 
2.46.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v1 1/1] dts: add methods for modifying MTU to testpmd shell
  2024-08-26 20:02 [PATCH v1 0/1] dts: allow for updating MTU with testpmd jspewock
@ 2024-08-26 20:02 ` jspewock
  2024-08-26 21:13 ` [PATCH v2 0/1] dts: allow for updating MTU with testpmd jspewock
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: jspewock @ 2024-08-26 20:02 UTC (permalink / raw)
  To: juraj.linkes, Luca.Vizzarro, Honnappa.Nagarahalli, npratte,
	paul.szczepanek, thomas, wathsala.vithanage, probb, yoan.picchi,
	alex.chapman
  Cc: dev, Jeremy Spewock

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 0/1] dts: allow for updating MTU with testpmd
  2024-08-26 20:02 [PATCH v1 0/1] dts: allow for updating MTU with testpmd jspewock
  2024-08-26 20:02 ` [PATCH v1 1/1] dts: add methods for modifying MTU to testpmd shell jspewock
@ 2024-08-26 21:13 ` 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-06 18:00 ` [PATCH v4 0/1] dts: allow for updating MTU with testpmd jspewock
  3 siblings, 1 reply; 13+ messages in thread
From: jspewock @ 2024-08-26 21:13 UTC (permalink / raw)
  To: paul.szczepanek, alex.chapman, Honnappa.Nagarahalli, npratte,
	wathsala.vithanage, juraj.linkes, probb, Luca.Vizzarro,
	yoan.picchi, thomas
  Cc: dev, Jeremy Spewock

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

v2:
  * allow for setting the MTU of all ports with testpmd.
  * update doc-string

Jeremy Spewock (1):
  dts: add methods for modifying MTU to testpmd shell

 dts/framework/remote_session/testpmd_shell.py | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)

-- 
2.46.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/1] dts: add methods for modifying MTU to testpmd shell
  2024-08-26 21:13 ` [PATCH v2 0/1] dts: allow for updating MTU with testpmd jspewock
@ 2024-08-26 21:13   ` jspewock
  0 siblings, 0 replies; 13+ messages in thread
From: jspewock @ 2024-08-26 21:13 UTC (permalink / raw)
  To: paul.szczepanek, alex.chapman, Honnappa.Nagarahalli, npratte,
	wathsala.vithanage, juraj.linkes, probb, Luca.Vizzarro,
	yoan.picchi, thomas
  Cc: dev, Jeremy Spewock

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 | 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3 0/1] dts: allow for updating MTU with testpmd
  2024-08-26 20:02 [PATCH v1 0/1] dts: allow for updating MTU with testpmd jspewock
  2024-08-26 20:02 ` [PATCH v1 1/1] dts: add methods for modifying MTU to testpmd shell jspewock
  2024-08-26 21:13 ` [PATCH v2 0/1] dts: allow for updating MTU with testpmd jspewock
@ 2024-09-05 14:21 ` jspewock
  2024-09-05 14:21   ` [PATCH v3 1/1] dts: add methods for modifying MTU to testpmd shell jspewock
  2024-09-06 18:00 ` [PATCH v4 0/1] dts: allow for updating MTU with testpmd jspewock
  3 siblings, 1 reply; 13+ messages in thread
From: jspewock @ 2024-09-05 14:21 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, paul.szczepanek, wathsala.vithanage, probb,
	yoan.picchi, Luca.Vizzarro, thomas, alex.chapman, npratte,
	juraj.linkes
  Cc: dev, Jeremy Spewock

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

v3:
 * add if-statement to pass the formatting script since the ports
   parameter for testpmd is technically optional, but it will not be
   None unless the user deliberately sets it to be.

Jeremy Spewock (1):
  dts: add methods for modifying MTU to testpmd shell

 dts/framework/remote_session/testpmd_shell.py | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)

-- 
2.46.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3 1/1] dts: add methods for modifying MTU to testpmd shell
  2024-09-05 14:21 ` [PATCH v3 0/1] dts: allow for updating MTU with testpmd jspewock
@ 2024-09-05 14:21   ` jspewock
  2024-09-06 13:58     ` Juraj Linkeš
  0 siblings, 1 reply; 13+ messages in thread
From: jspewock @ 2024-09-05 14:21 UTC (permalink / raw)
  To: Honnappa.Nagarahalli, paul.szczepanek, wathsala.vithanage, probb,
	yoan.picchi, Luca.Vizzarro, thomas, alex.chapman, npratte,
	juraj.linkes
  Cc: dev, Jeremy Spewock

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 | 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/1] dts: add methods for modifying MTU to testpmd shell
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Juraj Linkeš @ 2024-09-06 13:58 UTC (permalink / raw)
  To: jspewock, Honnappa.Nagarahalli, paul.szczepanek,
	wathsala.vithanage, probb, yoan.picchi, Luca.Vizzarro, thomas,
	alex.chapman, npratte
  Cc: dev

> 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:

> +    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:

We should utilize the port info caching patch here:
https://patches.dpdk.org/project/dpdk/patch/20240823074137.13989-1-juraj.linkes@pantheon.tech/

Other than that, the patch looks good.

> +            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()


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/1] dts: add methods for modifying MTU to testpmd shell
  2024-09-06 13:58     ` Juraj Linkeš
@ 2024-09-06 14:28       ` Jeremy Spewock
  0 siblings, 0 replies; 13+ messages in thread
From: Jeremy Spewock @ 2024-09-06 14:28 UTC (permalink / raw)
  To: Juraj Linkeš
  Cc: Honnappa.Nagarahalli, paul.szczepanek, wathsala.vithanage, probb,
	yoan.picchi, Luca.Vizzarro, thomas, alex.chapman, npratte, dev

On Fri, Sep 6, 2024 at 9:58 AM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
>
> > 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:
>
> > +    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:
>
> We should utilize the port info caching patch here:
> https://patches.dpdk.org/project/dpdk/patch/20240823074137.13989-1-juraj.linkes@pantheon.tech/
>
> Other than that, the patch looks good.
>

That's a good idea, I also like that it sort of detaches this method
from the subtle requirement that testpmd is started with an allow list
of ports. This requirement is enforced right now, but I think it makes
more sense for this method to operate based on what testpmd is aware
of anyway. It does add another patch to the dependency chain though,
we should probably prioritize getting the info caching patch into
next-dts.

> > +            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()
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v4 0/1] dts: allow for updating MTU with testpmd
  2024-08-26 20:02 [PATCH v1 0/1] dts: allow for updating MTU with testpmd jspewock
                   ` (2 preceding siblings ...)
  2024-09-05 14:21 ` [PATCH v3 0/1] dts: allow for updating MTU with testpmd jspewock
@ 2024-09-06 18:00 ` jspewock
  2024-09-06 18:00   ` [PATCH v4 1/1] dts: add methods for modifying MTU to testpmd shell jspewock
  2024-09-09 15:52   ` [PATCH v4 0/1] dts: allow for updating MTU with testpmd Juraj Linkeš
  3 siblings, 2 replies; 13+ messages in thread
From: jspewock @ 2024-09-06 18:00 UTC (permalink / raw)
  To: thomas, alex.chapman, Luca.Vizzarro, yoan.picchi,
	paul.szczepanek, probb, Honnappa.Nagarahalli, juraj.linkes,
	wathsala.vithanage, npratte
  Cc: dev, Jeremy Spewock

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

v4:
 * add dependency on port caching patch to avoid the need for
   the if-statement that was added in the last version.

Jeremy Spewock (1):
  dts: add methods for modifying MTU to testpmd shell

 dts/framework/remote_session/testpmd_shell.py | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)

-- 
2.46.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v4 1/1] dts: add methods for modifying MTU to testpmd shell
  2024-09-06 18:00 ` [PATCH v4 0/1] dts: allow for updating MTU with testpmd jspewock
@ 2024-09-06 18:00   ` 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š
  1 sibling, 2 replies; 13+ messages in thread
From: jspewock @ 2024-09-06 18:00 UTC (permalink / raw)
  To: thomas, alex.chapman, Luca.Vizzarro, yoan.picchi,
	paul.szczepanek, probb, Honnappa.Nagarahalli, juraj.linkes,
	wathsala.vithanage, npratte
  Cc: dev, Jeremy Spewock

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")
Depends-on: patch-143360 ("dts: add testpmd port information caching")

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/1] dts: add methods for modifying MTU to testpmd shell
  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
  1 sibling, 0 replies; 13+ messages in thread
From: Luca Vizzarro @ 2024-09-09 12:32 UTC (permalink / raw)
  To: jspewock, thomas, alex.chapman, yoan.picchi, paul.szczepanek,
	probb, Honnappa.Nagarahalli, juraj.linkes, wathsala.vithanage,
	npratte
  Cc: dev

Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/1] dts: add methods for modifying MTU to testpmd shell
  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
  1 sibling, 0 replies; 13+ messages in thread
From: Luca Vizzarro @ 2024-09-09 12:33 UTC (permalink / raw)
  To: jspewock, thomas, alex.chapman, yoan.picchi, paul.szczepanek,
	probb, Honnappa.Nagarahalli, juraj.linkes, wathsala.vithanage,
	npratte
  Cc: dev

On 06/09/2024 19:00, jspewock@iol.unh.edu wrote:
> 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")
> Depends-on: patch-143360 ("dts: add testpmd port information caching")

Just a note I forgot to add, these shouldn't go in the commit body[1].

> Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
> ---

[1] https://doc.dpdk.org/guides/contributing/patches.html#patch-dependencies

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 0/1] dts: allow for updating MTU with testpmd
  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 15:52   ` Juraj Linkeš
  1 sibling, 0 replies; 13+ messages in thread
From: Juraj Linkeš @ 2024-09-09 15:52 UTC (permalink / raw)
  To: jspewock, thomas, alex.chapman, Luca.Vizzarro, yoan.picchi,
	paul.szczepanek, probb, Honnappa.Nagarahalli, wathsala.vithanage,
	npratte
  Cc: dev

Applied to next-dts, thanks.

On 6. 9. 2024 20:00, jspewock@iol.unh.edu wrote:
> From: Jeremy Spewock <jspewock@iol.unh.edu>
> 
> v4:
>   * add dependency on port caching patch to avoid the need for
>     the if-statement that was added in the last version.
> 
> Jeremy Spewock (1):
>    dts: add methods for modifying MTU to testpmd shell
> 
>   dts/framework/remote_session/testpmd_shell.py | 44 +++++++++++++++++++
>   1 file changed, 44 insertions(+)
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-09-09 15:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-26 20:02 [PATCH v1 0/1] dts: allow for updating MTU with testpmd jspewock
2024-08-26 20:02 ` [PATCH v1 1/1] dts: add methods for modifying MTU to testpmd shell jspewock
2024-08-26 21:13 ` [PATCH v2 0/1] dts: allow for updating MTU with testpmd 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š

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).