[v2,1/2] dts: add blocked ports to EalParams

Message ID 20241107135654.4121761-2-luca.vizzarro@arm.com (mailing list archive)
State Accepted, archived
Delegated to: Paul Szczepanek
Headers
Series dts: add blocklist test suite |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation warning apply patch failure
ci/iol-testing warning apply patch failure

Commit Message

Luca Vizzarro Nov. 7, 2024, 1:56 p.m. UTC
Make the "ports" attribute of EalParams as it actually is to
"allowed_ports", and add "blocked_ports".

Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 dts/framework/params/eal.py                   | 6 +++++-
 dts/framework/params/types.py                 | 3 ++-
 dts/framework/remote_session/dpdk_shell.py    | 4 ++--
 dts/framework/remote_session/testpmd_shell.py | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)
  

Comments

Nicholas Pratte Nov. 7, 2024, 7:04 p.m. UTC | #1
Hi Luca, this looks good to me! The only thing that needs to be fixed
is the attributes component of the docstring for EalParams in eal.py.
Aside from that:

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

On Thu, Nov 7, 2024 at 9:00 AM Luca Vizzarro <luca.vizzarro@arm.com> wrote:
>
> Make the "ports" attribute of EalParams as it actually is to
> "allowed_ports", and add "blocked_ports".
>
> Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
> Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
> ---
>  dts/framework/params/eal.py                   | 6 +++++-
>  dts/framework/params/types.py                 | 3 ++-
>  dts/framework/remote_session/dpdk_shell.py    | 4 ++--
>  dts/framework/remote_session/testpmd_shell.py | 2 +-
>  4 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/dts/framework/params/eal.py b/dts/framework/params/eal.py
> index cf1594353a..71bc781eab 100644
> --- a/dts/framework/params/eal.py
> +++ b/dts/framework/params/eal.py
> @@ -45,9 +45,13 @@ class EalParams(Params):
>      vdevs: list[VirtualDevice] | None = field(
>          default=None, metadata=Params.multiple() | Params.long("vdev")
>      )
> -    ports: list[Port] | None = field(
> +    allowed_ports: list[Port] | None = field(
>          default=None,
>          metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("a"),
>      )
> +    blocked_ports: list[Port] | None = field(
> +        default=None,
> +        metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("b"),
> +    )
>      other_eal_param: Params | None = None
>      _separator: Literal[True] = field(default=True, init=False, metadata=Params.short("-"))
> diff --git a/dts/framework/params/types.py b/dts/framework/params/types.py
> index d77c4625fb..87d11502e8 100644
> --- a/dts/framework/params/types.py
> +++ b/dts/framework/params/types.py
> @@ -50,7 +50,8 @@ class EalParamsDict(TypedDict, total=False):
>      prefix: str
>      no_pci: Switch
>      vdevs: list[VirtualDevice] | None
> -    ports: list[Port] | None
> +    allowed_ports: list[Port] | None
> +    blocked_ports: list[Port] | None
>      other_eal_param: Params | None
>
>
> diff --git a/dts/framework/remote_session/dpdk_shell.py b/dts/framework/remote_session/dpdk_shell.py
> index b39132cc42..82fa4755f0 100644
> --- a/dts/framework/remote_session/dpdk_shell.py
> +++ b/dts/framework/remote_session/dpdk_shell.py
> @@ -56,8 +56,8 @@ def compute_eal_params(
>          sut_node.dpdk_prefix_list.append(prefix)
>      params.prefix = prefix
>
> -    if params.ports is None:
> -        params.ports = sut_node.ports
> +    if params.allowed_ports is None:
> +        params.allowed_ports = sut_node.ports
>
>      return params
>
> diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
> index 8a45a5231b..221465f6fb 100644
> --- a/dts/framework/remote_session/testpmd_shell.py
> +++ b/dts/framework/remote_session/testpmd_shell.py
> @@ -1465,7 +1465,7 @@ def start(self, verify: bool = True) -> None:
>                  self._logger.debug(f"Failed to start packet forwarding: \n{start_cmd_output}")
>                  raise InteractiveCommandExecutionError("Testpmd failed to start packet forwarding.")
>
> -            number_of_ports = len(self._app_params.ports or [])
> +            number_of_ports = len(self._app_params.allowed_ports or [])
>              for port_id in range(number_of_ports):
>                  if not self.wait_link_status_up(port_id):
>                      raise InteractiveCommandExecutionError(
> --
> 2.43.0
>
  
Luca Vizzarro Nov. 8, 2024, 2:36 p.m. UTC | #2
On 07/11/2024 19:04, Nicholas Pratte wrote:
> Hi Luca, this looks good to me! The only thing that needs to be fixed
> is the attributes component of the docstring for EalParams in eal.py.
> Aside from that:
> 
> Reviewed-by: Nicholas Pratte <npratte@iol.unh.edu>

Great, catch! Thanks!
  

Patch

diff --git a/dts/framework/params/eal.py b/dts/framework/params/eal.py
index cf1594353a..71bc781eab 100644
--- a/dts/framework/params/eal.py
+++ b/dts/framework/params/eal.py
@@ -45,9 +45,13 @@  class EalParams(Params):
     vdevs: list[VirtualDevice] | None = field(
         default=None, metadata=Params.multiple() | Params.long("vdev")
     )
-    ports: list[Port] | None = field(
+    allowed_ports: list[Port] | None = field(
         default=None,
         metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("a"),
     )
+    blocked_ports: list[Port] | None = field(
+        default=None,
+        metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("b"),
+    )
     other_eal_param: Params | None = None
     _separator: Literal[True] = field(default=True, init=False, metadata=Params.short("-"))
diff --git a/dts/framework/params/types.py b/dts/framework/params/types.py
index d77c4625fb..87d11502e8 100644
--- a/dts/framework/params/types.py
+++ b/dts/framework/params/types.py
@@ -50,7 +50,8 @@  class EalParamsDict(TypedDict, total=False):
     prefix: str
     no_pci: Switch
     vdevs: list[VirtualDevice] | None
-    ports: list[Port] | None
+    allowed_ports: list[Port] | None
+    blocked_ports: list[Port] | None
     other_eal_param: Params | None
 
 
diff --git a/dts/framework/remote_session/dpdk_shell.py b/dts/framework/remote_session/dpdk_shell.py
index b39132cc42..82fa4755f0 100644
--- a/dts/framework/remote_session/dpdk_shell.py
+++ b/dts/framework/remote_session/dpdk_shell.py
@@ -56,8 +56,8 @@  def compute_eal_params(
         sut_node.dpdk_prefix_list.append(prefix)
     params.prefix = prefix
 
-    if params.ports is None:
-        params.ports = sut_node.ports
+    if params.allowed_ports is None:
+        params.allowed_ports = sut_node.ports
 
     return params
 
diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
index 8a45a5231b..221465f6fb 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -1465,7 +1465,7 @@  def start(self, verify: bool = True) -> None:
                 self._logger.debug(f"Failed to start packet forwarding: \n{start_cmd_output}")
                 raise InteractiveCommandExecutionError("Testpmd failed to start packet forwarding.")
 
-            number_of_ports = len(self._app_params.ports or [])
+            number_of_ports = len(self._app_params.allowed_ports or [])
             for port_id in range(number_of_ports):
                 if not self.wait_link_status_up(port_id):
                     raise InteractiveCommandExecutionError(