From patchwork Tue Apr 14 17:40:55 2020 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: 68436 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7C345A0577; Tue, 14 Apr 2020 19:41:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 09BBD1D42A; Tue, 14 Apr 2020 19:41:08 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id F0D761D420 for ; Tue, 14 Apr 2020 19:41:04 +0200 (CEST) IronPort-SDR: LX9y83++ezKz4a46m/FM+1s1XMy+d35d4SBVAsoyb6Cx2ZA/lqhnRUbH2bEDvoxL353GmrNUkQ g5QwP8GOHsFA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 10:41:03 -0700 IronPort-SDR: pnCR2InNDGUo2sFiK4GC2fO9n145y8CrG4QBXdPY6YltwcGV6RGWXkXJQ82s2jegJUvm4+etxe hf5jTYRJW++w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,383,1580803200"; d="scan'208";a="400027193" Received: from silpixa00399593.ir.intel.com (HELO silpixa00399593.ger.corp.intel.com) ([10.237.223.21]) by orsmga004.jf.intel.com with ESMTP; 14 Apr 2020 10:41:03 -0700 From: Pablo de Lara To: declan.doherty@intel.com Cc: dev@dpdk.org, akhil.goyal@nxp.com, Pablo de Lara Date: Tue, 14 Apr 2020 18:40:55 +0100 Message-Id: <1586886056-221547-2-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1586886056-221547-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1586860539-209075-1-git-send-email-pablo.de.lara.guarch@intel.com> <1586886056-221547-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v3 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 --- app/test/test_cryptodev_blockcipher.c | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c index 2ff7fc9..3fb1274 100644 --- a/app/test/test_cryptodev_blockcipher.c +++ b/app/test/test_cryptodev_blockcipher.c @@ -21,6 +21,47 @@ #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; + 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; + + 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; + + 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, @@ -144,6 +185,14 @@ 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"); + return 0; + } + /* preparing data */ if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) buf_len += digest_len; From patchwork Tue Apr 14 17:40:56 2020 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: 68437 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 07C1BA0577; Tue, 14 Apr 2020 19:41:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 506731D444; Tue, 14 Apr 2020 19:41:09 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id CF9751D425 for ; Tue, 14 Apr 2020 19:41:06 +0200 (CEST) IronPort-SDR: 8sT8go7t5K1+qT+eIQln2xsQIA+0pJbxCyU1HNJQ5/BjeHiV4CK0B7y7/cCrKWJdvp7ELa16Mh vv3M+Unx69Ug== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 10:41:05 -0700 IronPort-SDR: 7uNTsl7UBcOBJPDFN7qhYk3nEzOwJqGfnHXolbRS8+bKKcLWwCSIKgyDrDq1BvaKcV/9zIuXB3 0z3L6X1S1M1A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,383,1580803200"; d="scan'208";a="400027204" Received: from silpixa00399593.ir.intel.com (HELO silpixa00399593.ger.corp.intel.com) ([10.237.223.21]) by orsmga004.jf.intel.com with ESMTP; 14 Apr 2020 10:41:05 -0700 From: Pablo de Lara To: declan.doherty@intel.com Cc: dev@dpdk.org, akhil.goyal@nxp.com, Pablo de Lara Date: Tue, 14 Apr 2020 18:40:56 +0100 Message-Id: <1586886056-221547-3-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1586886056-221547-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1586860539-209075-1-git-send-email-pablo.de.lara.guarch@intel.com> <1586886056-221547-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v3 2/2] test/crypto: do not check for internal PMD information 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" Now that capabilities are checked to see if an algorithm is supported by a device, there is no need to check for a specific version of a library used in a PMD. Signed-off-by: Pablo de Lara Acked-by: Adam Dybkowski --- app/test/test_cryptodev_hash_test_vectors.h | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h index cff2831..2ed077f 100644 --- a/app/test/test_cryptodev_hash_test_vectors.h +++ b/app/test/test_cryptodev_hash_test_vectors.h @@ -9,11 +9,6 @@ #include #endif -#if !defined(IMB_VERSION_NUM) -#define IMB_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) -#define IMB_VERSION_NUM IMB_VERSION(0, 49, 0) -#endif - static const uint8_t plaintext_hash[] = { "What a lousy earth! He wondered how many people " "were destitute that same night even in his own " @@ -462,9 +457,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_MVSAM | -#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0) BLOCKCIPHER_TEST_TARGET_PMD_MB | -#endif BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2 }, @@ -475,9 +468,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_MVSAM | -#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0) BLOCKCIPHER_TEST_TARGET_PMD_MB | -#endif BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2 }, @@ -542,9 +533,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_MVSAM | -#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0) BLOCKCIPHER_TEST_TARGET_PMD_MB | -#endif BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2 }, @@ -555,9 +544,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_MVSAM | -#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0) BLOCKCIPHER_TEST_TARGET_PMD_MB | -#endif BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2 }, @@ -598,9 +585,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_MVSAM | -#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0) BLOCKCIPHER_TEST_TARGET_PMD_MB | -#endif BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2 }, @@ -611,9 +596,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_MVSAM | -#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0) BLOCKCIPHER_TEST_TARGET_PMD_MB | -#endif BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2 }, @@ -656,9 +639,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_MVSAM | -#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0) BLOCKCIPHER_TEST_TARGET_PMD_MB | -#endif BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2 }, @@ -669,9 +650,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_MVSAM | -#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0) BLOCKCIPHER_TEST_TARGET_PMD_MB | -#endif BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2 }, @@ -714,9 +693,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_MVSAM | -#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0) BLOCKCIPHER_TEST_TARGET_PMD_MB | -#endif BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX }, { @@ -726,9 +703,7 @@ static const struct blockcipher_test_case hash_test_cases[] = { .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | BLOCKCIPHER_TEST_TARGET_PMD_CCP | BLOCKCIPHER_TEST_TARGET_PMD_MVSAM | -#if IMB_VERSION_NUM >= IMB_VERSION(0, 52, 0) BLOCKCIPHER_TEST_TARGET_PMD_MB | -#endif BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX | BLOCKCIPHER_TEST_TARGET_PMD_OCTEONTX2 },