[PATCH v2 6/6] dts: add NIC capabilities for hash algorithms
Thomas Wilks
thomas.wilks at arm.com
Tue Feb 25 16:33:45 CET 2025
Added checks for if a nic supports the simple_xor,
symmetric_toeplitz, symmetric_toeplitz_sort,
toeplitz, and default hashing algorithms.
Signed-off-by: Thomas Wilks <thomas.wilks at arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek at arm.com>
---
dts/framework/remote_session/testpmd_shell.py | 146 ++++++++++++++++++
dts/tests/TestSuite_pmd_rss_hash.py | 5 +-
2 files changed, 150 insertions(+), 1 deletion(-)
diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
index 0e1f29f2f3..4a5b31574c 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -2678,6 +2678,127 @@ def get_capabilities_flow_ctrl(
else:
unsupported_capabilities.add(NicCapability.FLOW_CTRL)
+ def get_capabilities_xor_rss_hash_algorithms(
+ self,
+ supported_capabilities: MutableSet["NicCapability"],
+ unsupported_capabilities: MutableSet["NicCapability"],
+ ) -> None:
+ """Get simple_xor rss hash algorithm capability and check for testpmd failure.
+
+ Args:
+ supported_capabilities: Supported capabilities will be added to this set.
+ unsupported_capabilities: Unsupported capabilities will be added to this set.
+ """
+ self.get_capabilities_rss_hash_algorithms(
+ "simple_xor",
+ NicCapability.RSS_HASH_XOR,
+ supported_capabilities,
+ unsupported_capabilities,
+ )
+
+ def get_capabilities_symmetric_toeplitz_rss_hash_algorithms(
+ self,
+ supported_capabilities: MutableSet["NicCapability"],
+ unsupported_capabilities: MutableSet["NicCapability"],
+ ) -> None:
+ """Get symmetric_toeplitz rss hash algorithm capability and check for testpmd failure.
+
+ Args:
+ supported_capabilities: Supported capabilities will be added to this set.
+ unsupported_capabilities: Unsupported capabilities will be added to this set.
+ """
+ self.get_capabilities_rss_hash_algorithms(
+ "symmetric Toeplitz",
+ NicCapability.RSS_HASH_SYMMETRIC_TOEPLITZ,
+ supported_capabilities,
+ unsupported_capabilities,
+ )
+
+ def get_capabilities_toeplitz_rss_hash_algorithms(
+ self,
+ supported_capabilities: MutableSet["NicCapability"],
+ unsupported_capabilities: MutableSet["NicCapability"],
+ ) -> None:
+ """Get toeplitz rss hash algorithm capability and check for testpmd failure.
+
+ Args:
+ supported_capabilities: Supported capabilities will be added to this set.
+ unsupported_capabilities: Unsupported capabilities will be added to this set.
+ """
+ self.get_capabilities_rss_hash_algorithms(
+ "toeplitz",
+ NicCapability.RSS_HASH_TOEPLITZ,
+ supported_capabilities,
+ unsupported_capabilities,
+ )
+
+ def get_capabilities_default_rss_hash_algorithms(
+ self,
+ supported_capabilities: MutableSet["NicCapability"],
+ unsupported_capabilities: MutableSet["NicCapability"],
+ ) -> None:
+ """Get default rss hash algorithm capability and check for testpmd failure.
+
+ Args:
+ supported_capabilities: Supported capabilities will be added to this set.
+ unsupported_capabilities: Unsupported capabilities will be added to this set.
+ """
+ self.get_capabilities_rss_hash_algorithms(
+ "default",
+ NicCapability.RSS_HASH_DEFAULT,
+ supported_capabilities,
+ unsupported_capabilities,
+ )
+
+ def get_capabilities_symmetric_toeplitz_sort_rss_hash_algorithms(
+ self,
+ supported_capabilities: MutableSet["NicCapability"],
+ unsupported_capabilities: MutableSet["NicCapability"],
+ ) -> None:
+ """Get symmetric_toeplitz_sort rss hash algorithm capability and check for testpmd failure.
+
+ Args:
+ supported_capabilities: Supported capabilities will be added to this set.
+ unsupported_capabilities: Unsupported capabilities will be added to this set.
+ """
+ self.get_capabilities_rss_hash_algorithms(
+ "symmetric_toeplitz_sort",
+ NicCapability.RSS_HASH_SYMMETRIC_TOEPLITZ_SORT,
+ supported_capabilities,
+ unsupported_capabilities,
+ )
+
+ def get_capabilities_rss_hash_algorithms(
+ self,
+ algorithm: str,
+ NicCapability,
+ supported_capabilities: MutableSet["NicCapability"],
+ unsupported_capabilities: MutableSet["NicCapability"],
+ ):
+ """Get algorithm and check for capability.
+
+ Args:
+ algorithm: The rss algorithm that is being tested.
+ NicCapability: The nic capability constant to be added to one of the MutableSets.
+ supported_capabilities: Supported capabilities will be added to this set.
+ unsupported_capabilities: Unsupported capabilities will be added to this set.
+
+ """
+ self._logger.debug(f"Getting hash capabilities for {algorithm} algorithm.")
+ self.send_command("port stop all")
+ self.send_command("port config all rxq 16")
+ self.send_command("port config all txq 16")
+ self.send_command("port start all")
+ command = f"show port {self.ports[0].id} rss-hash algorithm"
+ output = self.send_command(command)
+ if algorithm in output:
+ supported_capabilities.add(NicCapability)
+ else:
+ unsupported_capabilities.add(NicCapability)
+ self.send_command("port stop all")
+ self.send_command("port config all rxq 0")
+ self.send_command("port config all txq 0")
+
class NicCapability(NoAliasEnum):
"""A mapping between capability names and the associated :class:`TestPmdShell` methods.
@@ -2844,6 +2965,31 @@ class NicCapability(NoAliasEnum):
TestPmdShell.get_capabilities_flow_ctrl,
None,
)
+ #: Device supports simple_xor algorithm.
+ RSS_HASH_XOR: TestPmdShellNicCapability = (
+ TestPmdShell.get_capabilities_xor_rss_hash_algorithms,
+ None,
+ )
+ #: Device supports symmetric_toeplitz algorithm.
+ RSS_HASH_SYMMETRIC_TOEPLITZ: TestPmdShellNicCapability = (
+ TestPmdShell.get_capabilities_symmetric_toeplitz_rss_hash_algorithms,
+ None,
+ )
+ #: Device supports toeplitz algorithm.
+ RSS_HASH_TOEPLITZ: TestPmdShellNicCapability = (
+ TestPmdShell.get_capabilities_toeplitz_rss_hash_algorithms,
+ None,
+ )
+ #: Device supports default algorithm.
+ RSS_HASH_DEFAULT: TestPmdShellNicCapability = (
+ TestPmdShell.get_capabilities_default_rss_hash_algorithms,
+ None,
+ )
+ #: Device supports symmetric_toeplitz_sort algorithm.
+ RSS_HASH_SYMMETRIC_TOEPLITZ_SORT: TestPmdShellNicCapability = (
+ TestPmdShell.get_capabilities_symmetric_toeplitz_sort_rss_hash_algorithms,
+ None,
+ )
def __call__(
self,
diff --git a/dts/tests/TestSuite_pmd_rss_hash.py b/dts/tests/TestSuite_pmd_rss_hash.py
index d21e33456e..93aad80d50 100644
--- a/dts/tests/TestSuite_pmd_rss_hash.py
+++ b/dts/tests/TestSuite_pmd_rss_hash.py
@@ -69,6 +69,7 @@ def VerifyHashFunction(self, hash_algorithm: HashAlgorithm) -> None:
parsed_output = SendTestPackets(self, testpmd, is_symmetric)
VerifyHashQueue(self, reta, parsed_output, is_symmetric)
+ @requires(NicCapability.RSS_HASH_DEFAULT)
@func_test
def TestDefaultHashAlgorithm(self) -> None:
"""Default hashing algorithm test.
@@ -81,6 +82,7 @@ def TestDefaultHashAlgorithm(self) -> None:
"""
self.VerifyHashFunction(HashAlgorithm.DEFAULT)
+ @requires(NicCapability.RSS_HASH_TOEPLITZ)
@func_test
def TestToeplitzHashAlgorithm(self) -> None:
"""Toeplitz hashing algorithm test.
@@ -92,6 +94,7 @@ def TestToeplitzHashAlgorithm(self) -> None:
"""
self.VerifyHashFunction(HashAlgorithm.TOEPLITZ)
+ @requires(NicCapability.RSS_HASH_SYMMETRIC_TOEPLITZ)
@func_test
def TestSymmetricToeplitzHashAlgorithm(self) -> None:
"""Symmetric toeplitz hashing algorithm test.
@@ -104,7 +107,7 @@ def TestSymmetricToeplitzHashAlgorithm(self) -> None:
"""
self.VerifyHashFunction(HashAlgorithm.SYMMETRIC_TOEPLITZ)
- @requires(NicCapability.XOR_SUPPORT)
+ @requires(NicCapability.RSS_HASH_XOR)
@func_test
def TestSimpleXorHashAlgorithm(self) -> None:
"""Simple xor hashing algorithm test.
--
2.43.0
More information about the dev
mailing list