DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ayuj Verma <ayverma@marvell.com>
To: <akhil.goyal@nxp.com>, <arkadiuszx.kusztal@intel.com>,
	<fiona.trahe@intel.com>
Cc: <shallyv@marvell.com>, <ssahu@marvell.com>,
	<kkotamarthy@marvell.com>, <adesai@marvell.com>, <dev@dpdk.org>,
	Ayuj Verma <ayverma@marvell.com>
Subject: [dpdk-dev] [PATCH v3] app/test: replace TEST_SKIPPED with -ENOTSUP
Date: Thu, 25 Apr 2019 00:58:26 +0530	[thread overview]
Message-ID: <1556134106-15245-2-git-send-email-ayverma@marvell.com> (raw)
In-Reply-To: <1556134106-15245-1-git-send-email-ayverma@marvell.com>

- Return -ENOTSUP for unsupported tests
- add NULL check for rte_cryptodev_asym_capability_get()
- Typo correction

Signed-off-by: Ayuj Verma <ayverma@marvell.com>
Signed-off-by: Shally Verma <shallyv@marvell.com>
---
 app/test/test_cryptodev_asym.c | 45 ++++++++++++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index d2efce9..fc92d3d 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -119,6 +119,18 @@ struct test_cases_array {
 
 	int status = TEST_SUCCESS;
 
+	xform_tc.next = NULL;
+	xform_tc.xform_type = data_tc->modex.xform_type;
+
+	cap_idx.type = xform_tc.xform_type;
+	capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
+
+	if (capability == NULL) {
+		RTE_LOG(INFO, USER1,
+			"Device doesn't support MODEX. Test Skipped\n");
+		return -ENOTSUP;
+	}
+
 	/* Generate crypto op data structure */
 	op = rte_crypto_op_alloc(ts_params->op_mpool,
 		RTE_CRYPTO_OP_TYPE_ASYMMETRIC);
@@ -133,11 +145,6 @@ struct test_cases_array {
 	}
 
 	asym_op = op->asym;
-	xform_tc.next = NULL;
-	xform_tc.xform_type = data_tc->modex.xform_type;
-
-	cap_idx.type = xform_tc.xform_type;
-	capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
 
 	switch (xform_tc.xform_type) {
 	case RTE_CRYPTO_ASYM_XFORM_MODEX:
@@ -352,7 +359,7 @@ struct test_cases_array {
 		RTE_LOG(INFO, USER1,
 				"Device doesn't support sign op with "
 				"exponent key type. Test Skipped\n");
-		return TEST_SKIPPED;
+		return -ENOTSUP;
 	}
 
 	sess = rte_cryptodev_asym_session_create(sess_mpool);
@@ -498,7 +505,7 @@ struct test_cases_array {
 		RTE_LOG(INFO, USER1,
 				"Device doesn't support sign op with "
 				"exponent key type. Test Skipped\n");
-		return TEST_SKIPPED;
+		return -ENOTSUP;
 	}
 
 	sess = rte_cryptodev_asym_session_create(sess_mpool);
@@ -1260,7 +1267,7 @@ static inline void print_asym_capa(
 	if (rte_cryptodev_asym_get_xform_enum(
 		&modinv_xform.xform_type, "modinv") < 0) {
 		RTE_LOG(ERR, USER1,
-				 "Invalid ASYNC algorithm specified\n");
+				 "Invalid ASYM algorithm specified\n");
 		return -1;
 	}
 
@@ -1268,12 +1275,18 @@ static inline void print_asym_capa(
 	capability = rte_cryptodev_asym_capability_get(dev_id,
 					&cap_idx);
 
+	if (capability == NULL) {
+		RTE_LOG(INFO, USER1,
+			"Device doesn't support MOD INV. Test Skipped\n");
+		return -ENOTSUP;
+	}
+
 	if (rte_cryptodev_asym_xform_capability_check_modlen(
 		capability,
 		modinv_xform.modinv.modulus.length)) {
 		RTE_LOG(ERR, USER1,
-				 "Invalid MODULOUS length specified\n");
-				return -1;
+				 "Invalid MODULUS length specified\n");
+				return -ENOTSUP;
 		}
 
 	sess = rte_cryptodev_asym_session_create(sess_mpool);
@@ -1379,7 +1392,7 @@ static inline void print_asym_capa(
 		"modexp")
 		< 0) {
 		RTE_LOG(ERR, USER1,
-				"Invalid ASYNC algorithm specified\n");
+				"Invalid ASYM algorithm specified\n");
 		return -1;
 	}
 
@@ -1387,11 +1400,17 @@ static inline void print_asym_capa(
 	cap_idx.type = modex_xform.xform_type;
 	capability = rte_cryptodev_asym_capability_get(dev_id, &cap_idx);
 
+	if (capability == NULL) {
+		RTE_LOG(INFO, USER1,
+			"Device doesn't support MOD EXP. Test Skipped\n");
+		return -ENOTSUP;
+	}
+
 	if (rte_cryptodev_asym_xform_capability_check_modlen(
 			capability, modex_xform.modex.modulus.length)) {
 		RTE_LOG(ERR, USER1,
-				"Invalid MODULOUS length specified\n");
-				return -1;
+				"Invalid MODULUS length specified\n");
+				return -ENOTSUP;
 		}
 
 	/* generate crypto op data structure */
-- 
1.8.3.1

  parent reply	other threads:[~2019-04-24 19:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 19:28 [dpdk-dev] [PATCH v3] fix return value for skipped tests Ayuj Verma
2019-04-24 19:28 ` Ayuj Verma
2019-04-24 19:28 ` Ayuj Verma [this message]
2019-04-24 19:28   ` [dpdk-dev] [PATCH v3] app/test: replace TEST_SKIPPED with -ENOTSUP Ayuj Verma
2019-04-25 10:26   ` Trahe, Fiona
2019-04-25 10:26     ` Trahe, Fiona
2019-05-04 20:54   ` Thomas Monjalon
2019-05-04 20:54     ` Thomas Monjalon
2019-05-09  8:53     ` Akhil Goyal
2019-05-09  8:53       ` Akhil Goyal
2019-05-09 11:24       ` Ayuj Verma
2019-05-09 11:24         ` Ayuj Verma

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=1556134106-15245-2-git-send-email-ayverma@marvell.com \
    --to=ayverma@marvell.com \
    --cc=adesai@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=kkotamarthy@marvell.com \
    --cc=shallyv@marvell.com \
    --cc=ssahu@marvell.com \
    /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).