From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: declan.doherty@intel.com, akhil.goyal@nxp.com,
roy.fan.zhang@intel.com, thomas@monjalon.net
Cc: dev@dpdk.org, Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH v2 1/2] test/crypto: add capability check
Date: Tue, 14 Apr 2020 11:35:38 +0100 [thread overview]
Message-ID: <1586860539-209075-1-git-send-email-pablo.de.lara.guarch@intel.com> (raw)
In-Reply-To: <1586859760-207446-1-git-send-email-pablo.de.lara.guarch@intel.com>
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 <pablo.de.lara.guarch@intel.com>
---
v2:
- Fixed checkpatch issues
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..9c218e5 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,
@@ -112,6 +153,14 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
nb_segs = 3;
}
+ /* Check if PMD is capable of performing that test */
+ if (verify_algo_support(t, dev_id, digest_len) < 0) {
+ RTE_LOG(DEBUG, USER1,
+ "Device is not capable of performing this algorithm."
+ "Test Skipped.\n");
+ return 0;
+ }
+
if (tdata->cipher_key.len)
memcpy(cipher_key, tdata->cipher_key.data,
tdata->cipher_key.len);
--
2.7.5
next prev parent reply other threads:[~2020-04-14 10:35 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 10:22 [dpdk-dev] [PATCH " Pablo de Lara
2020-04-14 10:22 ` [dpdk-dev] [PATCH 2/2] test/crypto: do not check for IMB_VERSION_NUM Pablo de Lara
2020-04-14 10:34 ` Thomas Monjalon
2020-04-14 17:22 ` De Lara Guarch, Pablo
2020-04-14 17:48 ` Thomas Monjalon
2020-04-22 9:16 ` Thomas Monjalon
2020-04-22 9:43 ` Akhil Goyal
2020-04-22 10:56 ` Thomas Monjalon
2020-04-15 10:28 ` Dybkowski, AdamX
2020-04-14 10:35 ` Pablo de Lara [this message]
2020-04-14 10:35 ` [dpdk-dev] [PATCH v2 " Pablo de Lara
2020-04-15 10:30 ` Dybkowski, AdamX
2020-04-14 17:40 ` [dpdk-dev] [PATCH v3 0/2] Crypto test refactoring (first phase) Pablo de Lara
2020-04-14 17:40 ` [dpdk-dev] [PATCH v3 1/2] test/crypto: add capability check Pablo de Lara
2020-04-15 10:31 ` Dybkowski, AdamX
2020-04-16 11:15 ` De Lara Guarch, Pablo
2020-04-14 17:40 ` [dpdk-dev] [PATCH v3 2/2] test/crypto: do not check for internal PMD information Pablo de Lara
2020-04-15 10:30 ` Dybkowski, AdamX
2020-04-16 9:08 ` [dpdk-dev] [PATCH v4 0/2] Crypto test refactoring (first phase) Pablo de Lara
2020-04-16 9:08 ` [dpdk-dev] [PATCH v4 1/2] test/crypto: add capability check Pablo de Lara
2020-04-16 15:35 ` Ruifeng Wang
2020-04-16 16:26 ` Trahe, Fiona
2020-04-16 16:44 ` De Lara Guarch, Pablo
2020-04-16 9:08 ` [dpdk-dev] [PATCH v4 2/2] test/crypto: do not check for internal PMD information Pablo de Lara
2020-04-16 15:35 ` Ruifeng Wang
2020-04-16 17:24 ` [dpdk-dev] [PATCH v5 0/2] Crypto test refactoring (first phase) Pablo de Lara
2020-04-16 17:24 ` [dpdk-dev] [PATCH v5 1/2] test/crypto: add capability check Pablo de Lara
2020-04-16 17:53 ` Trahe, Fiona
2020-04-16 17:24 ` [dpdk-dev] [PATCH v5 2/2] test/crypto: do not check for internal PMD information Pablo de Lara
2020-04-16 17:53 ` Trahe, Fiona
2020-04-19 21:15 ` [dpdk-dev] [PATCH v5 0/2] Crypto test refactoring (first phase) Akhil Goyal
2020-04-15 10:29 ` [dpdk-dev] [PATCH v2 1/2] test/crypto: add capability check Dybkowski, AdamX
2020-04-15 9:16 ` [dpdk-dev] [PATCH " Dybkowski, AdamX
2020-04-15 9:23 ` Dybkowski, AdamX
2020-04-15 10:29 ` Dybkowski, AdamX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1586860539-209075-1-git-send-email-pablo.de.lara.guarch@intel.com \
--to=pablo.de.lara.guarch@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=roy.fan.zhang@intel.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).