From 8e4b860141a1f794aafa0494939d2df223bf43b6 Mon Sep 17 00:00:00 2001 From: Pablo de Lara Date: Wed, 4 Oct 2017 04:46:11 +0100 Subject: [PATCH] app/crypto-perf: do not populate the mbufs at init 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 Acked-by: Akhil Goyal --- app/test-crypto-perf/cperf_test_common.c | 31 +++++++----------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c index 0f62a2c41e..25eb970679 100644 --- a/app/test-crypto-perf/cperf_test_common.c +++ b/app/test-crypto-perf/cperf_test_common.c @@ -38,15 +38,10 @@ static struct rte_mbuf * cperf_mbuf_create(struct rte_mempool *mempool, uint32_t segment_sz, uint32_t segments_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); @@ -57,15 +52,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; - } + segments_nb--; while (remaining_bytes) { @@ -81,15 +72,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; - } + segments_nb--; } @@ -156,7 +143,7 @@ cperf_alloc_common_memory(const struct cperf_options *options, *pkt_mbuf_pool_in, options->segment_sz, segments_nb, - options, test_vector); + options); if ((*mbufs_in)[mbuf_idx] == NULL) return -1; } @@ -180,7 +167,7 @@ cperf_alloc_common_memory(const struct cperf_options *options, for (mbuf_idx = 0; mbuf_idx < options->pool_sz; mbuf_idx++) { (*mbufs_out)[mbuf_idx] = cperf_mbuf_create( *pkt_mbuf_pool_out, max_size, - 1, options, test_vector); + 1, options); if ((*mbufs_out)[mbuf_idx] == NULL) return -1; } -- 2.20.1