From patchwork Fri Sep 22 07:55:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "De Lara Guarch, Pablo" X-Patchwork-Id: 29120 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0223E1B1B2; Fri, 22 Sep 2017 17:55:35 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id D759B1B19C for ; Fri, 22 Sep 2017 17:55:30 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP; 22 Sep 2017 08:55:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,427,1500966000"; d="scan'208";a="154396012" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by fmsmga005.fm.intel.com with ESMTP; 22 Sep 2017 08:55:29 -0700 From: Pablo de Lara To: declan.doherty@intel.com, akhil.goyal@nxp.com Cc: dev@dpdk.org, Pablo de Lara Date: Fri, 22 Sep 2017 08:55:17 +0100 Message-Id: <20170922075519.28342-6-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170922075519.28342-1-pablo.de.lara.guarch@intel.com> References: <20170913072026.29734-1-pablo.de.lara.guarch@intel.com> <20170922075519.28342-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v3 5/7] app/crypto-perf: do not populate the mbufs at init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- app/test-crypto-perf/cperf_test_latency.c | 31 +++++++----------------- app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 31 +++++++----------------- app/test-crypto-perf/cperf_test_throughput.c | 31 +++++++----------------- app/test-crypto-perf/cperf_test_verify.c | 31 +++++++----------------- 4 files changed, 36 insertions(+), 88 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c index 7b9dc9f..acd8545 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, uint16_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); @@ -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; - } + segments_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; - } + segments_nb--; } @@ -257,7 +244,7 @@ cperf_latency_test_constructor(struct rte_mempool *sess_mp, ctx->pkt_mbuf_pool_in, options->segment_sz, segments_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_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c index 872124f..962dc69 100644 --- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c +++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c @@ -135,15 +135,10 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx, static struct rte_mbuf * cperf_mbuf_create(struct rte_mempool *mempool, uint32_t segment_sz, uint16_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); @@ -154,15 +149,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) { @@ -178,15 +169,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--; } @@ -274,7 +261,7 @@ cperf_pmd_cyclecount_test_constructor(struct rte_mempool *sess_mp, ctx->pkt_mbuf_pool_in, options->segment_sz, segments_nb, - options, test_vector); + options); if (ctx->mbufs_in[mbuf_idx] == NULL) goto err; } @@ -299,7 +286,7 @@ cperf_pmd_cyclecount_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 fcb82a8..e4da0d5 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, uint16_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); @@ -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; - } + segments_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; - } + segments_nb--; } @@ -239,7 +226,7 @@ cperf_throughput_test_constructor(struct rte_mempool *sess_mp, ctx->pkt_mbuf_pool_in, options->segment_sz, segments_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 dbfa661..3159361 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, uint16_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); @@ -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; - } + segments_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; - } + segments_nb--; } @@ -271,7 +258,7 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp, ctx->pkt_mbuf_pool_in, options->segment_sz, segments_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 {