DPDK patches and discussions
 help / color / Atom feed
* [dpdk-dev] [PATCH] crypto/octeontx2: fix sessionless code
@ 2020-09-08  9:19 Ankur Dwivedi
  2020-09-08 11:00 ` Anoob Joseph
  2020-09-18 13:45 ` [dpdk-dev] [PATCH v2] " Ankur Dwivedi
  0 siblings, 2 replies; 5+ messages in thread
From: Ankur Dwivedi @ 2020-09-08  9:19 UTC (permalink / raw)
  To: dev; +Cc: anoobj, ktejasree, akhil.goyal, Ankur Dwivedi

A temporary session is created for sessionless crypto operations.
rte_cryptodev_sym_session_create() should be used for creating the
temporary session as it initializes the session structure in the
correct way. Also the session should be set to 0 before freeing it.

Fixes: 17ac2a72191b ("crypto/octeontx2: add enqueue/dequeue ops")

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index 9d51b17dd..ccf566d5f 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -648,8 +648,8 @@ otx2_cpt_enqueue_sym_sessless(struct otx2_cpt_qp *qp, struct rte_crypto_op *op,
 	int ret;
 
 	/* Create temporary session */
-
-	if (rte_mempool_get(qp->sess_mp, (void **)&sess))
+	sess = rte_cryptodev_sym_session_create(qp->sess_mp);
+	if (sess == NULL)
 		return -ENOMEM;
 
 	ret = sym_session_configure(driver_id, sym_op->xform, sess,
@@ -894,6 +894,9 @@ otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 		if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
 			sym_session_clear(otx2_cryptodev_driver_id,
 					  cop->sym->session);
+			memset(cop->sym->session, 0,
+			rte_cryptodev_sym_get_existing_header_session_size(
+				cop->sym->session));
 			rte_mempool_put(qp->sess_mp, cop->sym->session);
 			cop->sym->session = NULL;
 		}
-- 
2.28.0


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

* Re: [dpdk-dev] [PATCH] crypto/octeontx2: fix sessionless code
  2020-09-08  9:19 [dpdk-dev] [PATCH] crypto/octeontx2: fix sessionless code Ankur Dwivedi
@ 2020-09-08 11:00 ` Anoob Joseph
  2020-09-18 13:45 ` [dpdk-dev] [PATCH v2] " Ankur Dwivedi
  1 sibling, 0 replies; 5+ messages in thread
From: Anoob Joseph @ 2020-09-08 11:00 UTC (permalink / raw)
  To: Ankur Dwivedi, dev; +Cc: Tejasree Kondoj, akhil.goyal, Ankur Dwivedi


> A temporary session is created for sessionless crypto operations.
> rte_cryptodev_sym_session_create() should be used for creating the
> temporary session as it initializes the session structure in the correct way.
> Also the session should be set to 0 before freeing it.
> 
> Fixes: 17ac2a72191b ("crypto/octeontx2: add enqueue/dequeue ops")
> 
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>

Acked-by: Anoob Joseph <anoobj@marvell.com>

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

* [dpdk-dev] [PATCH v2] crypto/octeontx2: fix sessionless code
  2020-09-08  9:19 [dpdk-dev] [PATCH] crypto/octeontx2: fix sessionless code Ankur Dwivedi
  2020-09-08 11:00 ` Anoob Joseph
@ 2020-09-18 13:45 ` " Ankur Dwivedi
  2020-09-22 19:49   ` Akhil Goyal
  1 sibling, 1 reply; 5+ messages in thread
From: Ankur Dwivedi @ 2020-09-18 13:45 UTC (permalink / raw)
  To: dev; +Cc: anoobj, ktejasree, akhil.goyal, Ankur Dwivedi

A temporary session is created for sessionless crypto operations.
rte_cryptodev_sym_session_create() should be used for creating the
temporary session as it initializes the session structure in the
correct way. Also the session should be set to 0 before freeing it.

Fixes: 17ac2a72191b ("crypto/octeontx2: add enqueue/dequeue ops")

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
v2:
* Use local variable to hold session size

 drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index 9d51b17dd..707f92562 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -648,8 +648,8 @@ otx2_cpt_enqueue_sym_sessless(struct otx2_cpt_qp *qp, struct rte_crypto_op *op,
 	int ret;
 
 	/* Create temporary session */
-
-	if (rte_mempool_get(qp->sess_mp, (void **)&sess))
+	sess = rte_cryptodev_sym_session_create(qp->sess_mp);
+	if (sess == NULL)
 		return -ENOMEM;
 
 	ret = sym_session_configure(driver_id, sym_op->xform, sess,
@@ -866,6 +866,8 @@ static inline void
 otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 			      uintptr_t *rsp, uint8_t cc)
 {
+	unsigned int sz;
+
 	if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) {
 		if (cop->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
 			if (likely(cc == OTX2_IPSEC_PO_CC_SUCCESS)) {
@@ -894,6 +896,9 @@ otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop,
 		if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) {
 			sym_session_clear(otx2_cryptodev_driver_id,
 					  cop->sym->session);
+			sz = rte_cryptodev_sym_get_existing_header_session_size(
+					cop->sym->session);
+			memset(cop->sym->session, 0, sz);
 			rte_mempool_put(qp->sess_mp, cop->sym->session);
 			cop->sym->session = NULL;
 		}
-- 
2.28.0


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

* Re: [dpdk-dev] [PATCH v2] crypto/octeontx2: fix sessionless code
  2020-09-18 13:45 ` [dpdk-dev] [PATCH v2] " Ankur Dwivedi
@ 2020-09-22 19:49   ` Akhil Goyal
  2020-09-23  5:07     ` Ankur Dwivedi
  0 siblings, 1 reply; 5+ messages in thread
From: Akhil Goyal @ 2020-09-22 19:49 UTC (permalink / raw)
  To: Ankur Dwivedi, dev; +Cc: anoobj, ktejasree

> A temporary session is created for sessionless crypto operations.
> rte_cryptodev_sym_session_create() should be used for creating the
> temporary session as it initializes the session structure in the
> correct way. Also the session should be set to 0 before freeing it.
> 
> Fixes: 17ac2a72191b ("crypto/octeontx2: add enqueue/dequeue ops")
> 
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> ---
> v2:
> * Use local variable to hold session size

Please supersede your previous versions from the patchworks. It creates unnecessary confusion.

Applied to dpdk-next-crypto

Thanks.


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

* Re: [dpdk-dev] [PATCH v2] crypto/octeontx2: fix sessionless code
  2020-09-22 19:49   ` Akhil Goyal
@ 2020-09-23  5:07     ` Ankur Dwivedi
  0 siblings, 0 replies; 5+ messages in thread
From: Ankur Dwivedi @ 2020-09-23  5:07 UTC (permalink / raw)
  To: Akhil Goyal, dev; +Cc: Anoob Joseph, Tejasree Kondoj



>-----Original Message-----
>From: Akhil Goyal <akhil.goyal@nxp.com>
>Sent: Wednesday, September 23, 2020 1:19 AM
>To: Ankur Dwivedi <adwivedi@marvell.com>; dev@dpdk.org
>Cc: Anoob Joseph <anoobj@marvell.com>; Tejasree Kondoj
><ktejasree@marvell.com>
>Subject: [EXT] RE: [PATCH v2] crypto/octeontx2: fix sessionless code
>
>External Email
>
>----------------------------------------------------------------------
>> A temporary session is created for sessionless crypto operations.
>> rte_cryptodev_sym_session_create() should be used for creating the
>> temporary session as it initializes the session structure in the
>> correct way. Also the session should be set to 0 before freeing it.
>>
>> Fixes: 17ac2a72191b ("crypto/octeontx2: add enqueue/dequeue ops")
>>
>> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
>> ---
>> v2:
>> * Use local variable to hold session size
>
>Please supersede your previous versions from the patchworks. It creates
>unnecessary confusion.
Sorry for the confusion. I will supersede previous versions.
>
>Applied to dpdk-next-crypto
>
>Thanks.


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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08  9:19 [dpdk-dev] [PATCH] crypto/octeontx2: fix sessionless code Ankur Dwivedi
2020-09-08 11:00 ` Anoob Joseph
2020-09-18 13:45 ` [dpdk-dev] [PATCH v2] " Ankur Dwivedi
2020-09-22 19:49   ` Akhil Goyal
2020-09-23  5:07     ` Ankur Dwivedi

DPDK patches and discussions

Archives are clonable:
	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


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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