DPDK patches and discussions
 help / color / mirror / Atom feed
From: Archana Muniganti <marchana@marvell.com>
To: <ciara.power@intel.com>, <declan.doherty@intel.com>,
	<gakhil@marvell.com>
Cc: Archana Muniganti <marchana@marvell.com>, <anoobj@marvell.com>,
	<dev@dpdk.org>
Subject: [PATCH 1/2] app/crypto-perf: populate mbuf in latency test
Date: Fri, 8 Apr 2022 15:48:34 +0530	[thread overview]
Message-ID: <20220408101835.12941-2-marchana@marvell.com> (raw)
In-Reply-To: <20220408101835.12941-1-marchana@marvell.com>

For decrypt, ICV mismatch can come as data is dummy and
latency will be calculated for error path. Hence populate
mbuf with test vector data.

Signed-off-by: Archana Muniganti <marchana@marvell.com>
---
 app/test-crypto-perf/cperf_ops.c          |  3 +-
 app/test-crypto-perf/cperf_test_common.c  | 36 +++++++++++++++++++++++
 app/test-crypto-perf/cperf_test_common.h  |  5 ++++
 app/test-crypto-perf/cperf_test_latency.c |  6 ++++
 app/test-crypto-perf/cperf_test_verify.c  | 36 -----------------------
 5 files changed, 49 insertions(+), 37 deletions(-)

diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c
index 8baee12e45..97b719e13b 100644
--- a/app/test-crypto-perf/cperf_ops.c
+++ b/app/test-crypto-perf/cperf_ops.c
@@ -620,7 +620,8 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
 		}
 	}
 
-	if (options->test == CPERF_TEST_TYPE_VERIFY) {
+	if ((options->test == CPERF_TEST_TYPE_VERIFY) ||
+			(options->test == CPERF_TEST_TYPE_LATENCY)) {
 		for (i = 0; i < nb_ops; i++) {
 			uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ops[i],
 					uint8_t *, iv_offset);
diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c
index 97a1ea47ad..00aadc9a47 100644
--- a/app/test-crypto-perf/cperf_test_common.c
+++ b/app/test-crypto-perf/cperf_test_common.c
@@ -262,3 +262,39 @@ cperf_alloc_common_memory(const struct cperf_options *options,
 
 	return 0;
 }
+
+void
+cperf_mbuf_set(struct rte_mbuf *mbuf,
+		const struct cperf_options *options,
+		const struct cperf_test_vector *test_vector)
+{
+	uint32_t segment_sz = options->segment_sz;
+	uint8_t *mbuf_data;
+	uint8_t *test_data;
+	uint32_t remaining_bytes = options->max_buffer_size;
+
+	if (options->op_type == CPERF_AEAD) {
+		test_data = (options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT) ?
+					test_vector->plaintext.data :
+					test_vector->ciphertext.data;
+	} else {
+		test_data =
+			(options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
+				test_vector->plaintext.data :
+				test_vector->ciphertext.data;
+	}
+
+	while (remaining_bytes) {
+		mbuf_data = rte_pktmbuf_mtod(mbuf, uint8_t *);
+
+		if (remaining_bytes <= segment_sz) {
+			memcpy(mbuf_data, test_data, remaining_bytes);
+			return;
+		}
+
+		memcpy(mbuf_data, test_data, segment_sz);
+		remaining_bytes -= segment_sz;
+		test_data += segment_sz;
+		mbuf = mbuf->next;
+	}
+}
diff --git a/app/test-crypto-perf/cperf_test_common.h b/app/test-crypto-perf/cperf_test_common.h
index 3ace0d2e58..a603a607d5 100644
--- a/app/test-crypto-perf/cperf_test_common.h
+++ b/app/test-crypto-perf/cperf_test_common.h
@@ -21,4 +21,9 @@ cperf_alloc_common_memory(const struct cperf_options *options,
 			uint32_t *dst_buf_offset,
 			struct rte_mempool **pool);
 
+void
+cperf_mbuf_set(struct rte_mbuf *mbuf,
+		const struct cperf_options *options,
+		const struct cperf_test_vector *test_vector);
+
 #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 9ada431660..6f972cea49 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -201,6 +201,12 @@ cperf_latency_test_runner(void *arg)
 					ctx->test_vector, iv_offset,
 					&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,
+						ctx->options,
+						ctx->test_vector);
+
 			tsc_start = rte_rdtsc_precise();
 
 #ifdef CPERF_LINEARIZATION_ENABLE
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index c031330afc..5c0dc82290 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -195,42 +195,6 @@ cperf_verify_op(struct rte_crypto_op *op,
 	return !!res;
 }
 
-static void
-cperf_mbuf_set(struct rte_mbuf *mbuf,
-		const struct cperf_options *options,
-		const struct cperf_test_vector *test_vector)
-{
-	uint32_t segment_sz = options->segment_sz;
-	uint8_t *mbuf_data;
-	uint8_t *test_data;
-	uint32_t remaining_bytes = options->max_buffer_size;
-
-	if (options->op_type == CPERF_AEAD) {
-		test_data = (options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT) ?
-					test_vector->plaintext.data :
-					test_vector->ciphertext.data;
-	} else {
-		test_data =
-			(options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
-				test_vector->plaintext.data :
-				test_vector->ciphertext.data;
-	}
-
-	while (remaining_bytes) {
-		mbuf_data = rte_pktmbuf_mtod(mbuf, uint8_t *);
-
-		if (remaining_bytes <= segment_sz) {
-			memcpy(mbuf_data, test_data, remaining_bytes);
-			return;
-		}
-
-		memcpy(mbuf_data, test_data, segment_sz);
-		remaining_bytes -= segment_sz;
-		test_data += segment_sz;
-		mbuf = mbuf->next;
-	}
-}
-
 int
 cperf_verify_test_runner(void *test_ctx)
 {
-- 
2.22.0


  reply	other threads:[~2022-04-08 10:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08 10:18 [PATCH 0/2] " Archana Muniganti
2022-04-08 10:18 ` Archana Muniganti [this message]
2022-04-29  5:59   ` [PATCH 1/2] app/crypto-perf: " Akhil Goyal
2022-04-29  9:35     ` Akhil Goyal
2022-04-08 10:18 ` [PATCH 2/2] app/crypto-perf: add vector file for AES-GCM Archana Muniganti
2022-04-29  6:01   ` Akhil Goyal
2022-04-29  9:21     ` Archana Muniganti
2022-04-29  9:31       ` 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=20220408101835.12941-2-marchana@marvell.com \
    --to=marchana@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=ciara.power@intel.com \
    --cc=declan.doherty@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).