diff mbox series

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

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

Checks

Context Check Description
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance 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 success coding style OK

Commit Message

Dybkowski, AdamX July 20, 2021, 1:11 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>
---
 app/test/test_cryptodev.c | 43 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

Comments

Fan Zhang July 20, 2021, 1:14 p.m. UTC | #1
> -----Original Message-----
> From: Dybkowski, AdamX <adamx.dybkowski@intel.com>
> Sent: Tuesday, July 20, 2021 2:12 PM
> To: dev@dpdk.org; Zhang, Roy Fan <roy.fan.zhang@intel.com>;
> gakhil@marvell.com
> Cc: Dybkowski, AdamX <adamx.dybkowski@intel.com>
> Subject: [PATCH v4] test/crypto: check if RAW API is supported
> 
> 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>
> ---
>  app/test/test_cryptodev.c | 43
> ++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 42 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
> index 31201d93e1..25778f464b 100644
> --- a/app/test/test_cryptodev.c
> +++ b/app/test/test_cryptodev.c
> @@ -14517,6 +14517,41 @@ run_cryptodev_testsuite(const char
> *pmd_name)
>  	return ret;
>  }
> 
> +static int
> +require_feature_flag(const char *pmd_name, uint64_t flag, const char
> *flag_name)
> +{
> +	struct rte_cryptodev_info dev_info;
> +	uint8_t i, nb_devs;
> +	int driver_id;
> +
> +	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 & flag)) {
> +				RTE_LOG(INFO, USER1, "%s not
> supported\n",
> +						flag_name);
> +				return TEST_SKIPPED;
> +			}
> +			return 0; /* found */
> +		}
> +	}
> +
> +	RTE_LOG(INFO, USER1, "%s not supported\n", flag_name);
> +	return TEST_SKIPPED;
> +}
> +
>  static int
>  test_cryptodev_qat(void)
>  {
> @@ -14766,10 +14801,16 @@ test_cryptodev_bcmfs(void)
>  static int
>  test_cryptodev_qat_raw_api(void)
>  {
> +	static const char *pmd_name =
> RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD);
>  	int ret;
> 
> +	ret = require_feature_flag(pmd_name,
> RTE_CRYPTODEV_FF_SYM_RAW_DP,
> +			"RAW API");
> +	if (ret)
> +		return ret;
> +
>  	global_api_test_type = CRYPTODEV_RAW_API_TEST;
> -	ret =
> run_cryptodev_testsuite(RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
> +	ret = run_cryptodev_testsuite(pmd_name);
>  	global_api_test_type = CRYPTODEV_API_TEST;
> 
>  	return ret;
> --
> 2.25.1

Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Akhil Goyal July 20, 2021, 8:48 p.m. UTC | #2
> > 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>

Acked-by: Akhil Goyal <gakhil@marvell.com>

Applied to dpdk-next-crypto
diff mbox series

Patch

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 31201d93e1..25778f464b 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -14517,6 +14517,41 @@  run_cryptodev_testsuite(const char *pmd_name)
 	return ret;
 }
 
+static int
+require_feature_flag(const char *pmd_name, uint64_t flag, const char *flag_name)
+{
+	struct rte_cryptodev_info dev_info;
+	uint8_t i, nb_devs;
+	int driver_id;
+
+	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 & flag)) {
+				RTE_LOG(INFO, USER1, "%s not supported\n",
+						flag_name);
+				return TEST_SKIPPED;
+			}
+			return 0; /* found */
+		}
+	}
+
+	RTE_LOG(INFO, USER1, "%s not supported\n", flag_name);
+	return TEST_SKIPPED;
+}
+
 static int
 test_cryptodev_qat(void)
 {
@@ -14766,10 +14801,16 @@  test_cryptodev_bcmfs(void)
 static int
 test_cryptodev_qat_raw_api(void)
 {
+	static const char *pmd_name = RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD);
 	int ret;
 
+	ret = require_feature_flag(pmd_name, RTE_CRYPTODEV_FF_SYM_RAW_DP,
+			"RAW API");
+	if (ret)
+		return ret;
+
 	global_api_test_type = CRYPTODEV_RAW_API_TEST;
-	ret = run_cryptodev_testsuite(RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
+	ret = run_cryptodev_testsuite(pmd_name);
 	global_api_test_type = CRYPTODEV_API_TEST;
 
 	return ret;