Skip to contentSkip to conversation

test/crypto: check if RAW API is supported

PATCH Superseded Adam Dybkowski 3 participants 5 messages Jul 19, 2021 – Jul 20, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 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".

---
 app/test/test_cryptodev.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +33 -1
index 31201d93e1..43c05ed3d8 100644
@@ -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));
Signature · 1 line
2.25.1
#1 lore raw
Quoted 46 lines

This patch adds checking if RAW API is supported at the start of the test command "cryptodev_qat_raw_api_autotest".

---
 app/test/test_cryptodev.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +23 -1
index 31201d93e1..43c05ed3d8 100644
@@ -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");

app/test/test_cryptodev.c test_cryptodev_bcmfs(void) · line 14801

Quoted 10 lines
app/test/test_cryptodev.c +10 -0
+				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.

Quoted 5 lines
app/test/test_cryptodev.c +0 -0
 	global_api_test_type = CRYPTODEV_RAW_API_TEST;
 	ret =

run_cryptodev_testsuite(RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD)); --
2.25.1

#2 lore raw

PATCH v4 1/1 test/crypto: check if RAW API is supported

In reply to Adam Dybkowski

This patch adds checking if RAW API is supported at the start of the test command "cryptodev_qat_raw_api_autotest".

---
 app/test/test_cryptodev.c | 43 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +42 -1
index 31201d93e1..25778f464b 100644
@@ -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;
Signature · 1 line
2.25.1
Acked-by on v4 1/1
#3 lore raw
Quoted 89 lines

-----Original Message-----
From: Dybkowski, AdamX <[email protected]>
Sent: Tuesday, July 20, 2021 2:12 PM
To: [email protected]; Zhang, Roy Fan <[email protected]>; [email protected]
Cc: Dybkowski, AdamX <[email protected]>
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".

---
 app/test/test_cryptodev.c | 43
++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
app/test/test_cryptodev.c +24 -0
index 31201d93e1..25778f464b 100644
@@ -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",

app/test/test_cryptodev.c +18 -1
+						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);
app/test/test_cryptodev.c +0 -1
 	global_api_test_type = CRYPTODEV_API_TEST;
 
 	return ret;
--
Quoted 1 line

2.25.1