<div dir="ltr">Reviewed-by: Koushik Bhargav Nimoji <:<a href="mailto:knimoji@iol.unh.edu">knimoji@iol.unh.edu</a>></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Oct 19, 2026 at 4:04 PM Andrew Bailey <<a href="mailto:abailey@iol.unh.edu">abailey@iol.unh.edu</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">Previously, cryptodev latency testing only covered a handful of<br>
algorithm combinations and virtual device types for testing. The new<br>
implementation makes this test completely configurable to run any<br>
combination of arguments provided through the tests configuration file.<br>
<br>
Signed-off-by: Andrew Bailey <<a href="mailto:abailey@iol.unh.edu" target="_blank">abailey@iol.unh.edu</a>><br>
---<br>
dts/configurations/tests_config.example.yaml | 17 +<br>
dts/tests/TestSuite_cryptodev_latency.py | 1044 ++++++++----------<br>
2 files changed, 481 insertions(+), 580 deletions(-)<br>
<br>
diff --git a/dts/configurations/tests_config.example.yaml b/dts/configurations/tests_config.example.yaml<br>
index fe4bed2847..450a6cc5e7 100644<br>
--- a/dts/configurations/tests_config.example.yaml<br>
+++ b/dts/configurations/tests_config.example.yaml<br>
@@ -66,6 +66,23 @@ hello_world:<br>
# - buff_size: 64<br>
# Gbps: 1.5<br>
<br>
+# cryptodev_latency:<br>
+# # Identical to cryptodev_throughput configuration besides updated test_parameters below.<br>
+# delta_tolerance: 0.05<br>
+# - name: "example cipher test" # Add a name for this test config<br>
+# cipher_algorithm: "aes_cbc" # See `algortihms` in `Optional Fields` for a complete list<br>
+# virtual_device: "crypto_openssl" # uncomment to run with a virtual device.<br>
+# test_parameters: # Buffer sizes and expected throughput, a default is used if not present<br>
+# - buff_size: 64<br>
+# avg_cycles: 999999<br>
+# avg_time_us: 999999<br>
+# - buff_size: 512<br>
+# avg_cycles: 999999<br>
+# avg_time_us: 999999<br>
+# - buff_size: 2048<br>
+# avg_cycles: 999999<br>
+# avg_time_us: 999999<br>
+<br>
# port_speed_capabilities:<br>
# test_parameters:<br>
# 0 : 100 Gbps # Assign an expected link speed to a port ID in Gbps<br>
diff --git a/dts/tests/TestSuite_cryptodev_latency.py b/dts/tests/TestSuite_cryptodev_latency.py<br>
index 444a5b282c..a9e963bdfb 100644<br>
--- a/dts/tests/TestSuite_cryptodev_latency.py<br>
+++ b/dts/tests/TestSuite_cryptodev_latency.py<br>
@@ -9,6 +9,8 @@<br>
ensure performance standards are met.<br>
"""<br>
<br>
+from typing import Any<br>
+<br>
from api.capabilities import (<br>
LinkTopology,<br>
requires_link_topology,<br>
@@ -16,6 +18,9 @@<br>
from api.context import get_ctx<br>
from api.cryptodev import Cryptodev<br>
from api.cryptodev.config import (<br>
+ AEAD_ALGORITHM_PARAMS,<br>
+ AUTHENTICATION_ALGORITHM_PARAMS,<br>
+ CIPHER_ALGORITHM_PARAMS,<br>
AeadAlgName,<br>
AuthenticationAlgorithm,<br>
AuthenticationOpMode,<br>
@@ -30,14 +35,15 @@<br>
from api.cryptodev.types import (<br>
CryptodevResults,<br>
)<br>
-from api.test import skip, verify<br>
+from api.exception import ConfigurationError, SkippedTestException, TestCaseVerifyError<br>
+from api.test import fail, skip, verify<br>
from api.test_suite import BaseConfig, TestSuite, crypto_test<br>
from api.testbed_model.virtual_device import VirtualDevice<br>
<br>
config_list: list[dict[str, int | float | str]] = [<br>
- {"buff_size": 64, "avg_cycles": 99_999.00, "avg_time_us": 9999.0},<br>
- {"buff_size": 512, "avg_cycles": 99_999.00, "avg_time_us": 9999.0},<br>
- {"buff_size": 2048, "avg_cycles": 99_999.00, "avg_time_us": 9999.0},<br>
+ {"buff_size": 64, "avg_cycles": 999_999_999.0, "avg_time_us": 999_999_999.0},<br>
+ {"buff_size": 512, "avg_cycles": 999_999_999.0, "avg_time_us": 999_999_999.0},<br>
+ {"buff_size": 2048, "avg_cycles": 999_999_999.0, "avg_time_us": 999_999_999.0},<br>
]<br>
<br>
TOTAL_OPS = 10_000_000<br>
@@ -48,69 +54,191 @@ class Config(BaseConfig):<br>
<br>
Attributes:<br>
delta_tolerance: The allowed tolerance below a given baseline.<br>
- latency_test_parameters: The test parameters to use in the test suite.<br>
+ test_combinations: List of test combinations with cipher/auth algorithms and parameters.<br>
"""<br>
<br>
delta_tolerance: float = 0.05<br>
-<br>
- latency_test_parameters: dict[str, list[dict[str, int | float | str]]] = {<br>
- "aes_cbc": config_list,<br>
- "aes_cbc_sha1_hmac": config_list,<br>
- "aes_cbc_sha2_hmac": config_list,<br>
- "aes_docsisbpi": config_list,<br>
- "aes_gcm": config_list,<br>
- "kasumi_f8_kasumi_f9": config_list,<br>
- "snow3g_uea2_snow3g_uia2": config_list,<br>
- "zuc_eea3_zuc_eia3": config_list,<br>
- "aesni_gcm_vdev": config_list,<br>
- "aesni_mb_cipher_then_auth_vdev": config_list,<br>
- "aesni_mb_vdev": config_list,<br>
- "kasumi_vdev": config_list,<br>
- "open_ssl_vdev": config_list,<br>
- "snow3g_vdev": config_list,<br>
- "zuc_vdev": config_list,<br>
- }<br>
+ test_combinations: list[dict[str, Any]] = [<br>
+ #: cipher only tests<br>
+ {<br>
+ "name": "aes-cbc",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.aes_cbc.name" rel="noreferrer" target="_blank">CipherAlgorithm.aes_cbc.name</a>,<br>
+ "cipher_key_sz": 16,<br>
+ "cipher_iv_sz": 16,<br>
+ "burst_sz": 32,<br>
+ },<br>
+ {<br>
+ "name": "aes-docsisbpi",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.aes_docsisbpi.name" rel="noreferrer" target="_blank">CipherAlgorithm.aes_docsisbpi.name</a>,<br>
+ "cipher_key_sz": 32,<br>
+ "cipher_iv_sz": 16,<br>
+ },<br>
+ #: cipher then auth tests<br>
+ {<br>
+ "name": "aes-cbc/sha1_hmac",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.aes_cbc.name" rel="noreferrer" target="_blank">CipherAlgorithm.aes_cbc.name</a>,<br>
+ "cipher_key_sz": 16,<br>
+ "auth_algorithm": <a href="http://AuthenticationAlgorithm.sha1_hmac.name" rel="noreferrer" target="_blank">AuthenticationAlgorithm.sha1_hmac.name</a>,<br>
+ "auth_key_sz": 64,<br>
+ "digest_sz": 12,<br>
+ "burst_sz": 32,<br>
+ },<br>
+ {<br>
+ "name": "aes-cbc/sha2_hmac",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.aes_cbc.name" rel="noreferrer" target="_blank">CipherAlgorithm.aes_cbc.name</a>,<br>
+ "cipher_key_sz": 16,<br>
+ "auth_algorithm": <a href="http://AuthenticationAlgorithm.sha2_256_hmac.name" rel="noreferrer" target="_blank">AuthenticationAlgorithm.sha2_256_hmac.name</a>,<br>
+ "auth_key_sz": 64,<br>
+ "digest_sz": 32,<br>
+ "burst_sz": 32,<br>
+ },<br>
+ {<br>
+ "name": "kasumi-f8/kasumi-f9",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.kasumi_f8.name" rel="noreferrer" target="_blank">CipherAlgorithm.kasumi_f8.name</a>,<br>
+ "cipher_key_sz": 16,<br>
+ "cipher_iv_sz": 8,<br>
+ "auth_algorithm": <a href="http://AuthenticationAlgorithm.kasumi_f9.name" rel="noreferrer" target="_blank">AuthenticationAlgorithm.kasumi_f9.name</a>,<br>
+ "auth_key_sz": 16,<br>
+ "digest_sz": 4,<br>
+ "burst_sz": 32,<br>
+ },<br>
+ {<br>
+ "name": "snow3g-uea2/snow3g-uia2",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.snow3g_uea2.name" rel="noreferrer" target="_blank">CipherAlgorithm.snow3g_uea2.name</a>,<br>
+ "cipher_key_sz": 16,<br>
+ "cipher_iv_sz": 16,<br>
+ "auth_algorithm": <a href="http://AuthenticationAlgorithm.snow3g_uia2.name" rel="noreferrer" target="_blank">AuthenticationAlgorithm.snow3g_uia2.name</a>,<br>
+ "auth_key_sz": 16,<br>
+ "auth_iv_sz": 16,<br>
+ "digest_sz": 4,<br>
+ },<br>
+ {<br>
+ "name": "zuc-eea3/zuc-eia3",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.zuc_eea3.name" rel="noreferrer" target="_blank">CipherAlgorithm.zuc_eea3.name</a>,<br>
+ "cipher_key_sz": 16,<br>
+ "cipher_iv_sz": 16,<br>
+ "auth_algorithm": <a href="http://AuthenticationAlgorithm.zuc_eia3.name" rel="noreferrer" target="_blank">AuthenticationAlgorithm.zuc_eia3.name</a>,<br>
+ "auth_key_sz": 16,<br>
+ "auth_iv_sz": 16,<br>
+ "digest_sz": 4,<br>
+ },<br>
+ #: aead tests<br>
+ {<br>
+ "name": "aes-gcm",<br>
+ "aead_algorithm": <a href="http://AeadAlgName.aes_gcm.name" rel="noreferrer" target="_blank">AeadAlgName.aes_gcm.name</a>,<br>
+ "aead_key_sz": 16,<br>
+ "aead_iv_sz": 12,<br>
+ "aead_aad_sz": 16,<br>
+ },<br>
+ ]<br>
<br>
<br>
@requires_link_topology(LinkTopology.NO_LINK)<br>
class TestCryptodevLatency(TestSuite):<br>
- """DPDK Crypto Device Testing Suite."""<br>
+ """DPDK Crypto Device Latency Testing Suite."""<br>
<br>
config: Config<br>
<br>
def set_up_suite(self) -> None:<br>
- """Set up the test suite."""<br>
- self.latency_test_parameters: dict[str, list[dict[str, int | float | str]]] = (<br>
- self.config.latency_test_parameters<br>
- )<br>
+ """Set up the test suite.<br>
+<br>
+ Raises:<br>
+ ConfigurationError: If no tests can be derived from the provided config.<br>
+ """<br>
+ self.test_combinations: list[dict[str, Any]] = self.config.test_combinations<br>
self.delta_tolerance: float = self.config.delta_tolerance<br>
+ self.ops: int = 10_000_000<br>
self.device_type: DeviceType | None = get_device_from_str(<br>
str(get_ctx().sut_node.crypto_device_type)<br>
)<br>
- self.buffer_sizes = {}<br>
-<br>
- for k, v in self.latency_test_parameters.items():<br>
- self.buffer_sizes[k] = ListWrapper([int(run["buff_size"]) for run in v])<br>
+ self.buffer_sizes: dict[str, ListWrapper] = {}<br>
+ self.cipher_tests: list[dict[str, Any]] = []<br>
+ self.auth_tests: list[dict[str, Any]] = []<br>
+ self.cipher_then_auth_tests: list[dict[str, Any]] = []<br>
+ self.aead_tests: list[dict[str, Any]] = []<br>
+<br>
+ for combination in self.test_combinations:<br>
+ self.buffer_sizes[combination["name"]] = ListWrapper(<br>
+ [int(run["buff_size"]) for run in combination.get("test_parameters", config_list)]<br>
+ )<br>
+ is_cipher = "cipher_algorithm" in combination<br>
+ is_auth = "auth_algorithm" in combination<br>
+ aead = "aead_algorithm" in combination<br>
+<br>
+ if is_cipher and is_auth:<br>
+ self.cipher_then_auth_tests.append(combination)<br>
+ elif is_cipher:<br>
+ self.cipher_tests.append(combination)<br>
+ elif is_auth:<br>
+ self.auth_tests.append(combination)<br>
+ elif aead:<br>
+ self.aead_tests.append(combination)<br>
+ else:<br>
+ raise ConfigurationError(<br>
+ "Each test instance must contain either "<br>
+ "'cipher_algorithm', 'auth_algorithm', or 'aead_algorithm'"<br>
+ )<br>
<br>
def _print_stats(self, test_vals: list[dict[str, int | float | str]]) -> None:<br>
+ """Print the stats of the given test values in a clean format.<br>
+<br>
+ Args:<br>
+ test_vals: the testing values to print<br>
+ """<br>
+ assert len(test_vals) > 0, "test_vals must contain at least one element"<br>
+<br>
element_len = len("Avg Time us Target")<br>
- border_len = (element_len + 1) * (len(test_vals[0]))<br>
+ border_len = (element_len + 1) * (len(test_vals[0]) - 1)<br>
+ test_name = test_vals[0]["Test Name"]<br>
<br>
- print(f"{'Latency Results'.center(border_len)}\n{'=' * border_len}")<br>
+ print(f"{f'{test_name} Latency Results'.center(border_len)}\n{'=' * border_len}")<br>
for k, v in test_vals[0].items():<br>
- print(f"|{k.title():<{element_len}}", end="")<br>
+ if k != "Test Name":<br>
+ print(f"|{k.title():<{element_len}}", end="")<br>
print(f"|\n{'=' * border_len}")<br>
<br>
for test_val in test_vals:<br>
for k, v in test_val.items():<br>
- print(f"|{v:<{element_len}}", end="")<br>
+ if k != "Test Name":<br>
+ print(f"|{v:<{element_len}}", end="")<br>
print(f"|\n{'=' * border_len}")<br>
<br>
- def _verify_latency(<br>
+ def _print_and_verify(self, all_results: list[list[dict[str, int | float | str]]]) -> None:<br>
+ """Print the given results and then verify all results have passed.<br>
+<br>
+ Args:<br>
+ all_results: a list of results to print and verify.<br>
+ """<br>
+ for results in all_results:<br>
+ if len(results) > 0:<br>
+ self._print_stats(test_vals=results)<br>
+<br>
+ for results in all_results:<br>
+ for result in results:<br>
+ verify(<br>
+ result["passed"] == "PASS",<br>
+ f"Gbps fell below delta tolerance for test {result['Test Name']}",<br>
+ )<br>
+<br>
+ def _create_summary(<br>
self,<br>
results: list[CryptodevResults],<br>
- key: str,<br>
+ params: list[dict],<br>
+ test_name: str,<br>
) -> list[dict[str, int | float | str]]:<br>
+ """Verify the throughput of the given results against the supplied parameters.<br>
+<br>
+ Args:<br>
+ results: The results of the dpdk crypto perf app ran in latency mode.<br>
+ params: The baselines to compare the given results to.<br>
+ test_name: The test name to pin to the result summary.<br>
+<br>
+ Returns:<br>
+ A summary of latency statistics for a test and whether the test passed.<br>
+<br>
+ Raises:<br>
+ RuntimeError: When there are no baselines for a given result.<br>
+ """<br>
result_list: list[dict[str, int | float | str]] = []<br>
<br>
for result in results:<br>
@@ -118,601 +246,357 @@ def _verify_latency(<br>
parameters: dict[str, int | float | str] = next(<br>
filter(<br>
lambda x: x["buff_size"] == result.buffer_size,<br>
- self.latency_test_parameters[key],<br>
+ params,<br>
),<br>
{},<br>
)<br>
+ errmsg = (<br>
+ f"No test parameters found for {test_name} with buffer size {result.buffer_size}"<br>
+ )<br>
if parameters == {}:<br>
- raise RuntimeError(<br>
- f"No test parameters found for {key} with buffer size {result.buffer_size}"<br>
- )<br>
+ raise RuntimeError(errmsg)<br>
test_result = True<br>
+<br>
expected_cycles = parameters["avg_cycles"]<br>
- expected_time_us = parameters["avg_time_us"]<br>
- measured_time_delta = abs(<br>
- (getattr(result, "avg_time_us") - expected_time_us) / expected_time_us<br>
+ assert int(expected_cycles) > 0, "Expected average cycles must not be zero"<br>
+ measured_delta_cycles = abs(<br>
+ round((getattr(result, "avg_cycles") - expected_cycles) / expected_cycles, 5)<br>
)<br>
- measured_cycles_delta = abs(<br>
- (getattr(result, "avg_cycles") - expected_cycles) / expected_cycles<br>
+ expected_time = parameters["avg_time_us"]<br>
+ assert int(expected_time) > 0, "Expected average time must not be zero"<br>
+ measured_delta_time = abs(<br>
+ round((getattr(result, "avg_time_us") - expected_time) / expected_time, 5)<br>
)<br>
<br>
- # result did not meet the given cycles parameter, check if within delta.<br>
+ # result did not meet the matching parameter, check if within delta.<br>
if getattr(result, "avg_cycles") > expected_cycles:<br>
- if self.delta_tolerance < measured_cycles_delta:<br>
+ if self.delta_tolerance > measured_delta_cycles:<br>
test_result = False<br>
- # result did not meet the given time parameter, check if within delta.<br>
- if getattr(result, "avg_time_us") > expected_time_us:<br>
- if self.delta_tolerance < measured_time_delta:<br>
+ if getattr(result, "avg_time_us") > expected_time:<br>
+ if self.delta_tolerance > measured_delta_time:<br>
test_result = False<br>
+<br>
result_list.append(<br>
{<br>
+ "Test Name": test_name,<br>
"Buffer Size": parameters["buff_size"],<br>
"delta tolerance": self.delta_tolerance,<br>
- "cycles delta": round(measured_cycles_delta, 5),<br>
- "Avg cycles": round(getattr(result, "avg_cycles"), 5),<br>
- "Avg cycles target": expected_cycles,<br>
- "time delta": round(measured_time_delta, 5),<br>
- "Avg time us": round(getattr(result, "avg_time_us"), 5),<br>
- "Avg time us target": expected_time_us,<br>
+ "avg_cycles": getattr(result, "avg_cycles"),<br>
+ "avg_cycles target": expected_cycles,<br>
+ "avg_cycles delta": measured_delta_cycles,<br>
+ "avg_time_us": getattr(result, "avg_time_us"),<br>
+ "avg_time_us target": expected_time,<br>
+ "avg_time_us delta": measured_delta_time,<br>
"passed": "PASS" if test_result else "FAIL",<br>
}<br>
)<br>
return result_list<br>
<br>
@crypto_test<br>
- def aes_cbc(self) -> None:<br>
- """aes_cbc latency test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "aes_cbc" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- devtype=self.device_type,<br>
- optype=OperationType.cipher_only,<br>
- cipher_algo=CipherAlgorithm.aes_cbc,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- cipher_iv_sz=16,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aes_cbc"],<br>
- )<br>
- results = self._verify_latency(app.run_app(), "aes_cbc")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
-<br>
- @crypto_test<br>
- def aes_cbc_sha1_hmac(self) -> None:<br>
- """aes_cbc_sha1_hmac latency test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "aes_cbc_sha1_hmac" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- devtype=self.device_type,<br>
- optype=OperationType.cipher_then_auth,<br>
- cipher_algo=CipherAlgorithm.aes_cbc,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- auth_algo=AuthenticationAlgorithm.sha1_hmac,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=64,<br>
- digest_sz=12,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aes_cbc_sha1_hmac"],<br>
- )<br>
- results = self._verify_latency(app.run_app(), "aes_cbc_sha1_hmac")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
-<br>
- @crypto_test<br>
- def aes_cbc_sha2_hmac(self) -> None:<br>
- """aes_cbc_sha2_hmac latency test.<br>
+ def cipher_only_tests(self) -> None:<br>
+ """Cipher only cryptography device tests.<br>
<br>
Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
+ * Run dpdk-test-crypto-perf application with configured arguments in cipher only mode.<br>
Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
+ * The reported statistics are within is within a defined tolerance of a given baseline.<br>
"""<br>
- if "aes_cbc_sha2_hmac" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- devtype=self.device_type,<br>
- optype=OperationType.cipher_then_auth,<br>
- cipher_algo=CipherAlgorithm.aes_cbc,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- cipher_iv_sz=16,<br>
- auth_algo=AuthenticationAlgorithm.sha2_256_hmac,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=64,<br>
- digest_sz=32,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aes_cbc_sha2_hmac"],<br>
- )<br>
- results = self._verify_latency(app.run_app(), "aes_cbc_sha2_hmac")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
<br>
- @crypto_test<br>
- def aes_docsisbpi(self) -> None:<br>
- """aes_docsisbpi latency test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "aes_docsisbpi" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- devtype=self.device_type,<br>
- optype=OperationType.cipher_only,<br>
- cipher_algo=CipherAlgorithm.aes_docsisbpi,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=32,<br>
- cipher_iv_sz=16,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aes_docsisbpi"],<br>
- )<br>
- results = self._verify_latency(app.run_app(), "aes_docsisbpi")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
+ def test(encrypt: EncryptDecryptSwitch) -> list[dict[str, int | float | str]]:<br>
+ """Run a configured throughput test with the given encryption.<br>
+<br>
+ Args:<br>
+ encrypt: The cipher encryption mode to run throughput testing on.<br>
+<br>
+ Returns:<br>
+ The generated summary or an empty list if a test is skipped.<br>
+ """<br>
+ cipher_params = CIPHER_ALGORITHM_PARAMS[<br>
+ CipherAlgorithm[combination["cipher_algorithm"]]<br>
+ ]<br>
+ is_vdev = "virtual_device" in combination<br>
+ app = Cryptodev(<br>
+ ptest=TestType.latency,<br>
+ devtype=self.device_type,<br>
+ optype=OperationType.cipher_only,<br>
+ cipher_algo=CipherAlgorithm[combination["cipher_algorithm"]],<br>
+ cipher_op=encrypt,<br>
+ cipher_key_sz=combination.get("cipher_key_size", cipher_params["key_size"]),<br>
+ cipher_iv_sz=combination.get("cipher_iv_size", cipher_params["iv_size"]),<br>
+ digest_sz=combination.get("digest_size", 0),<br>
+ total_ops=combination.get("ops", self.ops),<br>
+ buffer_sz=self.buffer_sizes[combination.get("name", "custom_test")],<br>
)<br>
+ if is_vdev:<br>
+ app.update_params(<br>
+ vdevs=[VirtualDevice(combination["virtual_device"])],<br>
+ devtype=get_device_from_str(combination["virtual_device"]),<br>
+ )<br>
<br>
- @crypto_test<br>
- def aes_gcm(self) -> None:<br>
- """aes_gcm latency test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "aes_gcm" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- devtype=self.device_type,<br>
- optype=OperationType.aead,<br>
- aead_algo=AeadAlgName.aes_gcm,<br>
- aead_op=EncryptDecryptSwitch.encrypt,<br>
- aead_key_sz=16,<br>
- aead_iv_sz=12,<br>
- aead_aad_sz=16,<br>
- digest_sz=16,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aes_gcm"],<br>
- )<br>
- results = self._verify_latency(app.run_app(), "aes_gcm")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
-<br>
- @crypto_test<br>
- def kasumi_f8_kasumi_f9(self) -> None:<br>
- """kasumi_f8_kasumi_f9 latency test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "kasumi_f8_kasumi_f9" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- devtype=self.device_type,<br>
- optype=OperationType.cipher_then_auth,<br>
- cipher_algo=CipherAlgorithm.kasumi_f8,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- cipher_iv_sz=8,<br>
- auth_algo=AuthenticationAlgorithm.kasumi_f9,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=16,<br>
- digest_sz=4,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["kasumi_f8_kasumi_f9"],<br>
- )<br>
- results = self._verify_latency(app.run_app(), "kasumi_f8_kasumi_f9")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
+ self._<a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>(f"Running configured test: {test_name} in {encrypt} mode")<br>
+ try:<br>
+ return self._create_summary(<br>
+ results=app.run_app(num_vfs=0 if is_vdev else 1),<br>
+ params=combination.get("test_parameters", config_list),<br>
+ test_name=f"{combination.get('name', 'unnamed-test')} - {encrypt}",<br>
+ )<br>
+ # A skip on one test will stop the execution of all tests, return empty summary.<br>
+ except SkippedTestException as e:<br>
+ self._logger.error(f"test {test_name} skipped: {str(e)}")<br>
+ return []<br>
+<br>
+ test_cases_skipped: int = 0<br>
+ failed: bool = False<br>
+ reason: str = ""<br>
+ # Execute all cipher only tests and verify<br>
+ for combination in self.cipher_tests:<br>
+ test_name = combination.get("name", "unnamed_test")<br>
+ combination_results = [(test(mode)) for mode in EncryptDecryptSwitch]<br>
+ if all(result == [] for result in combination_results):<br>
+ test_cases_skipped += 1<br>
+ else:<br>
+ try:<br>
+ self._print_and_verify(combination_results)<br>
+ except TestCaseVerifyError as e:<br>
+ failed = True<br>
+ reason = f"{reason}\n{str(e)}" if reason else str(e)<br>
+ if failed:<br>
+ fail(reason)<br>
+ if test_cases_skipped == len(self.cipher_tests):<br>
+ skip("All configured test cases skipped.")<br>
<br>
@crypto_test<br>
- def snow3g_uea2_snow3g_uia2(self) -> None:<br>
- """snow3g_uea2_snow3g_uia2 latency test.<br>
+ def auth_only_tests(self) -> None:<br>
+ """Authentication cryptography device tests.<br>
<br>
Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
+ * Run dpdk-test-crypto-perf application with configured parameters in authentication<br>
+ only moode.<br>
Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
+ * The resulting statistics are within a delta tolerance of a provided baseline.<br>
"""<br>
- if "snow3g_uea2_snow3g_uia2" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- devtype=self.device_type,<br>
- optype=OperationType.cipher_then_auth,<br>
- cipher_algo=CipherAlgorithm.snow3g_uea2,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- cipher_iv_sz=16,<br>
- auth_algo=AuthenticationAlgorithm.snow3g_uia2,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=16,<br>
- auth_iv_sz=16,<br>
- digest_sz=4,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["snow3g_uea2_snow3g_uia2"],<br>
- )<br>
- results = self._verify_latency(app.run_app(), "snow3g_uea2_snow3g_uia2")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
-<br>
- @crypto_test<br>
- def zuc_eea3_zuc_eia3(self) -> None:<br>
- """zuc_eea3_zuc_eia3 cipher and auth latency test.<br>
<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "zuc_eea3_zuc_eia3" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- devtype=self.device_type,<br>
- optype=OperationType.cipher_then_auth,<br>
- cipher_algo=CipherAlgorithm.zuc_eea3,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- cipher_iv_sz=16,<br>
- auth_algo=AuthenticationAlgorithm.zuc_eia3,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=16,<br>
- auth_iv_sz=16,<br>
- digest_sz=4,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["zuc_eea3_zuc_eia3"],<br>
- )<br>
- results = self._verify_latency(app.run_app(), "zuc_eea3_zuc_eia3")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
+ def test(op_mode: AuthenticationOpMode) -> list[dict[str, int | float | str]]:<br>
+ """Run a configured throughput test with the given authentication mode.<br>
+<br>
+ Args:<br>
+ op_mode: The authentication op mode to run testing in.<br>
+<br>
+ Returns:<br>
+ The generated summary or an empty list if a test is skipped.<br>
+ """<br>
+ auth_params = AUTHENTICATION_ALGORITHM_PARAMS[<br>
+ AuthenticationAlgorithm[combination["auth_algorithm"]]<br>
+ ]<br>
+ is_vdev: bool = "virtual_device" in combination<br>
+ app = Cryptodev(<br>
+ ptest=TestType.latency,<br>
+ devtype=self.device_type,<br>
+ optype=OperationType.auth_only,<br>
+ auth_algo=AuthenticationAlgorithm[combination["auth_algorithm"]],<br>
+ auth_op=op_mode,<br>
+ auth_key_sz=combination.get("auth_key_size", auth_params["key_size"]),<br>
+ auth_iv_sz=combination.get("auth_iv_size", auth_params["iv_size"]),<br>
+ total_ops=combination.get("ops", self.ops),<br>
+ digest_sz=combination.get("digest_size", 0),<br>
+ buffer_sz=self.buffer_sizes[combination["name"]],<br>
)<br>
+ if is_vdev:<br>
+ app.update_params(<br>
+ vdevs=[VirtualDevice(combination["virtual_device"])],<br>
+ devtype=get_device_from_str(combination["virtual_device"]),<br>
+ )<br>
<br>
- # BEGIN VDEV TESTS<br>
-<br>
- @crypto_test<br>
- def aesni_gcm_vdev(self) -> None:<br>
- """aesni_gcm virtual device latency test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "aesni_gcm_vdev" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- vdevs=[VirtualDevice("crypto_aesni_gcm0")],<br>
- devtype=DeviceType.crypto_aesni_gcm,<br>
- optype=OperationType.aead,<br>
- aead_op=EncryptDecryptSwitch.encrypt,<br>
- aead_key_sz=16,<br>
- aead_iv_sz=12,<br>
- aead_aad_sz=16,<br>
- digest_sz=16,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aesni_gcm_vdev"],<br>
- )<br>
- results = self._verify_latency(app.run_app(num_vfs=0), "aesni_gcm_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
+ self._<a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>(f"Running configured test: {test_name} in {op_mode} mode")<br>
+ try:<br>
+ return self._create_summary(<br>
+ results=app.run_app(num_vfs=0 if is_vdev else 1),<br>
+ params=combination.get("test_parameters", config_list),<br>
+ test_name=f"{combination.get('name', 'unnamed-test')} - {op_mode}",<br>
+ )<br>
+ # A skip on one test will stop the execution of all tests, return empty summary.<br>
+ except SkippedTestException as e:<br>
+ self._logger.error(f"failed to run test {test_name}: {str(e)}")<br>
+ return []<br>
+<br>
+ test_cases_skipped: int = 0<br>
+ failed: bool = False<br>
+ reason: str = ""<br>
+ # Execute all auth only tests and verify<br>
+ for combination in self.auth_tests:<br>
+ test_name = combination.get("name", "unnamed_test")<br>
+ combination_results = [(test(AuthenticationOpMode.generate))]<br>
+ if all(result == [] for result in combination_results):<br>
+ test_cases_skipped += 1<br>
+ else:<br>
+ try:<br>
+ self._print_and_verify(combination_results)<br>
+ except TestCaseVerifyError as e:<br>
+ failed = True<br>
+ reason = f"{reason}\n{str(e)}" if reason else str(e)<br>
+ if failed:<br>
+ fail(reason)<br>
+ if test_cases_skipped == len(self.auth_tests):<br>
+ skip("All configured test cases skipped.")<br>
<br>
@crypto_test<br>
- def aesni_mb_cipher_then_auth_vdev(self) -> None:<br>
- """aesni_mb vdev cipher and auth latency test.<br>
+ def aead_test(self) -> None:<br>
+ """Aead cryptography test.<br>
<br>
Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
+ * Run dpdk-test-crypto-perf application with configured parameters in aead mode.<br>
Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
+ * The resulting statistics are within a delta tolerance of a given baseline.<br>
"""<br>
- if "aesni_mb_cipher_then_auth_vdev" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- vdevs=[VirtualDevice("crypto_aesni_mb0")],<br>
- devtype=DeviceType.crypto_aesni_mb,<br>
- optype=OperationType.cipher_then_auth,<br>
- cipher_algo=CipherAlgorithm.aes_cbc,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- auth_algo=AuthenticationAlgorithm.sha1_hmac,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=64,<br>
- digest_sz=12,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aesni_mb_cipher_then_auth_vdev"],<br>
- )<br>
- results = self._verify_latency(app.run_app(num_vfs=0), "aesni_mb_cipher_then_auth_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
-<br>
- @crypto_test<br>
- def aesni_mb_vdev(self) -> None:<br>
- """aesni_mb vdev latency test.<br>
<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "aesni_mb_vdev" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- vdevs=[VirtualDevice("crypto_aesni_mb0")],<br>
- devtype=DeviceType.crypto_aesni_mb,<br>
- optype=OperationType.cipher_only,<br>
- cipher_algo=CipherAlgorithm.aes_cbc,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- cipher_iv_sz=16,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aesni_mb_vdev"],<br>
- )<br>
- results = self._verify_latency(app.run_app(num_vfs=0), "aesni_mb_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
+ def test() -> list[dict[str, int | float | str]]:<br>
+ """Execute the dpdk-test-crypto application and verify.<br>
+<br>
+ Args:<br>
+ encrypt: The authentication operation mode to run the cryptodev application in.<br>
+<br>
+ Returns:<br>
+ The generated summary or an empty list if a test is skipped.<br>
+ """<br>
+ is_vdev: bool = "virtual_device" in combination<br>
+ aead_params = AEAD_ALGORITHM_PARAMS[AeadAlgName[combination["aead_algorithm"]]]<br>
+ app = Cryptodev(<br>
+ ptest=TestType.latency,<br>
+ devtype=self.device_type,<br>
+ optype=OperationType.aead,<br>
+ aead_algo=AeadAlgName[combination["aead_algorithm"]],<br>
+ aead_op=combination.get("aead_op", EncryptDecryptSwitch.encrypt),<br>
+ aead_key_sz=combination.get("aead_key_size", aead_params["key_size"]),<br>
+ aead_iv_sz=combination.get("aead_iv_size", aead_params["iv_size"]),<br>
+ aead_aad_sz=combination.get("aead_size", aead_params["aad_size"]),<br>
+ digest_sz=combination.get("digest_size", aead_params["digest_size"]),<br>
+ total_ops=combination.get("ops", self.ops),<br>
+ buffer_sz=self.buffer_sizes[combination["name"]],<br>
)<br>
+ if is_vdev:<br>
+ app.update_params(<br>
+ vdevs=[VirtualDevice(combination["virtual_device"])],<br>
+ devtype=get_device_from_str(combination["virtual_device"]),<br>
+ )<br>
+ if combination.get("aead_op", None) == EncryptDecryptSwitch.decrypt:<br>
+ app.update_params(<br>
+ out_of_place=combination.get("out_of_place", True),<br>
+ )<br>
<br>
- @crypto_test<br>
- def kasumi_vdev(self) -> None:<br>
- """Kasumi vdev latency test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "kasumi_vdev" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- vdevs=[VirtualDevice("crypto_kasumi0")],<br>
- devtype=DeviceType.crypto_kasumi,<br>
- optype=OperationType.cipher_then_auth,<br>
- cipher_algo=CipherAlgorithm.kasumi_f8,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- cipher_iv_sz=8,<br>
- auth_algo=AuthenticationAlgorithm.kasumi_f9,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=16,<br>
- digest_sz=4,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["kasumi_vdev"],<br>
- )<br>
- results = self._verify_latency(app.run_app(num_vfs=0), "kasumi_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
+ self._<a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>(f"Running configured test: {test_name}")<br>
+ try:<br>
+ return self._create_summary(<br>
+ results=app.run_app(num_vfs=0 if is_vdev else 1),<br>
+ params=combination.get("test_parameters", config_list),<br>
+ test_name=f"{combination.get('name', 'unnamed-test')}",<br>
+ )<br>
+ # Exceptions will stop the execution of all tests, return an empty result and continue.<br>
+ except SkippedTestException as e:<br>
+ self._logger.error(f"failed to run test {test_name}: {str(e)}")<br>
+ return []<br>
+<br>
+ test_cases_skipped: int = 0<br>
+ failed: bool = False<br>
+ reason: str = ""<br>
+ # Execute all aead tests and verify<br>
+ for combination in self.aead_tests:<br>
+ test_name = combination.get("name", "unnamed_test")<br>
+ combination_results = [test()]<br>
+ if all(result == [] for result in combination_results):<br>
+ test_cases_skipped += 1<br>
+ else:<br>
+ try:<br>
+ self._print_and_verify(combination_results)<br>
+ except TestCaseVerifyError as e:<br>
+ failed = True<br>
+ reason = f"{reason}\n{str(e)}" if reason else str(e)<br>
+ if failed:<br>
+ fail(reason)<br>
+ if test_cases_skipped == len(self.aead_tests):<br>
+ skip("All configured test cases skipped.")<br>
<br>
@crypto_test<br>
- def open_ssl_vdev(self) -> None:<br>
- """open_ssl vdev latency test.<br>
+ def cipher_and_auth_tests(self) -> None:<br>
+ """Cipher and Authentication tests.<br>
<br>
Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
+ * Run dpdk-test-crypto-perf application in cipher then authentication mode<br>
Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
+ * The resulting statistics are within a delta tolerance of a given baseline.<br>
"""<br>
- if "open_ssl_vdev" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- vdevs=[VirtualDevice("crypto_openssl0")],<br>
- devtype=DeviceType.crypto_openssl,<br>
- optype=OperationType.aead,<br>
- aead_algo=AeadAlgName.aes_gcm,<br>
- aead_op=EncryptDecryptSwitch.encrypt,<br>
- aead_key_sz=16,<br>
- aead_iv_sz=16,<br>
- aead_aad_sz=16,<br>
- digest_sz=16,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["open_ssl_vdev"],<br>
- )<br>
- results = self._verify_latency(app.run_app(num_vfs=0), "open_ssl_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
<br>
- @crypto_test<br>
- def snow3g_vdev(self) -> None:<br>
- """snow3g vdev latency test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "snow3g_vdev" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- vdevs=[VirtualDevice("crypto_snow3g0")],<br>
- devtype=DeviceType.crypto_snow3g,<br>
- optype=OperationType.cipher_then_auth,<br>
- cipher_algo=CipherAlgorithm.snow3g_uea2,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- cipher_iv_sz=16,<br>
- auth_algo=AuthenticationAlgorithm.snow3g_uia2,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=16,<br>
- auth_iv_sz=16,<br>
- digest_sz=16,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["snow3g_vdev"],<br>
- )<br>
- results = self._verify_latency(app.run_app(num_vfs=0), "snow3g_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
+ def test(<br>
+ encrypt: EncryptDecryptSwitch, op_mode: AuthenticationOpMode<br>
+ ) -> list[dict[str, int | float | str]]:<br>
+ """Execute the dpdk-test-crypto application and verify.<br>
+<br>
+ Args:<br>
+ encrypt: The cipher encryption mode to run latency testing in.<br>
+ op_mode: The authentication operation mode to run the cryptodev application in.<br>
+<br>
+ Returns:<br>
+ The generated summary or an empty list if a test is skipped.<br>
+ """<br>
+ is_vdev: bool = "virtual_device" in combination<br>
+ cipher_params = CIPHER_ALGORITHM_PARAMS[<br>
+ CipherAlgorithm[combination["cipher_algorithm"]]<br>
+ ]<br>
+ auth_params = AUTHENTICATION_ALGORITHM_PARAMS[<br>
+ AuthenticationAlgorithm[combination["auth_algorithm"]]<br>
+ ]<br>
+ app = Cryptodev(<br>
+ ptest=TestType.latency,<br>
+ devtype=self.device_type,<br>
+ optype=OperationType.aead,<br>
+ cipher_algo=CipherAlgorithm[combination["cipher_algorithm"]],<br>
+ cipher_op=encrypt,<br>
+ cipher_key_sz=combination.get("cipher_key_size", cipher_params["key_size"]),<br>
+ cipher_iv_sz=combination.get("cipher_iv_size", cipher_params["iv_size"]),<br>
+ auth_algo=AuthenticationAlgorithm[combination["auth_algorithm"]],<br>
+ auth_op=op_mode,<br>
+ auth_key_sz=combination.get("auth_key_size", auth_params["key_size"]),<br>
+ auth_iv_sz=combination.get("auth_iv_size", auth_params["iv_size"]),<br>
+ total_ops=combination.get("ops", self.ops),<br>
+ digest_sz=combination.get("digest_size", 0),<br>
+ buffer_sz=self.buffer_sizes[combination["name"]],<br>
)<br>
+ if is_vdev:<br>
+ app.update_params(<br>
+ vdevs=[VirtualDevice(combination["virtual_device"])],<br>
+ devtype=get_device_from_str(combination["virtual_device"]),<br>
+ )<br>
<br>
- @crypto_test<br>
- def zuc_vdev(self) -> None:<br>
- """Zuc vdev latency test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The latency is below or within delta of provided baseline.<br>
-<br>
- Raises:<br>
- SkippedTestException: When configuration is not provided.<br>
- """<br>
- if "zuc_vdev" not in self.latency_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.latency,<br>
- vdevs=[VirtualDevice("crypto_zuc0")],<br>
- devtype=DeviceType.crypto_zuc,<br>
- optype=OperationType.cipher_then_auth,<br>
- cipher_algo=CipherAlgorithm.zuc_eea3,<br>
- cipher_op=EncryptDecryptSwitch.encrypt,<br>
- cipher_key_sz=16,<br>
- cipher_iv_sz=16,<br>
- auth_algo=AuthenticationAlgorithm.zuc_eia3,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=16,<br>
- auth_iv_sz=16,<br>
- digest_sz=4,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["zuc_vdev"],<br>
- )<br>
- results = self._verify_latency(app.run_app(num_vfs=0), "zuc_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(<br>
- result["passed"] == "PASS",<br>
- "latency was greater than the delta tolerance above baseline",<br>
- )<br>
+ self._<a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>(f"Running configured test: {test_name} in {encrypt} mode")<br>
+ try:<br>
+ return self._create_summary(<br>
+ results=app.run_app(num_vfs=0 if is_vdev else 1),<br>
+ params=combination.get("test_parameters", config_list),<br>
+ test_name=f"{combination.get('name', 'unnamed-test')} - {encrypt}",<br>
+ )<br>
+ # Exceptions will stop the execution of all tests, return an empty result and continue.<br>
+ except SkippedTestException as e:<br>
+ self._logger.error(f"failed to run test {test_name}: {str(e)}")<br>
+ return []<br>
+<br>
+ test_cases_skipped: int = 0<br>
+ failed: bool = False<br>
+ reason: str = ""<br>
+ # Execute all cipher_then_auth tests and verify<br>
+ for combination in self.cipher_then_auth_tests:<br>
+ print(str(combination))<br>
+ test_name = combination.get("name", "unnamed_test")<br>
+ combination_results = [<br>
+ test(mode, AuthenticationOpMode.generate) for mode in EncryptDecryptSwitch<br>
+ ]<br>
+ if all(result == [] for result in combination_results):<br>
+ test_cases_skipped += 1<br>
+ else:<br>
+ try:<br>
+ self._print_and_verify(combination_results)<br>
+ except TestCaseVerifyError as e:<br>
+ failed = True<br>
+ reason = f"{reason}\n{str(e)}" if reason else str(e)<br>
+ if failed:<br>
+ fail(reason)<br>
+ if test_cases_skipped == len(self.cipher_then_auth_tests):<br>
+ skip("All configured test cases skipped.")<br>
-- <br>
2.55.0<br>
<br>
</blockquote></div>