DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto/dpaa_sec: detach queues in session destroy
@ 2019-09-02 12:26 Akhil Goyal
  2019-09-19 15:06 ` Akhil Goyal
  0 siblings, 1 reply; 2+ messages in thread
From: Akhil Goyal @ 2019-09-02 12:26 UTC (permalink / raw)
  To: dev; +Cc: hemant.agrawal, Akhil Goyal

crypto queues need to be detached while session destroy
so that they can be reused.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 drivers/crypto/dpaa_sec/dpaa_sec.c | 48 ++++++++++++++----------------
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 55a47640a..fd5b24840 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -2109,33 +2109,38 @@ dpaa_sec_sym_session_configure(struct rte_cryptodev *dev,
 	return 0;
 }
 
+static inline void
+free_session_memory(struct rte_cryptodev *dev, dpaa_sec_session *s)
+{
+	struct dpaa_sec_dev_private *qi = dev->data->dev_private;
+	struct rte_mempool *sess_mp = rte_mempool_from_obj((void *)s);
+	uint8_t i;
+
+	for (i = 0; i < MAX_DPAA_CORES; i++) {
+		if (s->inq[i])
+			dpaa_sec_detach_rxq(qi, s->inq[i]);
+		s->inq[i] = NULL;
+		s->qp[i] = NULL;
+	}
+	rte_free(s->cipher_key.data);
+	rte_free(s->auth_key.data);
+	memset(s, 0, sizeof(dpaa_sec_session));
+	rte_mempool_put(sess_mp, (void *)s);
+}
+
 /** Clear the memory of session so it doesn't leave key material behind */
 static void
 dpaa_sec_sym_session_clear(struct rte_cryptodev *dev,
 		struct rte_cryptodev_sym_session *sess)
 {
-	struct dpaa_sec_dev_private *qi = dev->data->dev_private;
-	uint8_t index = dev->driver_id, i;
-	void *sess_priv = get_sym_session_private_data(sess, index);
-
 	PMD_INIT_FUNC_TRACE();
-
+	uint8_t index = dev->driver_id;
+	void *sess_priv = get_sym_session_private_data(sess, index);
 	dpaa_sec_session *s = (dpaa_sec_session *)sess_priv;
 
 	if (sess_priv) {
-		struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
-		for (i = 0; i < MAX_DPAA_CORES; i++) {
-			if (s->inq[i])
-				dpaa_sec_detach_rxq(qi, s->inq[i]);
-			s->inq[i] = NULL;
-			s->qp[i] = NULL;
-		}
-		rte_free(s->cipher_key.data);
-		rte_free(s->auth_key.data);
-		memset(s, 0, sizeof(dpaa_sec_session));
+		free_session_memory(dev, s);
 		set_sym_session_private_data(sess, index, NULL);
-		rte_mempool_put(sess_mp, sess_priv);
 	}
 }
 
@@ -2450,22 +2455,15 @@ dpaa_sec_security_session_destroy(void *dev __rte_unused,
 {
 	PMD_INIT_FUNC_TRACE();
 	void *sess_priv = get_sec_session_private_data(sess);
-
 	dpaa_sec_session *s = (dpaa_sec_session *)sess_priv;
 
 	if (sess_priv) {
-		struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
-
-		rte_free(s->cipher_key.data);
-		rte_free(s->auth_key.data);
-		memset(s, 0, sizeof(dpaa_sec_session));
+		free_session_memory((struct rte_cryptodev *)dev, s);
 		set_sec_session_private_data(sess, NULL);
-		rte_mempool_put(sess_mp, sess_priv);
 	}
 	return 0;
 }
 
-
 static int
 dpaa_sec_dev_configure(struct rte_cryptodev *dev,
 		       struct rte_cryptodev_config *config __rte_unused)
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] crypto/dpaa_sec: detach queues in session destroy
  2019-09-02 12:26 [dpdk-dev] [PATCH] crypto/dpaa_sec: detach queues in session destroy Akhil Goyal
@ 2019-09-19 15:06 ` Akhil Goyal
  0 siblings, 0 replies; 2+ messages in thread
From: Akhil Goyal @ 2019-09-19 15:06 UTC (permalink / raw)
  To: Akhil Goyal, dev; +Cc: Hemant Agrawal


> crypto queues need to be detached while session destroy
> so that they can be reused.
> 
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> ---
Applied to dpdk-next-crypto

Thanks.


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

end of thread, other threads:[~2019-09-19 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02 12:26 [dpdk-dev] [PATCH] crypto/dpaa_sec: detach queues in session destroy Akhil Goyal
2019-09-19 15:06 ` 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).