dts: fix MTU set command

Message ID 20250107141125.2611481-1-luca.vizzarro@arm.com (mailing list archive)
State Accepted
Delegated to: Paul Szczepanek
Headers
Series dts: fix MTU set command |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Luca Vizzarro Jan. 7, 2025, 2:11 p.m. UTC
There are some PMDs that in order to set a scatter-offload-compatible
MTU size, they need to have started at least once since the startup of
testpmd. This fixes the behaviour of the command to start and stop the
ports before changing the MTU to ensure this happened

Fixes: 9910db35962b ("dts: add MTU config methods to testpmd shell")

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
Hi there,

sending a fix discovered after running pmd_buffer_scatter on Mellanox.
Which should just skip, but the capability checks fail.

Best,
Luca
---
 dts/framework/remote_session/testpmd_shell.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Patrick Robb Jan. 7, 2025, 3:04 p.m. UTC | #1
Reviewed-by: Patrick Robb <probb@iol.unh.edu>
  
Nicholas Pratte Jan. 7, 2025, 4:14 p.m. UTC | #2
Thanks Luca!

Reviewed-by: Nicholas Pratte <npratte@iol.unh.edu>

On Tue, Jan 7, 2025 at 9:13 AM Luca Vizzarro <luca.vizzarro@arm.com> wrote:
>
> There are some PMDs that in order to set a scatter-offload-compatible
> MTU size, they need to have started at least once since the startup of
> testpmd. This fixes the behaviour of the command to start and stop the
> ports before changing the MTU to ensure this happened
>
> Fixes: 9910db35962b ("dts: add MTU config methods to testpmd shell")
>
> Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
> Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
> ---
> Hi there,
>
> sending a fix discovered after running pmd_buffer_scatter on Mellanox.
> Which should just skip, but the capability checks fail.
>
> Best,
> Luca
> ---
>  dts/framework/remote_session/testpmd_shell.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
> index d187eaea94..c01ee74b21 100644
> --- a/dts/framework/remote_session/testpmd_shell.py
> +++ b/dts/framework/remote_session/testpmd_shell.py
> @@ -1836,13 +1836,16 @@ def csum_set_hw(
>                                                             {port_id}:\n{csum_output}"""
>                      )
>
> +    @requires_started_ports
>      @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.
> +        prior to changing their MTU. On the other hand, some PMDs require that the port had already
> +        been started once since testpmd startup. Therefore, ports are also started before stopping
> +        them to ensure this has happened.
>
>          Args:
>              port_id: ID of the port to adjust the MTU on.
> --
> 2.43.0
>
  

Patch

diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
index d187eaea94..c01ee74b21 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -1836,13 +1836,16 @@  def csum_set_hw(
                                                            {port_id}:\n{csum_output}"""
                     )
 
+    @requires_started_ports
     @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.
+        prior to changing their MTU. On the other hand, some PMDs require that the port had already
+        been started once since testpmd startup. Therefore, ports are also started before stopping
+        them to ensure this has happened.
 
         Args:
             port_id: ID of the port to adjust the MTU on.