DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] crypto/octeontx2: reset feature flags during config
@ 2021-07-02 10:36 Anoob Joseph
  2021-07-02 10:36 ` [dpdk-dev] [PATCH 2/2] crypto/octeontx2: clear session priv mem upon destroy Anoob Joseph
  0 siblings, 1 reply; 3+ messages in thread
From: Anoob Joseph @ 2021-07-02 10:36 UTC (permalink / raw)
  To: Akhil Goyal, Jerin Jacob
  Cc: Anoob Joseph, Ankur Dwivedi, Tejasree Kondoj, dev

Feature flags in dev would be updated during config. On reconfigure, the
field need to be set again to original value.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
 drivers/crypto/octeontx2/otx2_cryptodev.c     | 30 ++++++++++++++++-----------
 drivers/crypto/octeontx2/otx2_cryptodev.h     |  1 +
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c |  4 ++--
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/drivers/crypto/octeontx2/otx2_cryptodev.c b/drivers/crypto/octeontx2/otx2_cryptodev.c
index d4e5ca0..75fb4f9 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev.c
@@ -37,6 +37,23 @@ static struct rte_pci_id pci_id_cpt_table[] = {
 	},
 };
 
+uint64_t
+otx2_cpt_default_ff_get(void)
+{
+	return RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
+	       RTE_CRYPTODEV_FF_HW_ACCELERATED |
+	       RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
+	       RTE_CRYPTODEV_FF_IN_PLACE_SGL |
+	       RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT |
+	       RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
+	       RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |
+	       RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO |
+	       RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT |
+	       RTE_CRYPTODEV_FF_SYM_SESSIONLESS |
+	       RTE_CRYPTODEV_FF_SECURITY |
+	       RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED;
+}
+
 static int
 otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		   struct rte_pci_device *pci_dev)
@@ -113,18 +130,7 @@ otx2_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	if (ret)
 		goto otx2_dev_fini;
 
-	dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
-			     RTE_CRYPTODEV_FF_HW_ACCELERATED |
-			     RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
-			     RTE_CRYPTODEV_FF_IN_PLACE_SGL |
-			     RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT |
-			     RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
-			     RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |
-			     RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO |
-			     RTE_CRYPTODEV_FF_RSA_PRIV_OP_KEY_QT |
-			     RTE_CRYPTODEV_FF_SYM_SESSIONLESS |
-			     RTE_CRYPTODEV_FF_SECURITY |
-			     RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED;
+	dev->feature_flags = otx2_cpt_default_ff_get();
 
 	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
 		otx2_cpt_set_enqdeq_fns(dev);
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev.h b/drivers/crypto/octeontx2/otx2_cryptodev.h
index 7e8c5de..15ecfe4 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev.h
+++ b/drivers/crypto/octeontx2/otx2_cryptodev.h
@@ -57,6 +57,7 @@ extern int otx2_cpt_logtype;
  */
 extern uint8_t otx2_cryptodev_driver_id;
 
+uint64_t otx2_cpt_default_ff_get(void);
 void otx2_cpt_set_enqdeq_fns(struct rte_cryptodev *dev);
 
 #endif /* _OTX2_CRYPTODEV_H_ */
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index 12a2747..bb73a16 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -1115,7 +1115,7 @@ otx2_cpt_dev_config(struct rte_cryptodev *dev,
 		return -EINVAL;
 	}
 
-	dev->feature_flags &= ~conf->ff_disable;
+	dev->feature_flags = otx2_cpt_default_ff_get() & ~conf->ff_disable;
 
 	if (dev->feature_flags & RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) {
 		/* Initialize shared FPM table */
@@ -1227,7 +1227,7 @@ otx2_cpt_dev_info_get(struct rte_cryptodev *dev,
 
 	if (info != NULL) {
 		info->max_nb_queue_pairs = vf->max_queues;
-		info->feature_flags = dev->feature_flags;
+		info->feature_flags = otx2_cpt_default_ff_get();
 		info->capabilities = otx2_cpt_capabilities_get();
 		info->sym.max_nb_sessions = 0;
 		info->driver_id = otx2_cryptodev_driver_id;
-- 
2.7.4


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

* [dpdk-dev] [PATCH 2/2] crypto/octeontx2: clear session priv mem upon destroy
  2021-07-02 10:36 [dpdk-dev] [PATCH 1/2] crypto/octeontx2: reset feature flags during config Anoob Joseph
@ 2021-07-02 10:36 ` Anoob Joseph
  2021-07-07 18:59   ` Akhil Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Anoob Joseph @ 2021-07-02 10:36 UTC (permalink / raw)
  To: Akhil Goyal, Jerin Jacob
  Cc: Anoob Joseph, Ankur Dwivedi, Tejasree Kondoj, dev

During session destroy, clear session private memory.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
 drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
index 3c5686a..a5db400 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
@@ -589,6 +589,8 @@ otx2_crypto_sec_session_destroy(void *device __rte_unused,
 
 	sess_mp = rte_mempool_from_obj(priv);
 
+	memset(priv, 0, sizeof(*priv));
+
 	set_sec_session_private_data(sess, NULL);
 	rte_mempool_put(sess_mp, priv);
 
-- 
2.7.4


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

* Re: [dpdk-dev] [PATCH 2/2] crypto/octeontx2: clear session priv mem upon destroy
  2021-07-02 10:36 ` [dpdk-dev] [PATCH 2/2] crypto/octeontx2: clear session priv mem upon destroy Anoob Joseph
@ 2021-07-07 18:59   ` Akhil Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2021-07-07 18:59 UTC (permalink / raw)
  To: Anoob Joseph, Jerin Jacob Kollanukkaran
  Cc: Anoob Joseph, Ankur Dwivedi, Tejasree Kondoj, dev

> During session destroy, clear session private memory.
> 
> Signed-off-by: Anoob Joseph <anoobj@marvell.com>
> ---
>  drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
> b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
> index 3c5686a..a5db400 100644
> --- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
> +++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c
> @@ -589,6 +589,8 @@ otx2_crypto_sec_session_destroy(void *device
> __rte_unused,
> 
>  	sess_mp = rte_mempool_from_obj(priv);
> 
> +	memset(priv, 0, sizeof(*priv));
> +
>  	set_sec_session_private_data(sess, NULL);
>  	rte_mempool_put(sess_mp, priv);
> 
> --
> 2.7.4
Series applied to dpdk-next-crypto

Thanks.

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

end of thread, other threads:[~2021-07-07 18:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02 10:36 [dpdk-dev] [PATCH 1/2] crypto/octeontx2: reset feature flags during config Anoob Joseph
2021-07-02 10:36 ` [dpdk-dev] [PATCH 2/2] crypto/octeontx2: clear session priv mem upon destroy Anoob Joseph
2021-07-07 18:59   ` Akhil Goyal

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).