diff mbox series

[v3] test/crypto: check if RAW API is supported

Message ID 20210719123718.15960-1-adamx.dybkowski@intel.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers show
Series [v3] test/crypto: check if RAW API is supported | expand

Checks

Context Check Description
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot success github build: passed
ci/checkpatch warning coding style issues

Commit Message

Dybkowski, AdamX July 19, 2021, 12:37 p.m. UTC
This patch adds checking if RAW API is supported at the start
of the test command "cryptodev_qat_raw_api_autotest".

Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 app/test/test_cryptodev.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

Comments

Akhil Goyal July 19, 2021, 3:25 p.m. UTC | #1
> This patch adds checking if RAW API is supported at the start
> of the test command "cryptodev_qat_raw_api_autotest".
> 
> Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>  app/test/test_cryptodev.c | 34 +++++++++++++++++++++++++++++++++-
>  1 file changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
> index 31201d93e1..43c05ed3d8 100644
> --- a/app/test/test_cryptodev.c
> +++ b/app/test/test_cryptodev.c
> @@ -14766,7 +14766,39 @@ test_cryptodev_bcmfs(void)
>  static int
>  test_cryptodev_qat_raw_api(void)
>  {
> -	int ret;
> +	static const char *pmd_name =
> RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD);
> +	struct rte_cryptodev_info dev_info;
> +	uint8_t i, nb_devs, found = 0;
> +	int driver_id, ret;
> +
> +	driver_id = rte_cryptodev_driver_id_get(pmd_name);
> +	if (driver_id == -1) {
> +		RTE_LOG(WARNING, USER1, "%s PMD must be loaded.\n",
> pmd_name);
> +		return TEST_SKIPPED;
> +	}
> +
> +	nb_devs = rte_cryptodev_count();
> +	if (nb_devs < 1) {
> +		RTE_LOG(WARNING, USER1, "No crypto devices found?\n");
> +		return TEST_SKIPPED;
> +	}
> +
> +	for (i = 0; i < nb_devs; i++) {
> +		rte_cryptodev_info_get(i, &dev_info);
> +		if (dev_info.driver_id == driver_id) {
> +			if (!(dev_info.feature_flags &
> +					RTE_CRYPTODEV_FF_SYM_RAW_DP))
> {
> +				RTE_LOG(INFO, USER1, "RAW API not
> supported\n");
> +				return TEST_SKIPPED;
> +			}
> +			found = 1;
> +			break;
> +		}
> +	}
> +	if (!found) {
> +		RTE_LOG(INFO, USER1, "RAW API not supported\n");
> +		return TEST_SKIPPED;
> +	}
> 
Can we make it a generic function which may be used by other PMDs as well
to check if feature flag is set or not. You can call the function from
test_cryptodev_qat_raw_api(). The function can take pmd_name as input
similar to run_cryptodev_testsuite.

>  	global_api_test_type = CRYPTODEV_RAW_API_TEST;
>  	ret =
> run_cryptodev_testsuite(RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
> --
> 2.25.1
diff mbox series

Patch

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 31201d93e1..43c05ed3d8 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -14766,7 +14766,39 @@  test_cryptodev_bcmfs(void)
 static int
 test_cryptodev_qat_raw_api(void)
 {
-	int ret;
+	static const char *pmd_name = RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD);
+	struct rte_cryptodev_info dev_info;
+	uint8_t i, nb_devs, found = 0;
+	int driver_id, ret;
+
+	driver_id = rte_cryptodev_driver_id_get(pmd_name);
+	if (driver_id == -1) {
+		RTE_LOG(WARNING, USER1, "%s PMD must be loaded.\n", pmd_name);
+		return TEST_SKIPPED;
+	}
+
+	nb_devs = rte_cryptodev_count();
+	if (nb_devs < 1) {
+		RTE_LOG(WARNING, USER1, "No crypto devices found?\n");
+		return TEST_SKIPPED;
+	}
+
+	for (i = 0; i < nb_devs; i++) {
+		rte_cryptodev_info_get(i, &dev_info);
+		if (dev_info.driver_id == driver_id) {
+			if (!(dev_info.feature_flags &
+					RTE_CRYPTODEV_FF_SYM_RAW_DP)) {
+				RTE_LOG(INFO, USER1, "RAW API not supported\n");
+				return TEST_SKIPPED;
+			}
+			found = 1;
+			break;
+		}
+	}
+	if (!found) {
+		RTE_LOG(INFO, USER1, "RAW API not supported\n");
+		return TEST_SKIPPED;
+	}
 
 	global_api_test_type = CRYPTODEV_RAW_API_TEST;
 	ret = run_cryptodev_testsuite(RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));