From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 90DCDA0588; Thu, 16 Apr 2020 19:24:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 33BDC1DDD1; Thu, 16 Apr 2020 19:24:34 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id C81721D902 for ; Thu, 16 Apr 2020 19:24:30 +0200 (CEST) IronPort-SDR: LM8Kexah7KrZFVA4GgLzmWC6Q9/KTno0+8mZ8l2JUFGvKJVo+Z1VToKaBCx/GOxP4iS6ZN/A/I M8OCBYYdM3iA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2020 10:24:29 -0700 IronPort-SDR: K5IktWIDMMKzu0RgPahOQPJoLDZxfGnDp96NAxl8mNdwAdR5ReUG+ZxwLgr3UG4zROIXCHBvbt TfO4E81rhrxg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,391,1580803200"; d="scan'208";a="454409953" Received: from silpixa00399593.ir.intel.com (HELO silpixa00399593.ger.corp.intel.com) ([10.237.223.21]) by fmsmga005.fm.intel.com with ESMTP; 16 Apr 2020 10:24:28 -0700 From: Pablo de Lara To: declan.doherty@intel.com Cc: dev@dpdk.org, akhil.goyal@nxp.com, Pablo de Lara Date: Thu, 16 Apr 2020 18:24:23 +0100 Message-Id: <1587057864-160450-2-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1587057864-160450-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <20200416090819.1921843-1-pablo.de.lara.guarch@intel.com> <1587057864-160450-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v5 1/2] test/crypto: add capability 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" Check if test case is supported by the crypto device, including algorithm and some of its parameter, such as key length, IV length, etc, using the capabilities API. If it is not supported, test case is skipped. Signed-off-by: Pablo de Lara Acked-by: Adam Dybkowski Tested-by: Ruifeng Wang --- app/test/test_cryptodev_blockcipher.c | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c index 4973c74..8453470 100644 --- a/app/test/test_cryptodev_blockcipher.c +++ b/app/test/test_cryptodev_blockcipher.c @@ -21,6 +21,49 @@ #include "test_cryptodev_hash_test_vectors.h" static int +verify_algo_support(const struct blockcipher_test_case *t, + const uint8_t dev_id, const uint32_t digest_len) +{ + int ret = 0; + const struct blockcipher_test_data *tdata = t->test_data; + struct rte_cryptodev_sym_capability_idx cap_idx; + const struct rte_cryptodev_symmetric_capability *capability; + + if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) { + cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; + cap_idx.algo.cipher = tdata->crypto_algo; + capability = rte_cryptodev_sym_capability_get(dev_id, &cap_idx); + if (capability == NULL) + return -1; + + if (cap_idx.algo.cipher != RTE_CRYPTO_CIPHER_NULL) + ret = rte_cryptodev_sym_capability_check_cipher(capability, + tdata->cipher_key.len, + tdata->iv.len); + if (ret != 0) + return -1; + } + + if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) { + cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; + cap_idx.algo.auth = tdata->auth_algo; + capability = rte_cryptodev_sym_capability_get(dev_id, &cap_idx); + if (capability == NULL) + return -1; + + if (cap_idx.algo.auth != RTE_CRYPTO_AUTH_NULL) + ret = rte_cryptodev_sym_capability_check_auth(capability, + tdata->auth_key.len, + digest_len, + 0); + if (ret != 0) + return -1; + } + + return 0; +} + +static int test_blockcipher_one_case(const struct blockcipher_test_case *t, struct rte_mempool *mbuf_pool, struct rte_mempool *op_mpool, @@ -98,6 +141,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, printf("Device doesn't support out-of-place " "scatter-gather in input mbuf. " "Test Skipped.\n"); + snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, + "SKIPPED"); return 0; } } else { @@ -105,6 +150,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, printf("Device doesn't support in-place " "scatter-gather mbufs. " "Test Skipped.\n"); + snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, + "SKIPPED"); return 0; } } @@ -144,6 +191,15 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, goto error_exit; } + /* Check if PMD is capable of performing that test */ + if (verify_algo_support(t, dev_id, digest_len) < 0) { + RTE_LOG(DEBUG, USER1, + "Device does not support this algorithm." + "Test Skipped.\n"); + snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN, "SKIPPED"); + return 0; + } + /* preparing data */ if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) buf_len += digest_len; -- 2.7.5