<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"><div dir="ltr" class="gmail_attr">On Mon, Oct 19, 2026 at 4:04 PM Andrew Bailey <<a href="mailto:abailey@iol.unh.edu" target="_blank">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, the cryptodev throughput test suite only allowed for<br>
a small set of algorithms to be tested for a set number of operations.<br>
This is undesirable as a user may want to test one of the hundreds of<br>
possible combinations rather than the much smaller preset tests<br>
previously available. This commit adds support for proper test<br>
configuration of the cryptodev throughput test suite to provide total<br>
coverage of all algorithms.<br>
<br>
Signed-off-by: Andrew Bailey <<a href="mailto:abailey@iol.unh.edu" target="_blank">abailey@iol.unh.edu</a>><br>
---<br>
dts/api/cryptodev/__init__.py | 12 +<br>
dts/api/cryptodev/config.py | 47 +<br>
dts/api/params/__init__.py | 2 +-<br>
dts/configurations/nodes.example.yaml | 2 +-<br>
dts/configurations/tests_config.example.yaml | 48 +-<br>
dts/tests/TestSuite_cryptodev_throughput.py | 930 +++++++++----------<br>
6 files changed, 523 insertions(+), 518 deletions(-)<br>
<br>
diff --git a/dts/api/cryptodev/__init__.py b/dts/api/cryptodev/__init__.py<br>
index 496079c2af..ffcfee4ac7 100644<br>
--- a/dts/api/cryptodev/__init__.py<br>
+++ b/dts/api/cryptodev/__init__.py<br>
@@ -78,6 +78,18 @@ def vector_directory(self) -> PurePath:<br>
"""<br>
return get_ctx().dpdk_build.remote_dpdk_tree_path.joinpath("app/test-crypto-perf/data/")<br>
<br>
+ def update_params(self, **app_params: Unpack["CryptoPmdParamsDict"]) -> None:<br>
+ """Update the app parameters.<br>
+<br>
+ Args:<br>
+ app_params: app parameters to pass to dpdk-test-crypto-perf application<br>
+ """<br>
+ for k, v in app_params.items():<br>
+ if v is not None:<br>
+ self._app_params[k] = (<br>
+ self.vector_directory.joinpath(str(v)) if k == "test_file" else v<br>
+ )<br>
+<br>
def run_app(self, num_vfs: int = 1) -> list[CryptodevResults]:<br>
"""Run the cryptodev application with the given app parameters.<br>
<br>
diff --git a/dts/api/cryptodev/config.py b/dts/api/cryptodev/config.py<br>
index 3420c2fe91..252d3237c8 100644<br>
--- a/dts/api/cryptodev/config.py<br>
+++ b/dts/api/cryptodev/config.py<br>
@@ -515,3 +515,50 @@ class CryptoPmdParams(EalParams):<br>
test_name: str | None = field(default=None, metadata=Params.long("test-name"))<br>
tls_version: TLSVersion | None = field(default=None, metadata=Params.long("tls-version"))<br>
total_ops: int | None = field(default=100000, metadata=Params.long("total-ops"))<br>
+<br>
+<br>
+# Algorithm parameter mappings for automatic key/IV size determination<br>
+CIPHER_ALGORITHM_PARAMS = {<br>
+ CipherAlgorithm.aes_cbc: {"key_size": 16, "iv_size": 16},<br>
+ CipherAlgorithm.aes_ctr: {"key_size": 16, "iv_size": 16},<br>
+ CipherAlgorithm.aes_gcm: {"key_size": 16, "iv_size": 16},<br>
+ CipherAlgorithm.aes_ecb: {"key_size": 16, "iv_size": 16},<br>
+ CipherAlgorithm.aes_f8: {"key_size": 16, "iv_size": 16},<br>
+ CipherAlgorithm.aes_xts: {"key_size": 16, "iv_size": 16},<br>
+ CipherAlgorithm.arc4: {"key_size": 16, "iv_size": 16},<br>
+ CipherAlgorithm.null: {"key_size": 16, "iv_size": 16},<br>
+ CipherAlgorithm.aes_docsisbpi: {"key_size": 32, "iv_size": 16},<br>
+ CipherAlgorithm.snow3g_uea2: {"key_size": 16, "iv_size": 16},<br>
+ CipherAlgorithm.zuc_eea3: {"key_size": 16, "iv_size": 16},<br>
+ CipherAlgorithm.kasumi_f8: {"key_size": 16, "iv_size": 8},<br>
+ CipherAlgorithm.three_des_cbc: {"key_size": 8, "iv_size": 8},<br>
+ CipherAlgorithm.three_des_ecb: {"key_size": 24, "iv_size": 8},<br>
+ CipherAlgorithm.three_des_ctr: {"key_size": 24, "iv_size": 8},<br>
+}<br>
+<br>
+AUTHENTICATION_ALGORITHM_PARAMS = {<br>
+ AuthenticationAlgorithm.sha1: {"key_size": 20, "iv_size": 0, "digest_size": 20},<br>
+ AuthenticationAlgorithm.sha1_hmac: {"key_size": 64, "iv_size": 20, "digest_size": 12},<br>
+ AuthenticationAlgorithm.sha2_224: {"key_size": 20, "iv_size": 0, "digest_size": 20},<br>
+ AuthenticationAlgorithm.sha2_224_hmac: {"key_size": 20, "iv_size": 0, "digest_size": 20},<br>
+ AuthenticationAlgorithm.sha2_256: {"key_size": 64, "iv_size": 0, "digest_size": 32},<br>
+ AuthenticationAlgorithm.sha2_256_hmac: {"key_size": 64, "iv_size": 0, "digest_size": 32},<br>
+ AuthenticationAlgorithm.sha2_384: {"key_size": 48, "iv_size": 0, "digest_size": 48},<br>
+ AuthenticationAlgorithm.sha2_384_hmac: {"key_size": 48, "iv_size": 0, "digest_size": 48},<br>
+ AuthenticationAlgorithm.sha2_512: {"key_size": 64, "iv_size": 0, "digest_size": 64},<br>
+ AuthenticationAlgorithm.sha2_512_hmac: {"key_size": 64, "iv_size": 0, "digest_size": 64},<br>
+ AuthenticationAlgorithm.md5: {"key_size": 16, "iv_size": 0, "digest_size": 16},<br>
+ AuthenticationAlgorithm.md5_hmac: {"key_size": 16, "iv_size": 0, "digest_size": 16},<br>
+ AuthenticationAlgorithm.snow3g_uia2: {"key_size": 16, "iv_size": 16, "digest_size": 4},<br>
+ AuthenticationAlgorithm.zuc_eia3: {"key_size": 16, "iv_size": 16, "digest_size": 4},<br>
+ AuthenticationAlgorithm.kasumi_f9: {"key_size": 16, "iv_size": 0, "digest_size": 4},<br>
+ AuthenticationAlgorithm.aes_gmac: {"key_size": 16, "iv_size": 16, "digest_size": 16},<br>
+ AuthenticationAlgorithm.aes_xcbc_mac: {"key_size": 16, "iv_size": 0, "digest_size": 12},<br>
+ AuthenticationAlgorithm.aes_cmac: {"key_size": 16, "iv_size": 0, "digest_size": 16},<br>
+ AuthenticationAlgorithm.aes_cbc_mac: {"key_size": 16, "iv_size": 0, "digest_size": 16},<br>
+}<br>
+<br>
+AEAD_ALGORITHM_PARAMS = {<br>
+ AeadAlgName.aes_gcm: {"key_size": 16, "iv_size": 12, "aad_size": 16, "digest_size": 16},<br>
+ AeadAlgName.aes_ccm: {"key_size": 16, "iv_size": 11, "aad_size": 16, "digest_size": 16},<br>
+}<br>
diff --git a/dts/api/params/__init__.py b/dts/api/params/__init__.py<br>
index b5bae9dad9..04e2c0f386 100644<br>
--- a/dts/api/params/__init__.py<br>
+++ b/dts/api/params/__init__.py<br>
@@ -334,7 +334,7 @@ def _make_switch(<br>
"""<br>
prefix = f"{'-' if is_short else '--'}{'no-' if is_no else ''}"<br>
name = name.replace("_", "-")<br>
- value = f"{' ' if is_short else '='}{value}" if value else ""<br>
+ value = f"{' ' if is_short else '='}{value}" if value or value == 0 else ""<br>
return f"{prefix}{name}{value}"<br>
<br>
def __str__(self) -> str:<br>
diff --git a/dts/configurations/nodes.example.yaml b/dts/configurations/nodes.example.yaml<br>
index 334de68f97..ccda20fb87 100644<br>
--- a/dts/configurations/nodes.example.yaml<br>
+++ b/dts/configurations/nodes.example.yaml<br>
@@ -9,7 +9,7 @@<br>
# `crypto_device_type`:<br>
# Uncomment to run cryptodev tests; the device type of the DUT e.g. (crypto_qat, crypto_zuc,<br>
# crypto_aesni_mb); the complete list of device types can be found here<br>
-# <a href="https://doc.dpdk.org/guides-24.07/cryptodevs/overview.html" rel="noreferrer" target="_blank">https://doc.dpdk.org/guides-24.07/cryptodevs/overview.html</a><br>
+# <a href="https://doc.dpdk.org/guides-26.07/cryptodevs/overview.html" rel="noreferrer" target="_blank">https://doc.dpdk.org/guides-26.07/cryptodevs/overview.html</a><br>
<br>
# Define a system under test node, having two network ports physically<br>
# connected to the corresponding ports in TG 1 (the peer node)<br>
diff --git a/dts/configurations/tests_config.example.yaml b/dts/configurations/tests_config.example.yaml<br>
index ce67385b0b..fe4bed2847 100644<br>
--- a/dts/configurations/tests_config.example.yaml<br>
+++ b/dts/configurations/tests_config.example.yaml<br>
@@ -2,10 +2,13 @@<br>
<br>
# Optional Fields:<br>
# All fields are optional, uncomment a test suite to run it with a specific configuration.<br>
+# cryptodev_throughput:<br>
+# algorithms: <a href="https://doc.dpdk.org/guides-26.07/cryptodevs/overview.html" rel="noreferrer" target="_blank">https://doc.dpdk.org/guides-26.07/cryptodevs/overview.html</a><br>
<br>
# Define the custom test suite configurations<br>
hello_world:<br>
msg: A custom hello world to you!<br>
+<br>
# single_core_forward_perf:<br>
# test_parameters: # Add frame size / descriptor count combinations as needed<br>
# - frame_size: 64<br>
@@ -18,18 +21,51 @@ hello_world:<br>
# num_descriptors: 1024<br>
# expected_mpps: 1.0<br>
# delta_tolerance: 0.05<br>
+<br>
# pmd_rss:<br>
# NUM_QUEUES: 4<br>
# ACTUAL_KEY_SIZE: 52<br>
# ACTUAL_RETA_SIZE: 512<br>
+<br>
# cryptodev_throughput:<br>
# delta_tolerance: 0.05<br>
-# throughput_test_parameters:<br>
-# snow3g_uea2_snow3g_uia2: # Add the name of the test suite you would like to run<br>
-# - buff_size: 64<br>
-# Gbps: 2.0 # Set gigabits per second according to your devices throughput for this given buffer size<br>
-# - buff_size: 512<br>
-# Gbps: 20.0<br>
+# test_combinations:<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>
+# Gbps: 1.5 # Set gigabits per second for your devices throughput for this buffer size<br>
+# - buff_size: 512<br>
+# Gbps: 3.0<br>
+# - buff_size: 2048<br>
+# Gbps: 4.0<br>
+# - name: "example authentication test"<br>
+# auth_algorithm: "aes_cbc_mac" # See `algortihms` in `Optional Fields` for a complete list<br>
+# test_parameters:<br>
+# - buff_size: 64<br>
+# Gbps: 1.5<br>
+# - name: "example cipher then auth test"<br>
+# ops: 30000000 # Specify total ops to use, 10000000 is used by default<br>
+# cipher_algorithm: "aes_cbc" # See `algortihms` in `Optional Fields` for a complete list<br>
+# auth_algorithm: "aes_cbc_mac" # See `algortihms` in `Optional Fields` for a complete list<br>
+# cipher_key_size: 16<br>
+# cipher_iv_size: 0<br>
+# auth_key_size: 16 # Specify key size, a default is used if field is not present<br>
+# auth_iv_size: 0 # Specify IV size, a default is used if field is not present<br>
+# test_parameters:<br>
+# - buff_size: 64<br>
+# Gbps: 1.5<br>
+# - name: "example aead test"<br>
+# aead_algorithm: "aes_gcm" # See `algortihms` in `Optional Fields` for a complete list<br>
+# aead_key_sz: 16<br>
+# aead_iv_sz: 16<br>
+# aead_aad_sz: 16 # Specify AAD size, a default is used if field not present<br>
+# digest_sz: 16 # Specify a digest size, a default is used if not present<br>
+# test_parameters:<br>
+# - buff_size: 64<br>
+# Gbps: 1.5<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_throughput.py b/dts/tests/TestSuite_cryptodev_throughput.py<br>
index 59f64f2cd7..d061ec02dc 100644<br>
--- a/dts/tests/TestSuite_cryptodev_throughput.py<br>
+++ b/dts/tests/TestSuite_cryptodev_throughput.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,7 +35,8 @@<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>
@@ -40,37 +46,57 @@<br>
{"buff_size": 2048, "Gbps": 1.00},<br>
]<br>
<br>
-TOTAL_OPS = 10_000_000<br>
-<br>
<br>
class Config(BaseConfig):<br>
"""Performance test metrics.<br>
<br>
Attributes:<br>
delta_tolerance: The allowed tolerance below a given baseline.<br>
- throughput_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>
- throughput_test_parameters: dict[str, list[dict[str, int | float | str]]] = {<br>
- "aes_cbc": config_list,<br>
- "aes_cbc_sha1": config_list,<br>
- "aes_cbc_sha2": config_list,<br>
- "aes_cbc_sha2_digest_16": config_list,<br>
- "aead_aes_gcm": config_list,<br>
- "aes_docsisbpi": config_list,<br>
- "sha1_hmac": config_list,<br>
- "snow3g_uea2_snow3g_uia2": config_list,<br>
- "zuc_eea3_zuc_eia3": config_list,<br>
- "kasumi_f8_kasumi_f9": config_list,<br>
- "open_ssl_vdev": config_list,<br>
- "aesni_mb_vdev": config_list,<br>
- "aesni_gcm_vdev": config_list,<br>
- "kasumi_vdev": config_list,<br>
- "zuc_vdev": config_list,<br>
- "snow3g_vdev": config_list,<br>
- }<br>
+ test_combinations: list[dict[str, Any]] = [<br>
+ #: cipher only tests<br>
+ {<br>
+ "name": "aes-cbc (cipher only)",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.aes_cbc.name" rel="noreferrer" target="_blank">CipherAlgorithm.aes_cbc.name</a>,<br>
+ },<br>
+ {<br>
+ "name": "aead-docsisbpi (cipher only)",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.aes_docsisbpi.name" rel="noreferrer" target="_blank">CipherAlgorithm.aes_docsisbpi.name</a>,<br>
+ },<br>
+ #: authentication only tests<br>
+ {<br>
+ "name": "sha1-hmac (auth only)",<br>
+ "auth_algorithm": <a href="http://AuthenticationAlgorithm.sha1_hmac.name" rel="noreferrer" target="_blank">AuthenticationAlgorithm.sha1_hmac.name</a>,<br>
+ "auth_iv_size": 16,<br>
+ },<br>
+ #: cipher then auth tests<br>
+ {<br>
+ "name": "aes-cbc/sha1-hmac (cipher then auth)",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.aes_cbc.name" rel="noreferrer" target="_blank">CipherAlgorithm.aes_cbc.name</a>,<br>
+ "auth_algorithm": <a href="http://AuthenticationAlgorithm.sha1_hmac.name" rel="noreferrer" target="_blank">AuthenticationAlgorithm.sha1_hmac.name</a>,<br>
+ "virtual_device": "crypto_openssl",<br>
+ },<br>
+ {<br>
+ "name": "aes-cbc/sha2-256-hmac (cipher then auth)",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.aes_cbc.name" rel="noreferrer" target="_blank">CipherAlgorithm.aes_cbc.name</a>,<br>
+ "auth_algorithm": <a href="http://AuthenticationAlgorithm.sha2_256_hmac.name" rel="noreferrer" target="_blank">AuthenticationAlgorithm.sha2_256_hmac.name</a>,<br>
+ "virtual_device": "crypto_openssl",<br>
+ },<br>
+ {<br>
+ "name": "aes-cbc/sha2-256-hmac/digest-16 (cipher then auth)",<br>
+ "cipher_algorithm": <a href="http://CipherAlgorithm.aes_cbc.name" rel="noreferrer" target="_blank">CipherAlgorithm.aes_cbc.name</a>,<br>
+ "auth_algorithm": <a href="http://AuthenticationAlgorithm.sha2_256_hmac.name" rel="noreferrer" target="_blank">AuthenticationAlgorithm.sha2_256_hmac.name</a>,<br>
+ "digest_size": 16,<br>
+ },<br>
+ #: aead tests<br>
+ {<br>
+ "name": "aead-aes-gcm",<br>
+ "aead_algorithm": <a href="http://AeadAlgName.aes_gcm.name" rel="noreferrer" target="_blank">AeadAlgName.aes_gcm.name</a>,<br>
+ },<br>
+ ]<br>
<br>
<br>
@requires_link_topology(LinkTopology.NO_LINK)<br>
@@ -80,60 +106,137 @@ class TestCryptodevThroughput(TestSuite):<br>
config: Config<br>
<br>
def set_up_suite(self) -> None:<br>
- """Set up the test suite."""<br>
- self.throughput_test_parameters: dict[str, list[dict[str, int | float | str]]] = (<br>
- self.config.throughput_test_parameters<br>
- )<br>
+ """Set up the test suite.<br>
+<br>
+ Raises:<br>
+ ConfigurationError: When a test config contains no algorithm to test.<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>
+ self.buffer_sizes: dict[str, ListWrapper] = {}<br>
+<br>
+ # categorize configured tests<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>
+ # Filter tests by operation types<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>
- for k, v in self.throughput_test_parameters.items():<br>
- self.buffer_sizes[k] = ListWrapper([int(run["buff_size"]) for run in v])<br>
+ def _print_and_verify(self, all_results: list[list[dict[str, int | float | str]]]) -> None:<br>
+ """Print the given results and 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 _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("Delta Tolerance")<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"{'Throughput Results'.center(border_len)}\n{'=' * border_len}")<br>
+ print(f"{f'{test_name} Throughput 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_throughput(<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 throughput 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 throughput 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>
# get the corresponding baseline for the current buffer size<br>
- parameters: dict[str, int | float | str] = list(<br>
+ parameters: dict[str, int | float | str] = next(<br>
filter(<br>
lambda x: x["buff_size"] == result.buffer_size,<br>
- self.throughput_test_parameters[key],<br>
- )<br>
- )[0]<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(errmsg)<br>
test_result = True<br>
expected_gbps = parameters["Gbps"]<br>
measured_delta = abs(<br>
round((getattr(result, "gbps") - expected_gbps) / expected_gbps, 5)<br>
)<br>
-<br>
# result did not meet the given Gbps parameter, check if within delta.<br>
if getattr(result, "gbps") < expected_gbps:<br>
if self.delta_tolerance < measured_delta:<br>
test_result = False<br>
+<br>
result_list.append(<br>
{<br>
+ "Test Name": test_name,<br>
"Buffer Size": parameters["buff_size"],<br>
"Gbps delta": measured_delta,<br>
"delta tolerance": self.delta_tolerance,<br>
@@ -145,502 +248,309 @@ def _verify_throughput(<br>
return result_list<br>
<br>
@crypto_test<br>
- def aes_cbc(self) -> None:<br>
- """aes_cbc test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "aes_cbc" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aes_cbc"],<br>
- )<br>
- results = self._verify_throughput(app.run_app(), "aes_cbc")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
-<br>
- @crypto_test<br>
- def aes_cbc_sha1(self) -> None:<br>
- """aes_cbc_sha1 test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "aes_cbc_sha1" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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.sha1_hmac,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=64,<br>
- auth_iv_sz=20,<br>
- digest_sz=12,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aes_cbc_sha1"],<br>
- )<br>
- results = self._verify_throughput(app.run_app(), "aes_cbc_sha1")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
-<br>
- @crypto_test<br>
- def aes_cbc_sha2(self) -> None:<br>
- """aes_cbc_sha2 test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "aes_cbc_sha2" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aes_cbc_sha2"],<br>
- )<br>
- results = self._verify_throughput(app.run_app(), "aes_cbc_sha2")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
-<br>
- @crypto_test<br>
- def aes_cbc_sha2_digest_16(self) -> None:<br>
- """aes_cbc_sha2_digest_16 test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "aes_cbc_sha2_digest_16" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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=16,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aes_cbc_sha2_digest_16"],<br>
- )<br>
- results = self._verify_throughput(app.run_app(), "aes_cbc_sha2_digest_16")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
-<br>
- @crypto_test<br>
- def aead_aes_gcm(self) -> None:<br>
- """aead_aes_gcm test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "aead_aes_gcm" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aead_aes_gcm"],<br>
- )<br>
- results = self._verify_throughput(app.run_app(), "aead_aes_gcm")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
-<br>
- @crypto_test<br>
- def aes_docsisbpi(self) -> None:<br>
- """aes_docsisbpi test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "aes_docsisbpi" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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_throughput(app.run_app(), "aes_docsisbpi")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
-<br>
- @crypto_test<br>
- def sha1_hmac(self) -> None:<br>
- """sha1_hmac test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "sha1_hmac" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<br>
- devtype=self.device_type,<br>
- optype=OperationType.auth_only,<br>
- auth_algo=AuthenticationAlgorithm.sha1_hmac,<br>
- auth_op=AuthenticationOpMode.generate,<br>
- auth_key_sz=64,<br>
- auth_iv_sz=16,<br>
- digest_sz=12,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["sha1_hmac"],<br>
- )<br>
- results = self._verify_throughput(app.run_app(), "sha1_hmac")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
-<br>
- @crypto_test<br>
- def snow3g_uea2_snow3g_uia2(self) -> None:<br>
- """snow3g_uea2_snow3g_uia2 test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "snow3g_uea2_snow3g_uia2" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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_throughput(app.run_app(), "snow3g_uea2_snow3g_uia2")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
-<br>
- @crypto_test<br>
- def zuc_eea3_zuc_eia3(self) -> None:<br>
- """zuc_eea3_zuc_eia3 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 resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
+ * The reported Gbps is within a defined tolerance of a given baseline.<br>
"""<br>
- if "zuc_eea3_zuc_eia3" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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_throughput(app.run_app(), "zuc_eea3_zuc_eia3")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
<br>
- @crypto_test<br>
- def kasumi_f8_kasumi_f9(self) -> None:<br>
- """kasumi_f8 kasumi_f9 test.<br>
-<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "kasumi_f8_kasumi_f9" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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_throughput(app.run_app(), "kasumi_f8_kasumi_f9")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<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.throughput,<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>
- # BEGIN VDEV TESTS<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 aesni_mb_vdev(self) -> None:<br>
- """aesni_mb virtual device test.<br>
+ def auth_only_tests(self) -> None:<br>
+ """Authentication cryptography device tests.<br>
<br>
Steps:<br>
- * Create a cryptodev instance with crypto_aesni_mb and supplied buffer sizes.<br>
+ * Run dpdk-test-crypto-perf application with configured parameters in authentication<br>
+ only moode.<br>
Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
+ * The resulting Gbps is within a delta tolerance of a provided baseline.<br>
"""<br>
- if "aesni_mb_vdev" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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=32,<br>
- cipher_iv_sz=16,<br>
- auth_algo=AuthenticationAlgorithm.sha1_hmac,<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["aesni_mb_vdev"],<br>
- )<br>
- results = self._verify_throughput(app.run_app(num_vfs=0), "aesni_mb_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
<br>
- @crypto_test<br>
- def aesni_gcm_vdev(self):<br>
- """aesni_gcm virtual device test.<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.throughput,<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>
- Steps:<br>
- * Create a cryptodev instance with crypto_aesni_gcm and supplied buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "aesni_gcm_vdev" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<br>
- vdevs=[VirtualDevice("crypto_aesni_gcm0")],<br>
- devtype=DeviceType.crypto_aesni_gcm,<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>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["aesni_gcm_vdev"],<br>
- )<br>
- results = self._verify_throughput(app.run_app(num_vfs=0), "aesni_gcm_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<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 kasumi_vdev(self) -> None:<br>
- """Kasmumi virtual device test.<br>
+ def aead_test(self) -> None:<br>
+ """Aead cryptography test.<br>
<br>
Steps:<br>
- * Create a cryptodev instance with crypto_kasumi and supplied buffer sizes.<br>
+ * Run dpdk-test-crypto-perf application with configured parameters in aead mode.<br>
Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
+ * The resulting Gbps is within a delta tolerance of a given baseline.<br>
"""<br>
- if "kasumi_vdev" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- vdevs=[VirtualDevice("crypto_kasumi0")],<br>
- ptest=TestType.throughput,<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_throughput(app.run_app(num_vfs=0), "kasumi_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
<br>
- @crypto_test<br>
- def snow3g_vdev(self) -> None:<br>
- """snow3g virtual device test.<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.throughput,<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>
- Steps:<br>
- * Create a cryptodev instance with crypto_snow3g and supplied buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "snow3g_vdev" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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=4,<br>
- burst_sz=32,<br>
- total_ops=TOTAL_OPS,<br>
- buffer_sz=self.buffer_sizes["snow3g_vdev"],<br>
- )<br>
- results = self._verify_throughput(app.run_app(num_vfs=0), "snow3g_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<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 zuc_vdev(self) -> None:<br>
- """Zuc virtual device test.<br>
+ def cipher_and_auth_tests(self) -> None:<br>
+ """Cipher and Authentication tests.<br>
<br>
Steps:<br>
- * Create a cryptodev instance with crypto_zuc and supplied buffer sizes.<br>
+ * Run dpdk-test-crypto-perf application in cipher then authentication mode<br>
Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
+ * The resulting Gbps is within a delta tolerance of a given baseline.<br>
"""<br>
- if "zuc_vdev" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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_throughput(app.run_app(num_vfs=0), "zuc_vdev")<br>
- self._print_stats(results)<br>
- for result in results:<br>
- verify(result["passed"] == "PASS", "Gbps fell below delta tolerance")<br>
-<br>
- @crypto_test<br>
- def open_ssl_vdev(self) -> None:<br>
- """open_ssl virtual device test.<br>
<br>
- Steps:<br>
- * Create a cryptodev instance with provided device type and buffer sizes.<br>
- Verify:<br>
- * The resulting Gbps is greater than expected_gbps*(1-delta_tolerance).<br>
- """<br>
- if "open_ssl_vdev" not in self.throughput_test_parameters:<br>
- skip("test not configured")<br>
- app = Cryptodev(<br>
- ptest=TestType.throughput,<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_throughput(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>
- "Gbps fell below delta tolerance",<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 throughput 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.throughput,<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>
+ 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>
+ 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>