DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anoob Joseph <anoobj@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>,
	Fan Zhang <fanzhang.oss@gmail.com>,
	Ciara Power <ciara.power@intel.com>
Cc: Hemant Agrawal <hemant.agrawal@nxp.com>,
	Gagandeep Singh <g.singh@nxp.com>,
	Jerin Jacob <jerinj@marvell.com>,
	Tejasree Kondoj <ktejasree@marvell.com>, <dev@dpdk.org>
Subject: [PATCH] test/crypto: remove redundant code
Date: Fri, 12 May 2023 19:51:48 +0530	[thread overview]
Message-ID: <20230512142148.262-1-anoobj@marvell.com> (raw)

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

Signed-off-by: Anoob Joseph <anoobj@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	other threads:[~2023-05-12 14:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 14:21 Anoob Joseph [this message]
2023-05-16 10:03 ` Akhil Goyal
2023-05-17 15:47 ` Power, Ciara
2023-05-24 12:30   ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230512142148.262-1-anoobj@marvell.com \
    --to=anoobj@marvell.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=g.singh@nxp.com \
    --cc=gakhil@marvell.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerinj@marvell.com \
    --cc=ktejasree@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).