<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Feb 25, 2025 at 10:34 AM Thomas Wilks <<a href="mailto:thomas.wilks@arm.com">thomas.wilks@arm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Alex Chapman <<a href="mailto:alex.chapman@arm.com" target="_blank">alex.chapman@arm.com</a>><br>
<br>
Port over the pmd_rss_hash test suite from old DTS. This<br>
suite verifies that the 4 supported types of hashing<br>
algorithm used in Receive Side Scaling (RSS) function<br>
correctly. Them being DEFAULT, TOEPLITZ<br>
SYMMETRIC_TOEPLITZ and SIMPLE_XOR. This test suite also<br>
verifies the supported hashing algorithms reported by<br>
the NIC are correct.<br>
<br>
Signed-off-by: Alex Chapman <<a href="mailto:alex.chapman@arm.com" target="_blank">alex.chapman@arm.com</a>><br>
Signed-off-by: Thomas Wilks <<a href="mailto:thomas.wilks@arm.com" target="_blank">thomas.wilks@arm.com</a>><br>
<br>
Reviewed-by: Paul Szczepanek <<a href="mailto:paul.szczepanek@arm.com" target="_blank">paul.szczepanek@arm.com</a>><br>
---<br>
 dts/tests/TestSuite_pmd_rss_hash.py | 118 ++++++++++++++++++++++++++++<br>
 1 file changed, 118 insertions(+)<br>
 create mode 100644 dts/tests/TestSuite_pmd_rss_hash.py<br>
<br>
diff --git a/dts/tests/TestSuite_pmd_rss_hash.py b/dts/tests/TestSuite_pmd_rss_hash.py<br>
new file mode 100644<br>
index 0000000000..d21e33456e<br>
--- /dev/null<br>
+++ b/dts/tests/TestSuite_pmd_rss_hash.py<br>
@@ -0,0 +1,118 @@<br>
+# SPDX-License-Identifier: BSD-3-Clause<br>
+# Copyright(c) 2025 Arm Limited<br>
+<br>
+"""RSS Hash testing suite.<br>
+<br>
+Hashing algorithms are used in conjunction with a RSS hash keys to hash packets.<br>
+This test suite verifies that updating the Hashing algorithms will<br>
+continue to correctly hash packets.<br>
+<br>
+Symmetric_toeplitz_sort hasn't been included due to it not being supported by<br>
+the rss func actions in the flow rule.<br>
+"""<br>
+<br>
+from framework.remote_session.testpmd_shell import FlowRule, TestPmdShell<br>
+from framework.test_suite import TestSuite, func_test<br>
+from framework.testbed_model.capability import NicCapability, requires<br>
+from framework.testbed_model.topology import TopologyType<br>
+from framework.utils import StrEnum<br>
+<br>
+from .pmd_rss_utils import (  # type: ignore[import-untyped]<br>
+    SendTestPackets,<br>
+    SetupRssEnvironment,<br>
+    VerifyHashQueue,<br>
+)<br>
+<br>
+NUM_QUEUES = 16<br>
+<br>
+<br>
+class HashAlgorithm(StrEnum):<br>
+    """Enum of hashing algorithms."""<br>
+<br>
+    DEFAULT = "default"<br>
+    SIMPLE_XOR = "simple_xor"<br>
+    TOEPLITZ = "toeplitz"<br>
+    SYMMETRIC_TOEPLITZ = "symmetric_toeplitz"<br>
+<br>
+<br>
+@requires(topology_type=TopologyType.one_link)<br>
+class TestPmdRssHash(TestSuite):<br>
+    """PMD RSS Hash test suite.<br>
+<br>
+    Verifies the redirection table when updating the size.<br>
+    The suite contains four tests, one for each hash algorithms.<br>
+    """<br>
+<br>
+    def VerifyHashFunction(self, hash_algorithm: HashAlgorithm) -> None:<br>
+        """Verifies the hash function is supported by the NIC.<br>
+<br>
+        Args:<br>
+            hash_algorithm: The hash algorithm to be tested.<br>
+        """<br>
+        is_symmetric = hash_algorithm == HashAlgorithm.SYMMETRIC_TOEPLITZ<br>
+        # Build flow rule<br>
+        flow_rule = FlowRule(<br>
+            group_id=0,<br>
+            direction="ingress",<br>
+            pattern=["eth / ipv4 / udp"],<br>
+            actions=[f"rss types ipv4-udp end queues end func {str(hash_algorithm).lower()}"],<br>
+        )<br>
+<br>
+        # Run the key update test suite with an asymmetric hash algorithm<br>
+        with TestPmdShell(<br>
+            rx_queues=NUM_QUEUES,<br>
+            tx_queues=NUM_QUEUES,<br>
+        ) as testpmd:<br>
+            # Setup testpmd environment for RSS, create RETA table, return RETA table and key_size<br>
+            reta, _ = SetupRssEnvironment(self, testpmd, NUM_QUEUES, flow_rule)<br>
+            # Send udp packets and ensure hash corresponds with queue<br>
+            parsed_output = SendTestPackets(self, testpmd, is_symmetric)<br>
+            VerifyHashQueue(self, reta, parsed_output, is_symmetric)<br>
+<br>
+    @func_test<br>
+    def TestDefaultHashAlgorithm(self) -> None:<br>
+        """Default hashing algorithm test.<br>
+<br>
+        Steps:<br>
+            Setup RSS environment using the default RSS hashing algorithm<br>
+            and send test packets.<br>
+        Verify:<br>
+            Packet hash corresponds to the packet queue.<br>
+        """<br>
+        self.VerifyHashFunction(HashAlgorithm.DEFAULT)<br>
+<br>
+    @func_test<br>
+    def TestToeplitzHashAlgorithm(self) -> None:<br>
+        """Toeplitz hashing algorithm test.<br>
+<br>
+        Steps:<br>
+            Setup RSS environment using the toeplitz RSS hashing algorithm and send test packets.<br>
+        Verify:<br>
+            Packet hash corresponds to the packet queue.<br>
+        """<br>
+        self.VerifyHashFunction(HashAlgorithm.TOEPLITZ)<br>
+<br>
+    @func_test<br>
+    def TestSymmetricToeplitzHashAlgorithm(self) -> None:<br>
+        """Symmetric toeplitz hashing algorithm test.<br>
+<br>
+        Steps:<br>
+            Setup RSS environment using the symmetric_toeplitz RSS hashing algorithm<br>
+            and send test packets.<br>
+        Verify:<br>
+            Packet hash corresponds to the packet queue.<br>
+        """<br>
+        self.VerifyHashFunction(HashAlgorithm.SYMMETRIC_TOEPLITZ)<br>
+<br>
+    @requires(NicCapability.XOR_SUPPORT)<br>
+    @func_test<br>
+    def TestSimpleXorHashAlgorithm(self) -> None:<br>
+        """Simple xor hashing algorithm test.<br>
+<br>
+        Steps:<br>
+            Setup RSS environment using the simple xor RSS hashing algorithm<br>
+            and send test packets.<br>
+        Verify:<br>
+            Packet hash corresponds to the packet queue.<br>
+        """<br>
+        self.VerifyHashFunction(HashAlgorithm.SIMPLE_XOR)<br>
-- <br>
2.43.0<br>
<br></blockquote><div><br></div><div>The testsuite looks good although the functions need to move to snake style naming convention.</div><div><br></div><div>Tested on an Intel XL710, which skipped all but the default hash algorithm (passing).</div><div><br></div><div>Reviewed-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>></div><div>Tested-by: Patrick Robb <<a href="mailto:probb@iol.unh.eu">probb@iol.unh.eu</a>> </div></div></div>