crypto/octeontx2: fix sessionless code
PATCH 1/1 crypto/octeontx2: fix sessionless code
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.
--- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +5 -2
@@ -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 ; }
Signature · 1 line
2.28.0
Quoted 9 lines
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 <[email protected]>
PATCH v2 1/1 crypto/octeontx2: fix sessionless code
In reply to Ankur DwivediA 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.
---
v2:
* Use local variable to hold session size
drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/crypto/octeontx2/otx2_cryptodev_ops.c +7 -2
@@ -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 ; }
Signature · 1 line
2.28.0
Akhil Goyal
AppliedQuoted 11 lines
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 <[email protected]>---
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.
Quoted 20 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Wednesday, September 23, 2020 1:19 AM
To: Ankur Dwivedi <[email protected]>; [email protected]
Cc: Anoob Joseph <[email protected]>; Tejasree Kondoj <[email protected]>
Subject: [EXT] RE: [PATCH v2]crypto/octeontx2: fix sessionless codeExternal Email
----------------------------------------------------------------------
Quoted 7 lines
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")
Quoted 7 lines
Quoted 4 lines
Signed-off-by Ankur Dwivedi <[email protected]>---
v2:
* Use local variable to hold session sizePlease supersede your previous versions from the patchworks. It creates unnecessary confusion.
Sorry for the confusion. I will supersede previous versions.
Quoted 4 lines
Applied to dpdk-next-crypto
Thanks.