From patchwork Wed Sep 20 01:37:04 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: 28989 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 1CFE11AEE8; Wed, 20 Sep 2017 11:38:19 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 036731F5; Wed, 20 Sep 2017 11:38:11 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2017 02:36:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,420,1500966000"; d="scan'208"; a="1016529077" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by orsmga003.jf.intel.com with ESMTP; 20 Sep 2017 02:36:46 -0700 From: Pablo de Lara To: declan.doherty@intel.com Cc: dev@dpdk.org, Pablo de Lara , stable@dpdk.org Date: Wed, 20 Sep 2017 02:37:04 +0100 Message-Id: <20170920013704.85333-4-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170920013704.85333-1-pablo.de.lara.guarch@intel.com> References: <20170915020937.75688-1-pablo.de.lara.guarch@intel.com> <20170920013704.85333-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v3 3/3] app/crypto-perf: fix packet length check 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 using DES-CBC, packet size has to be multiple of 8 bytes, but if a list of packets is provided. the check was not correct. Fixes: fc4600fb2520 ("app/crypto-perf: add extra option checks") Cc: stable@dpdk.org Signed-off-by: Pablo de Lara Acked-by: Radu Nicolau --- app/test-crypto-perf/cperf_options_parsing.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 663f53f..3f933bc 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -832,14 +832,26 @@ check_cipher_buffer_length(struct cperf_options *options) if (options->cipher_algo == RTE_CRYPTO_CIPHER_DES_CBC || options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_CBC || options->cipher_algo == RTE_CRYPTO_CIPHER_3DES_ECB) { - for (buffer_size = options->min_buffer_size; - buffer_size < options->max_buffer_size; - buffer_size += options->inc_buffer_size) { + if (options->inc_buffer_size != 0) + buffer_size = options->min_buffer_size; + else + buffer_size = options->buffer_size_list[0]; + + while (buffer_size <= options->max_buffer_size) { if ((buffer_size % DES_BLOCK_SIZE) != 0) { RTE_LOG(ERR, USER1, "Some of the buffer sizes are " "not suitable for the algorithm selected\n"); return -EINVAL; } + + if (options->inc_buffer_size != 0) + buffer_size += options->inc_buffer_size; + else { + if (++buffer_size_idx == options->buffer_size_count) + break; + buffer_size = options->buffer_size_list[buffer_size_idx]; + } + } }