[v3,12/12] dts: add NIC capabilities from show port info

Message ID 20240821145315.97974-13-juraj.linkes@pantheon.tech (mailing list archive)
State Superseded
Delegated to: Juraj Linkeš
Headers
Series dts: add test skipping based on capabilities |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation warning apply issues

Commit Message

Juraj Linkeš Aug. 21, 2024, 2:53 p.m. UTC
Add the capabilities advertised by the testpmd command "show port info"
so that test cases may be marked as requiring those capabilities:
RUNTIME_RX_QUEUE_SETUP
RUNTIME_TX_QUEUE_SETUP
RXQ_SHARE
FLOW_RULE_KEEP
FLOW_SHARED_OBJECT_KEEP

These names are copy pasted from the existing DeviceCapabilitiesFlag
class. Dynamic addition of Enum members runs into problems with typing
(mypy doesn't know about the members) and documentation generation
(Sphinx doesn't know about the members).

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 dts/framework/remote_session/testpmd_shell.py | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
  

Comments

Jeremy Spewock Aug. 26, 2024, 5:24 p.m. UTC | #1
On Wed, Aug 21, 2024 at 10:53 AM Juraj Linkeš
<juraj.linkes@pantheon.tech> wrote:
>
> Add the capabilities advertised by the testpmd command "show port info"
> so that test cases may be marked as requiring those capabilities:
> RUNTIME_RX_QUEUE_SETUP
> RUNTIME_TX_QUEUE_SETUP
> RXQ_SHARE
> FLOW_RULE_KEEP
> FLOW_SHARED_OBJECT_KEEP
>
> These names are copy pasted from the existing DeviceCapabilitiesFlag
> class. Dynamic addition of Enum members runs into problems with typing
> (mypy doesn't know about the members) and documentation generation
> (Sphinx doesn't know about the members).
>
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>

Reviewed-by: Jeremy Spewock <jspewock@iol.unh.edu>
  
Dean Marx Sept. 3, 2024, 6:02 p.m. UTC | #2
On Wed, Aug 21, 2024 at 10:53 AM Juraj Linkeš <juraj.linkes@pantheon.tech>
wrote:

> Add the capabilities advertised by the testpmd command "show port info"
> so that test cases may be marked as requiring those capabilities:
> RUNTIME_RX_QUEUE_SETUP
> RUNTIME_TX_QUEUE_SETUP
> RXQ_SHARE
> FLOW_RULE_KEEP
> FLOW_SHARED_OBJECT_KEEP
>
> These names are copy pasted from the existing DeviceCapabilitiesFlag
> class. Dynamic addition of Enum members runs into problems with typing
> (mypy doesn't know about the members) and documentation generation
> (Sphinx doesn't know about the members).
>
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
>

Reviewed-by: Dean Marx <dmarx@iol.unh.edu>
  

Patch

diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
index f83569669e..166ffc827e 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -1200,6 +1200,24 @@  def get_capabilities_rxq_info(
         else:
             unsupported_capabilities.add(NicCapability.SCATTERED_RX_ENABLED)
 
+    def get_capabilities_show_port_info(
+        self,
+        supported_capabilities: MutableSet["NicCapability"],
+        unsupported_capabilities: MutableSet["NicCapability"],
+    ) -> None:
+        """Get all capabilities from show port info and divide them into supported and unsupported.
+
+        Args:
+            supported_capabilities: Supported capabilities will be added to this set.
+            unsupported_capabilities: Unsupported capabilities will be added to this set.
+        """
+        self._update_capabilities_from_flag(
+            supported_capabilities,
+            unsupported_capabilities,
+            DeviceCapabilitiesFlag,
+            self.ports[0].device_capabilities,
+        )
+
     """
     ====== Decorator methods ======
     """
@@ -1332,6 +1350,24 @@  class NicCapability(NoAliasEnum):
     RX_OFFLOAD_VLAN: TestPmdShellCapabilityMethod = partial(
         TestPmdShell.get_capabilities_rx_offload
     )
+    #: Device supports Rx queue setup after device started.
+    RUNTIME_RX_QUEUE_SETUP: TestPmdShellCapabilityMethod = partial(
+        TestPmdShell.get_capabilities_show_port_info
+    )
+    #: Device supports Tx queue setup after device started.
+    RUNTIME_TX_QUEUE_SETUP: TestPmdShellCapabilityMethod = partial(
+        TestPmdShell.get_capabilities_show_port_info
+    )
+    #: Device supports shared Rx queue among ports within Rx domain and switch domain.
+    RXQ_SHARE: TestPmdShellCapabilityMethod = partial(TestPmdShell.get_capabilities_show_port_info)
+    #: Device supports keeping flow rules across restart.
+    FLOW_RULE_KEEP: TestPmdShellCapabilityMethod = partial(
+        TestPmdShell.get_capabilities_show_port_info
+    )
+    #: Device supports keeping shared flow objects across restart.
+    FLOW_SHARED_OBJECT_KEEP: TestPmdShellCapabilityMethod = partial(
+        TestPmdShell.get_capabilities_show_port_info
+    )
 
     def __call__(
         self,