Code for registering raw API tests for various PMDs are repeated.
Add common routine to avoid duplication of code.

Signed-off-by: Anoob Joseph <ano...@marvell.com>
---
 app/test/test_cryptodev.c | 40 ++++++++++-----------------------------
 1 file changed, 10 insertions(+), 30 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index d212e71ba6..f44e8b3101 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -17462,13 +17462,11 @@ test_cryptodev_bcmfs(void)
 }
 
 static int
-test_cryptodev_qat_raw_api(void)
+run_cryptodev_raw_testsuite(const char *pmd_name)
 {
-       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");
+       ret = require_feature_flag(pmd_name, RTE_CRYPTODEV_FF_SYM_RAW_DP, "RAW 
API");
        if (ret)
                return ret;
 
@@ -17479,6 +17477,12 @@ test_cryptodev_qat_raw_api(void)
        return ret;
 }
 
+static int
+test_cryptodev_qat_raw_api(void)
+{
+       return run_cryptodev_raw_testsuite(RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));
+}
+
 static int
 test_cryptodev_cn9k(void)
 {
@@ -17494,37 +17498,13 @@ test_cryptodev_cn10k(void)
 static int
 test_cryptodev_dpaa2_sec_raw_api(void)
 {
-       static const char *pmd_name = RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_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(pmd_name);
-       global_api_test_type = CRYPTODEV_API_TEST;
-
-       return ret;
+       return 
run_cryptodev_raw_testsuite(RTE_STR(CRYPTODEV_NAME_DPAA2_SEC_PMD));
 }
 
 static int
 test_cryptodev_dpaa_sec_raw_api(void)
 {
-       static const char *pmd_name = RTE_STR(CRYPTODEV_NAME_DPAA_SEC_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(pmd_name);
-       global_api_test_type = CRYPTODEV_API_TEST;
-
-       return ret;
+       return 
run_cryptodev_raw_testsuite(RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));
 }
 
 REGISTER_TEST_COMMAND(cryptodev_dpaa2_sec_raw_api_autotest,
-- 
2.25.1

Reply via email to