[dpdk-dev,v2,5/7] app/crypto-perf: do not populate the mbufs at init

Message ID 20170913072249.29797-6-pablo.de.lara.guarch@intel.com
State Superseded, archived
Delegated to: Pablo de Lara Guarch
Headers show

Checks

Context Check Description
checkpatch success coding style OK
Intel-compilation success Compilation OK

Commit Message

Pablo de Lara Sept. 13, 2017, 7:22 a.m.
For throughput and latency tests, it is not required
to populate the mbufs with any test vector.
For verify test, there is already a function that rewrites
the mbufs every time they are going to be used with
crypto operations.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test-crypto-perf/cperf_test_latency.c    | 31 ++++++++--------------------
 app/test-crypto-perf/cperf_test_throughput.c | 31 ++++++++--------------------
 app/test-crypto-perf/cperf_test_verify.c     | 31 ++++++++--------------------
 3 files changed, 27 insertions(+), 66 deletions(-)

Patch hide | download patch | download mbox

diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index b272bb1..997844a 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -118,15 +118,10 @@  static struct rte_mbuf *
 cperf_mbuf_create(struct rte_mempool *mempool,
 		uint32_t segment_sz,
 		uint32_t segment_nb,
-		const struct cperf_options *options,
-		const struct cperf_test_vector *test_vector)
+		const struct cperf_options *options)
 {
 	struct rte_mbuf *mbuf;
 	uint8_t *mbuf_data;
-	uint8_t *test_data =
-			(options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
-					test_vector->plaintext.data :
-					test_vector->ciphertext.data;
 	uint32_t remaining_bytes = options->max_buffer_size;
 
 	mbuf = rte_pktmbuf_alloc(mempool);
@@ -137,15 +132,11 @@  cperf_mbuf_create(struct rte_mempool *mempool,
 	if (mbuf_data == NULL)
 		goto error;
 
-	if (options->max_buffer_size <= segment_sz) {
-		memcpy(mbuf_data, test_data, options->max_buffer_size);
-		test_data += options->max_buffer_size;
+	if (options->max_buffer_size <= segment_sz)
 		remaining_bytes = 0;
-	} else {
-		memcpy(mbuf_data, test_data, segment_sz);
-		test_data += segment_sz;
+	else
 		remaining_bytes -= segment_sz;
-	}
+
 	segment_nb--;
 
 	while (remaining_bytes) {
@@ -161,15 +152,11 @@  cperf_mbuf_create(struct rte_mempool *mempool,
 		if (mbuf_data == NULL)
 			goto error;
 
-		if (remaining_bytes <= segment_sz) {
-			memcpy(mbuf_data, test_data, remaining_bytes);
+		if (remaining_bytes <= segment_sz)
 			remaining_bytes = 0;
-			test_data += remaining_bytes;
-		} else {
-			memcpy(mbuf_data, test_data, segment_sz);
+		else
 			remaining_bytes -= segment_sz;
-			test_data += segment_sz;
-		}
+
 		segment_nb--;
 	}
 
@@ -257,7 +244,7 @@  cperf_latency_test_constructor(struct rte_mempool *sess_mp,
 				ctx->pkt_mbuf_pool_in,
 				options->segment_sz,
 				segment_nb,
-				options, test_vector);
+				options);
 		if (ctx->mbufs_in[mbuf_idx] == NULL)
 			goto err;
 	}
@@ -286,7 +273,7 @@  cperf_latency_test_constructor(struct rte_mempool *sess_mp,
 		if (options->out_of_place == 1)	{
 			ctx->mbufs_out[mbuf_idx] = cperf_mbuf_create(
 					ctx->pkt_mbuf_pool_out, max_size,
-					1, options, test_vector);
+					1, options);
 			if (ctx->mbufs_out[mbuf_idx] == NULL)
 				goto err;
 		} else {
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index d5e93f7..121ceb1 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -102,15 +102,10 @@  static struct rte_mbuf *
 cperf_mbuf_create(struct rte_mempool *mempool,
 		uint32_t segment_sz,
 		uint32_t segment_nb,
-		const struct cperf_options *options,
-		const struct cperf_test_vector *test_vector)
+		const struct cperf_options *options)
 {
 	struct rte_mbuf *mbuf;
 	uint8_t *mbuf_data;
-	uint8_t *test_data =
-			(options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
-					test_vector->plaintext.data :
-					test_vector->ciphertext.data;
 	uint32_t remaining_bytes = options->max_buffer_size;
 
 	mbuf = rte_pktmbuf_alloc(mempool);
@@ -121,15 +116,11 @@  cperf_mbuf_create(struct rte_mempool *mempool,
 	if (mbuf_data == NULL)
 		goto error;
 
-	if (options->max_buffer_size <= segment_sz) {
-		memcpy(mbuf_data, test_data, options->max_buffer_size);
-		test_data += options->max_buffer_size;
+	if (options->max_buffer_size <= segment_sz)
 		remaining_bytes = 0;
-	} else {
-		memcpy(mbuf_data, test_data, segment_sz);
-		test_data += segment_sz;
+	else
 		remaining_bytes -= segment_sz;
-	}
+
 	segment_nb--;
 
 	while (remaining_bytes) {
@@ -145,15 +136,11 @@  cperf_mbuf_create(struct rte_mempool *mempool,
 		if (mbuf_data == NULL)
 			goto error;
 
-		if (remaining_bytes <= segment_sz) {
-			memcpy(mbuf_data, test_data, remaining_bytes);
+		if (remaining_bytes <= segment_sz)
 			remaining_bytes = 0;
-			test_data += remaining_bytes;
-		} else {
-			memcpy(mbuf_data, test_data, segment_sz);
+		else
 			remaining_bytes -= segment_sz;
-			test_data += segment_sz;
-		}
+
 		segment_nb--;
 	}
 
@@ -239,7 +226,7 @@  cperf_throughput_test_constructor(struct rte_mempool *sess_mp,
 				ctx->pkt_mbuf_pool_in,
 				options->segment_sz,
 				segment_nb,
-				options, test_vector);
+				options);
 		if (ctx->mbufs_in[mbuf_idx] == NULL)
 			goto err;
 	}
@@ -267,7 +254,7 @@  cperf_throughput_test_constructor(struct rte_mempool *sess_mp,
 		if (options->out_of_place == 1)	{
 			ctx->mbufs_out[mbuf_idx] = cperf_mbuf_create(
 					ctx->pkt_mbuf_pool_out, max_size,
-					1, options, test_vector);
+					1, options);
 			if (ctx->mbufs_out[mbuf_idx] == NULL)
 				goto err;
 		} else {
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index 03474cb..b18426c 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -106,15 +106,10 @@  static struct rte_mbuf *
 cperf_mbuf_create(struct rte_mempool *mempool,
 		uint32_t segment_sz,
 		uint32_t segment_nb,
-		const struct cperf_options *options,
-		const struct cperf_test_vector *test_vector)
+		const struct cperf_options *options)
 {
 	struct rte_mbuf *mbuf;
 	uint8_t *mbuf_data;
-	uint8_t *test_data =
-			(options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
-					test_vector->plaintext.data :
-					test_vector->ciphertext.data;
 	uint32_t remaining_bytes = options->max_buffer_size;
 
 	mbuf = rte_pktmbuf_alloc(mempool);
@@ -125,15 +120,11 @@  cperf_mbuf_create(struct rte_mempool *mempool,
 	if (mbuf_data == NULL)
 		goto error;
 
-	if (options->max_buffer_size <= segment_sz) {
-		memcpy(mbuf_data, test_data, options->max_buffer_size);
-		test_data += options->max_buffer_size;
+	if (options->max_buffer_size <= segment_sz)
 		remaining_bytes = 0;
-	} else {
-		memcpy(mbuf_data, test_data, segment_sz);
-		test_data += segment_sz;
+	else
 		remaining_bytes -= segment_sz;
-	}
+
 	segment_nb--;
 
 	while (remaining_bytes) {
@@ -149,15 +140,11 @@  cperf_mbuf_create(struct rte_mempool *mempool,
 		if (mbuf_data == NULL)
 			goto error;
 
-		if (remaining_bytes <= segment_sz) {
-			memcpy(mbuf_data, test_data, remaining_bytes);
+		if (remaining_bytes <= segment_sz)
 			remaining_bytes = 0;
-			test_data += remaining_bytes;
-		} else {
-			memcpy(mbuf_data, test_data, segment_sz);
+		else
 			remaining_bytes -= segment_sz;
-			test_data += segment_sz;
-		}
+
 		segment_nb--;
 	}
 
@@ -271,7 +258,7 @@  cperf_verify_test_constructor(struct rte_mempool *sess_mp,
 				ctx->pkt_mbuf_pool_in,
 				options->segment_sz,
 				segment_nb,
-				options, test_vector);
+				options);
 		if (ctx->mbufs_in[mbuf_idx] == NULL)
 			goto err;
 	}
@@ -299,7 +286,7 @@  cperf_verify_test_constructor(struct rte_mempool *sess_mp,
 		if (options->out_of_place == 1)	{
 			ctx->mbufs_out[mbuf_idx] = cperf_mbuf_create(
 					ctx->pkt_mbuf_pool_out, max_size,
-					1, options, test_vector);
+					1, options);
 			if (ctx->mbufs_out[mbuf_idx] == NULL)
 				goto err;
 		} else {