DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>, Ciara Power <ciara.power@intel.com>
Cc: Anoob Joseph <anoobj@marvell.com>,
	Akhil Goyal <gakhil@marvell.com>,
	Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Subject: [PATCH v2 4/6] app/crypto-perf: add function to check asymmetric operation
Date: Wed, 26 Jun 2024 14:17:43 +0530	[thread overview]
Message-ID: <20240626084747.1595-5-gmuthukrishn@marvell.com> (raw)
In-Reply-To: <20240626084747.1595-1-gmuthukrishn@marvell.com>

Replace checking input option for every asymmetric test case by
a function.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
v2:
 - cperf_is_asym_test is fixed to check only modex in this patch.
---
 app/test-crypto-perf/cperf_test_common.c     | 11 ++++++++++-
 app/test-crypto-perf/cperf_test_common.h     |  2 ++
 app/test-crypto-perf/cperf_test_latency.c    |  7 ++++---
 app/test-crypto-perf/cperf_test_throughput.c |  2 +-
 app/test-crypto-perf/cperf_test_verify.c     |  2 +-
 app/test-crypto-perf/main.c                  |  8 ++++----
 6 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c
index 6b8ab65731..0f1f0b72c1 100644
--- a/app/test-crypto-perf/cperf_test_common.c
+++ b/app/test-crypto-perf/cperf_test_common.c
@@ -152,7 +152,7 @@ cperf_alloc_common_memory(const struct cperf_options *options,
 	uint16_t crypto_op_size = sizeof(struct rte_crypto_op);
 	uint16_t crypto_op_private_size;
 
-	if (options->op_type == CPERF_ASYM_MODEX) {
+	if (cperf_is_asym_test(options)) {
 		crypto_op_size += sizeof(struct rte_crypto_asym_op);
 		snprintf(pool_name, RTE_MEMPOOL_NAMESIZE, "perf_asym_op_pool%u",
 			 rte_socket_id());
@@ -301,3 +301,12 @@ cperf_mbuf_set(struct rte_mbuf *mbuf,
 		mbuf = mbuf->next;
 	}
 }
+
+bool
+cperf_is_asym_test(const struct cperf_options *options)
+{
+	if (options->op_type == CPERF_ASYM_MODEX)
+		return true;
+
+	return false;
+}
diff --git a/app/test-crypto-perf/cperf_test_common.h b/app/test-crypto-perf/cperf_test_common.h
index a603a607d5..2d1f69aaa2 100644
--- a/app/test-crypto-perf/cperf_test_common.h
+++ b/app/test-crypto-perf/cperf_test_common.h
@@ -26,4 +26,6 @@ cperf_mbuf_set(struct rte_mbuf *mbuf,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector);
 
+bool
+cperf_is_asym_test(const struct cperf_options *options);
 #endif /* _CPERF_TEST_COMMON_H_ */
diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index 376847e761..201815b469 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -47,7 +47,7 @@ cperf_latency_test_free(struct cperf_latency_ctx *ctx)
 		return;
 
 	if (ctx->sess != NULL) {
-		if (ctx->options->op_type == CPERF_ASYM_MODEX)
+		if (cperf_is_asym_test(ctx->options))
 			rte_cryptodev_asym_session_free(ctx->dev_id, ctx->sess);
 #ifdef RTE_LIB_SECURITY
 		else if (ctx->options->op_type == CPERF_PDCP ||
@@ -217,8 +217,9 @@ cperf_latency_test_runner(void *arg)
 					&imix_idx, &tsc_start);
 
 			/* Populate the mbuf with the test vector */
-			for (i = 0; i < burst_size; i++)
-				cperf_mbuf_set(ops[i]->sym->m_src,
+			if (!cperf_is_asym_test(ctx->options))
+				for (i = 0; i < burst_size; i++)
+					cperf_mbuf_set(ops[i]->sym->m_src,
 						ctx->options,
 						ctx->test_vector);
 
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index c0891e7c99..7112b95529 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -37,7 +37,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
 	if (!ctx)
 		return;
 	if (ctx->sess) {
-		if (ctx->options->op_type == CPERF_ASYM_MODEX)
+		if (cperf_is_asym_test(ctx->options))
 			rte_cryptodev_asym_session_free(ctx->dev_id,
 					(void *)ctx->sess);
 #ifdef RTE_LIB_SECURITY
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index 222c7a1cd8..91429841ca 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -42,7 +42,7 @@ cperf_verify_test_free(struct cperf_verify_ctx *ctx)
 		return;
 
 	if (ctx->sess != NULL) {
-		if (ctx->options->op_type == CPERF_ASYM_MODEX)
+		if (cperf_is_asym_test(ctx->options))
 			rte_cryptodev_asym_session_free(ctx->dev_id, ctx->sess);
 #ifdef RTE_LIB_SECURITY
 		else if (ctx->options->op_type == CPERF_PDCP ||
diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 40c0b4b54f..780f22f399 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -18,6 +18,7 @@
 #include "cperf.h"
 #include "cperf_options.h"
 #include "cperf_test_vector_parsing.h"
+#include "cperf_test_common.h"
 #include "cperf_test_throughput.h"
 #include "cperf_test_latency.h"
 #include "cperf_test_verify.h"
@@ -203,7 +204,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 
 		rte_cryptodev_info_get(cdev_id, &cdev_info);
 
-		if (opts->op_type == CPERF_ASYM_MODEX) {
+		if (cperf_is_asym_test(opts)) {
 			if ((cdev_info.feature_flags &
 			     RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) == 0)
 				continue;
@@ -289,7 +290,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 			return -ENOTSUP;
 		}
 
-		if (opts->op_type == CPERF_ASYM_MODEX)
+		if (cperf_is_asym_test(opts))
 			ret = create_asym_op_pool_socket(socket_id,
 							 sessions_needed);
 		else
@@ -300,9 +301,8 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs)
 
 		qp_conf.mp_session = session_pool_socket[socket_id].sess_mp;
 
-		if (opts->op_type == CPERF_ASYM_MODEX) {
+		if (cperf_is_asym_test(opts))
 			qp_conf.mp_session = NULL;
-		}
 
 		ret = rte_cryptodev_configure(cdev_id, &conf);
 		if (ret < 0) {
-- 
2.25.1


  parent reply	other threads:[~2024-06-26  8:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-15 11:53 [PATCH v1 0/6] app/crypto-perf: add asymmetric crypto tests Gowrishankar Muthukrishnan
2024-06-15 11:53 ` [PATCH v1 1/6] app/crypto-perf: add modex groups test Gowrishankar Muthukrishnan
2024-06-20  6:47   ` Akhil Goyal
2024-06-15 11:53 ` [PATCH v1 2/6] app/crypto-perf: remove redundant local varriable Gowrishankar Muthukrishnan
2024-06-20  6:47   ` Akhil Goyal
2024-06-15 11:53 ` [PATCH v1 3/6] app/crypto-perf: fix result location for asymmetric test Gowrishankar Muthukrishnan
2024-06-20  6:46   ` Akhil Goyal
2024-06-15 11:53 ` [PATCH v1 4/6] app/crypto-perf: add function to check asymmetric operation Gowrishankar Muthukrishnan
2024-06-20  6:47   ` Akhil Goyal
2024-06-26  6:58   ` Akhil Goyal
2024-06-15 11:53 ` [PATCH v1 5/6] app/crypto-perf: support SM2 Gowrishankar Muthukrishnan
2024-06-15 11:53 ` [PATCH v1 6/6] app/crypto-perf: support ECDSA Gowrishankar Muthukrishnan
2024-06-20  6:48   ` Akhil Goyal
2024-06-17  6:42 ` [PATCH v1 0/6] app/crypto-perf: add asymmetric crypto tests Anoob Joseph
2024-06-25 15:40 ` Dooley, Brian
2024-06-26  8:47 ` [PATCH v2 " Gowrishankar Muthukrishnan
2024-06-26  8:47   ` [PATCH v2 1/6] app/crypto-perf: add modex groups test Gowrishankar Muthukrishnan
2024-06-26  8:47   ` [PATCH v2 2/6] app/crypto-perf: remove redundant local varriable Gowrishankar Muthukrishnan
2024-06-26  8:47   ` [PATCH v2 3/6] app/crypto-perf: fix result location for asymmetric test Gowrishankar Muthukrishnan
2024-06-26  8:47   ` Gowrishankar Muthukrishnan [this message]
2024-06-26  8:47   ` [PATCH v2 5/6] app/crypto-perf: support SM2 Gowrishankar Muthukrishnan
2024-06-26  8:47   ` [PATCH v2 6/6] app/crypto-perf: support ECDSA Gowrishankar Muthukrishnan
2024-06-26 13:42   ` [PATCH v2 0/6] app/crypto-perf: add asymmetric crypto tests 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=20240626084747.1595-5-gmuthukrishn@marvell.com \
    --to=gmuthukrishn@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@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).