From patchwork Wed Sep 13 07:22:46 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: 28690 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 E67521B1B3; Wed, 13 Sep 2017 17:22:35 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6497A1B1AA for ; Wed, 13 Sep 2017 17:22:34 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Sep 2017 08:22:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,388,1500966000"; d="scan'208";a="151419325" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by fmsmga006.fm.intel.com with ESMTP; 13 Sep 2017 08:22:32 -0700 From: Pablo de Lara To: declan.doherty@intel.com, akhil.goyal@nxp.com, hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com, fiona.trahe@intel.com, deepak.k.jain@intel.com, john.griffin@intel.com Cc: dev@dpdk.org, Pablo de Lara Date: Wed, 13 Sep 2017 08:22:46 +0100 Message-Id: <20170913072249.29797-5-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170913072249.29797-1-pablo.de.lara.guarch@intel.com> References: <20170818080520.43088-1-pablo.de.lara.guarch@intel.com> <20170913072249.29797-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v2 4/7] app/crypto-perf: overwrite mbuf when verifying 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" When running the verify test, mbufs in the pool were populated with the test vector loaded from a file. To avoid limiting the number of operations to the pool size, mbufs will be rewritten with the test vector, before linking them to the crypto operations. Signed-off-by: Pablo de Lara --- app/test-crypto-perf/cperf_options_parsing.c | 7 ------ app/test-crypto-perf/cperf_test_verify.c | 35 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 9e5f486..52b884f 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -900,13 +900,6 @@ cperf_options_check(struct cperf_options *options) } if (options->test == CPERF_TEST_TYPE_VERIFY && - options->total_ops > options->pool_sz) { - RTE_LOG(ERR, USER1, "Total number of ops must be less than or" - " equal to the pool size.\n"); - return -EINVAL; - } - - if (options->test == CPERF_TEST_TYPE_VERIFY && (options->inc_buffer_size != 0 || options->buffer_size_count > 1)) { RTE_LOG(ERR, USER1, "Only one buffer size is allowed when " diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c index 6f790ce..03474cb 100644 --- a/app/test-crypto-perf/cperf_test_verify.c +++ b/app/test-crypto-perf/cperf_test_verify.c @@ -187,6 +187,34 @@ cperf_mbuf_create(struct rte_mempool *mempool, return NULL; } +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 = + (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ? + test_vector->plaintext.data : + test_vector->ciphertext.data; + uint32_t remaining_bytes = options->max_buffer_size; + + 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; + } +} + void * cperf_verify_test_constructor(struct rte_mempool *sess_mp, uint8_t dev_id, uint16_t qp_id, @@ -469,6 +497,13 @@ cperf_verify_test_runner(void *test_ctx) ops_needed, ctx->sess, ctx->options, ctx->test_vector, iv_offset); + + /* Populate the mbuf with the test vector, for verification */ + for (i = 0; i < ops_needed; i++) + cperf_mbuf_set(ops[i]->sym->m_src, + ctx->options, + ctx->test_vector); + #ifdef CPERF_LINEARIZATION_ENABLE if (linearize) { /* PMD doesn't support scatter-gather and source buffer