From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com
Subject: [dpdk-dev] [PATCH 03/10] crypto/dpaa_sec: add LOCK before Rx HW queue attach
Date: Thu, 30 Aug 2018 11:20:58 +0530 [thread overview]
Message-ID: <1535608265-13323-4-git-send-email-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <1535608265-13323-1-git-send-email-hemant.agrawal@nxp.com>
From: Akhil Goyal <akhil.goyal@nxp.com>
This is to safegaurd as the session config can be done from multi-threads.
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
drivers/crypto/dpaa_sec/dpaa_sec.c | 6 ++++++
drivers/crypto/dpaa_sec/dpaa_sec.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 95f317d..35e4e3e 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -23,6 +23,7 @@
#include <rte_mbuf.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
+#include <rte_spinlock.h>
#include <fsl_usd.h>
#include <fsl_qman.h>
@@ -1810,7 +1811,9 @@ dpaa_sec_set_session_parameters(struct rte_cryptodev *dev,
return -EINVAL;
}
session->ctx_pool = internals->ctx_pool;
+ rte_spinlock_lock(&internals->lock);
session->inq = dpaa_sec_attach_rxq(internals);
+ rte_spinlock_unlock(&internals->lock);
if (session->inq == NULL) {
DPAA_SEC_ERR("unable to attach sec queue");
goto err1;
@@ -2037,7 +2040,9 @@ dpaa_sec_set_ipsec_session(__rte_unused struct rte_cryptodev *dev,
} else
goto out;
session->ctx_pool = internals->ctx_pool;
+ rte_spinlock_lock(&internals->lock);
session->inq = dpaa_sec_attach_rxq(internals);
+ rte_spinlock_unlock(&internals->lock);
if (session->inq == NULL) {
DPAA_SEC_ERR("unable to attach sec queue");
goto out;
@@ -2288,6 +2293,7 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev)
security_instance->sess_cnt = 0;
cryptodev->security_ctx = security_instance;
+ rte_spinlock_init(&internals->lock);
for (i = 0; i < internals->max_nb_queue_pairs; i++) {
/* init qman fq for queue pair */
qp = &internals->qps[i];
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h
index ac6c00a..e923942 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.h
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.h
@@ -150,6 +150,7 @@ struct dpaa_sec_dev_private {
unsigned char inq_attach[RTE_DPAA_MAX_RX_QUEUE];
unsigned int max_nb_queue_pairs;
unsigned int max_nb_sessions;
+ rte_spinlock_t lock;
};
#define MAX_SG_ENTRIES 16
--
2.7.4
next prev parent reply other threads:[~2018-08-30 5:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-30 5:50 [dpdk-dev] [PATCH 00/10] crypto: DPAA and DPAA2_SEC enhancements Hemant Agrawal
2018-08-30 5:50 ` [dpdk-dev] [PATCH 01/10] crypto/dpaa2_sec: update the flib RTA to latest Hemant Agrawal
2018-08-30 5:50 ` [dpdk-dev] [PATCH 02/10] crypto/dpaa_sec: session reset before init Hemant Agrawal
2018-08-30 5:50 ` Hemant Agrawal [this message]
2018-08-30 5:50 ` [dpdk-dev] [PATCH 04/10] crypto/dpaa_sec: session qp should match with given qp Hemant Agrawal
2018-08-30 5:51 ` [dpdk-dev] [PATCH 05/10] crypto/dpaa_sec: reduce the number of QP per device Hemant Agrawal
2018-08-30 5:51 ` [dpdk-dev] [PATCH 06/10] crypto/dpaa_sec: enable sequence no rollover Hemant Agrawal
2018-08-30 5:51 ` [dpdk-dev] [PATCH 07/10] crypto/dpaa2_sec: " Hemant Agrawal
2018-08-30 5:51 ` [dpdk-dev] [PATCH 08/10] crypto/dpaa2_sec: add out of place crypto support Hemant Agrawal
2018-08-30 5:51 ` [dpdk-dev] [PATCH 09/10] crypto/dpaa2_sec: multi algo support for ipsec session Hemant Agrawal
2018-08-30 5:51 ` [dpdk-dev] [PATCH 10/10] crypto/dpaa_sec: ipsec offload add null algo support Hemant Agrawal
2018-09-26 12:27 ` [dpdk-dev] [PATCH 00/10] crypto: DPAA and DPAA2_SEC enhancements Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1535608265-13323-4-git-send-email-hemant.agrawal@nxp.com \
--to=hemant.agrawal@nxp.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).