DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] test/ipsec: fix return values
@ 2021-01-25  8:15 Gagandeep Singh
  2021-01-25  8:15 ` [dpdk-dev] [PATCH 2/2] crypto/dpaa2_sec: fix if check on memory allocation Gagandeep Singh
  2021-01-27 19:54 ` [dpdk-dev] [PATCH 1/2] test/ipsec: fix return values Akhil Goyal
  0 siblings, 2 replies; 5+ messages in thread
From: Gagandeep Singh @ 2021-01-25  8:15 UTC (permalink / raw)
  To: dev, akhil.goyal; +Cc: thomas, Gagandeep Singh, konstantin.ananyev

During SA creation, if the required algorithm is not supported,
drivers can return ENOTSUP. But in most of the IPsec test cases,
if the SA creation does not success, it just returns
TEST_FAILED.

This patch fixes this issue by returning the actual return values
from the driver to the application, so that it can make decisions
whether the test case is passed, failed or unsupported.

Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test")
Cc: konstantin.ananyev@intel.com

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 app/test/test_ipsec.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
index 9ad07a1..d18220a 100644
--- a/app/test/test_ipsec.c
+++ b/app/test/test_ipsec.c
@@ -744,7 +744,7 @@ create_sa(enum rte_security_session_action_type action_type,
 	ut->ss[j].type = action_type;
 	rc = create_session(ut, &ts->qp_conf, ts->valid_dev, j);
 	if (rc != 0)
-		return TEST_FAILED;
+		return rc;
 
 	rc = rte_ipsec_sa_init(ut->ss[j].sa, &ut->sa_prm, sz);
 	rc = (rc > 0 && (uint32_t)rc <= sz) ? 0 : -EINVAL;
@@ -1247,7 +1247,7 @@ test_ipsec_crypto_inb_burst_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate test mbuf data */
@@ -1349,7 +1349,7 @@ test_ipsec_crypto_outb_burst_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate input mbuf data */
@@ -1458,7 +1458,7 @@ test_ipsec_inline_crypto_inb_burst_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate inbound mbuf data */
@@ -1536,7 +1536,7 @@ test_ipsec_inline_proto_inb_burst_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate inbound mbuf data */
@@ -1644,7 +1644,7 @@ test_ipsec_inline_crypto_outb_burst_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate test mbuf data */
@@ -1722,7 +1722,7 @@ test_ipsec_inline_proto_outb_burst_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate test mbuf data */
@@ -1798,7 +1798,7 @@ test_ipsec_lksd_proto_inb_burst_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate test mbuf data */
@@ -1911,7 +1911,7 @@ test_ipsec_replay_inb_inside_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate inbound mbuf data */
@@ -2004,7 +2004,7 @@ test_ipsec_replay_inb_outside_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate test mbuf data */
@@ -2104,7 +2104,7 @@ test_ipsec_replay_inb_repeat_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate test mbuf data */
@@ -2205,7 +2205,7 @@ test_ipsec_replay_inb_inside_burst_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate inbound mbuf data */
@@ -2338,7 +2338,7 @@ test_ipsec_crypto_inb_burst_2sa_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa 0 failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* create second rte_ipsec_sa */
@@ -2348,7 +2348,7 @@ test_ipsec_crypto_inb_burst_2sa_null_null(int i)
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa 1 failed, cfg %d\n", i);
 		destroy_sa(0);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate test mbuf data */
@@ -2424,7 +2424,7 @@ test_ipsec_crypto_inb_burst_2sa_4grp_null_null(int i)
 			test_cfg[i].replay_win_sz, test_cfg[i].flags, 0);
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa 0 failed, cfg %d\n", i);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* create second rte_ipsec_sa */
@@ -2434,7 +2434,7 @@ test_ipsec_crypto_inb_burst_2sa_4grp_null_null(int i)
 	if (rc != 0) {
 		RTE_LOG(ERR, USER1, "create_sa 1 failed, cfg %d\n", i);
 		destroy_sa(0);
-		return TEST_FAILED;
+		return rc;
 	}
 
 	/* Generate test mbuf data */
-- 
2.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/2] crypto/dpaa2_sec: fix if check on memory allocation
  2021-01-25  8:15 [dpdk-dev] [PATCH 1/2] test/ipsec: fix return values Gagandeep Singh
@ 2021-01-25  8:15 ` Gagandeep Singh
  2021-01-27 19:53   ` Akhil Goyal
  2021-01-27 19:54 ` [dpdk-dev] [PATCH 1/2] test/ipsec: fix return values Akhil Goyal
  1 sibling, 1 reply; 5+ messages in thread
From: Gagandeep Singh @ 2021-01-25  8:15 UTC (permalink / raw)
  To: dev, akhil.goyal; +Cc: thomas, Gagandeep Singh

When key length is 0, zmalloc will return NULL pointor
and in that case it should not return NOMEM.
So in this patch, adding a check on key length.

Fixes: 8d1f3a5d751b ("crypto/dpaa2_sec: support crypto operation")
Cc: akhil.goyal@nxp.com
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index cab79db..05b194c 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -1842,7 +1842,7 @@ dpaa2_sec_cipher_init(struct rte_cryptodev *dev,
 	session->ctxt_type = DPAA2_SEC_CIPHER;
 	session->cipher_key.data = rte_zmalloc(NULL, xform->cipher.key.length,
 			RTE_CACHE_LINE_SIZE);
-	if (session->cipher_key.data == NULL) {
+	if (session->cipher_key.data == NULL && xform->cipher.key.length > 0) {
 		DPAA2_SEC_ERR("No Memory for cipher key");
 		rte_free(priv);
 		return -ENOMEM;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] crypto/dpaa2_sec: fix if check on memory allocation
  2021-01-25  8:15 ` [dpdk-dev] [PATCH 2/2] crypto/dpaa2_sec: fix if check on memory allocation Gagandeep Singh
@ 2021-01-27 19:53   ` Akhil Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2021-01-27 19:53 UTC (permalink / raw)
  To: Gagandeep Singh, dev; +Cc: thomas, Gagandeep Singh

> When key length is 0, zmalloc will return NULL pointor
> and in that case it should not return NOMEM.
> So in this patch, adding a check on key length.
> 
> Fixes: 8d1f3a5d751b ("crypto/dpaa2_sec: support crypto operation")
> Cc: akhil.goyal@nxp.com
> ---
Signed-off missing. Will add it while merging in crypto tree.

Acked-by: Akhil Goyal <akhil.goyal@nxp.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] test/ipsec: fix return values
  2021-01-25  8:15 [dpdk-dev] [PATCH 1/2] test/ipsec: fix return values Gagandeep Singh
  2021-01-25  8:15 ` [dpdk-dev] [PATCH 2/2] crypto/dpaa2_sec: fix if check on memory allocation Gagandeep Singh
@ 2021-01-27 19:54 ` Akhil Goyal
  2021-01-27 20:00   ` Akhil Goyal
  1 sibling, 1 reply; 5+ messages in thread
From: Akhil Goyal @ 2021-01-27 19:54 UTC (permalink / raw)
  To: Gagandeep Singh, dev; +Cc: thomas, Gagandeep Singh, konstantin.ananyev

> During SA creation, if the required algorithm is not supported,
> drivers can return ENOTSUP. But in most of the IPsec test cases,
> if the SA creation does not success, it just returns
> TEST_FAILED.
> 
> This patch fixes this issue by returning the actual return values
> from the driver to the application, so that it can make decisions
> whether the test case is passed, failed or unsupported.
> 
> Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test")
> Cc: konstantin.ananyev@intel.com
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>

Cc: stable@dpdk.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] test/ipsec: fix return values
  2021-01-27 19:54 ` [dpdk-dev] [PATCH 1/2] test/ipsec: fix return values Akhil Goyal
@ 2021-01-27 20:00   ` Akhil Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2021-01-27 20:00 UTC (permalink / raw)
  To: Gagandeep Singh, dev; +Cc: thomas, Gagandeep Singh, konstantin.ananyev, stable

> Subject: RE: [PATCH 1/2] test/ipsec: fix return values
> 
> > During SA creation, if the required algorithm is not supported,
> > drivers can return ENOTSUP. But in most of the IPsec test cases,
> > if the SA creation does not success, it just returns
> > TEST_FAILED.
> >
> > This patch fixes this issue by returning the actual return values
> > from the driver to the application, so that it can make decisions
> > whether the test case is passed, failed or unsupported.
> >
> > Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test")
> > Cc: konstantin.ananyev@intel.com
> >
> > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
> 
> Cc: stable@dpdk.org

Series Applied to dpdk-next-crypto

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-27 20:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25  8:15 [dpdk-dev] [PATCH 1/2] test/ipsec: fix return values Gagandeep Singh
2021-01-25  8:15 ` [dpdk-dev] [PATCH 2/2] crypto/dpaa2_sec: fix if check on memory allocation Gagandeep Singh
2021-01-27 19:53   ` Akhil Goyal
2021-01-27 19:54 ` [dpdk-dev] [PATCH 1/2] test/ipsec: fix return values Akhil Goyal
2021-01-27 20:00   ` Akhil Goyal

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git