From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com, fiona.trahe@intel.com, arkadiuszx.kusztal@intel.com
Subject: [dpdk-dev] [PATCH v2] cryptodev: add function to check if qp was setup
Date: Wed, 24 Jun 2020 16:26:53 +0200 [thread overview]
Message-ID: <20200624142653.16488-1-arkadiuszx.kusztal@intel.com> (raw)
From: Fiona Trahe <fiona.trahe@intel.com>
This patch adds function that can check if queue pair
was already setup. This may be useful when dealing with
multi process approach in cryptodev.
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
---
v2:
- changed return values
- added function to map file
lib/librte_cryptodev/rte_cryptodev.c | 29 ++++++++++++++++++++++++++
lib/librte_cryptodev/rte_cryptodev.h | 17 +++++++++++++++
lib/librte_cryptodev/rte_cryptodev_version.map | 3 +++
3 files changed, 49 insertions(+)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index e37b83a..6f556c3 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1080,6 +1080,35 @@ rte_cryptodev_close(uint8_t dev_id)
}
int
+rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
+{
+ struct rte_cryptodev *dev;
+
+ if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
+ CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+ return -EINVAL;
+ }
+
+ dev = &rte_crypto_devices[dev_id];
+ if (queue_pair_id >= dev->data->nb_queue_pairs) {
+ CDEV_LOG_ERR("Invalid queue_pair_id=%d", queue_pair_id);
+ return -EINVAL;
+ }
+ void **qps = dev->data->queue_pairs;
+
+ if (qps[queue_pair_id]) {
+ CDEV_LOG_DEBUG("qp %d on dev %d is initialised",
+ queue_pair_id, dev_id);
+ return 1;
+ }
+
+ CDEV_LOG_DEBUG("qp %d on dev %d is not initialised",
+ queue_pair_id, dev_id);
+
+ return 0;
+}
+
+int
rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 4aaee73..7b3ebc2 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -727,6 +727,23 @@ rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
/**
+ * Get the status of queue pairs setup on a specific crypto device
+ *
+ * @param dev_id Crypto device identifier.
+ * @param queue_pair_id The index of the queue pairs to set up. The
+ * value must be in the range [0, nb_queue_pair
+ * - 1] previously supplied to
+ * rte_cryptodev_configure().
+ * @return
+ * - 0: qp was not configured
+ * - 1: qp was configured
+ * - -EINVAL: device was not configured
+ */
+__rte_experimental
+int
+rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id);
+
+/**
* Get the number of queue pairs on a specific crypto device
*
* @param dev_id Crypto device identifier.
diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map
index 07a2d2f..a7a78dc 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -103,4 +103,7 @@ EXPERIMENTAL {
__rte_cryptodev_trace_asym_session_clear;
__rte_cryptodev_trace_dequeue_burst;
__rte_cryptodev_trace_enqueue_burst;
+
+ # added in 20.08
+ rte_cryptodev_get_qp_status;
};
--
2.1.0
next reply other threads:[~2020-06-24 14:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 14:26 Arek Kusztal [this message]
2020-07-02 17:50 ` Akhil Goyal
2020-07-03 14:08 ` Kusztal, ArkadiuszX
2020-07-04 20:11 ` Akhil Goyal
2020-07-08 13:37 ` Thomas Monjalon
2020-07-08 14:05 ` Akhil Goyal
2020-07-08 14:10 ` Trahe, Fiona
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=20200624142653.16488-1-arkadiuszx.kusztal@intel.com \
--to=arkadiuszx.kusztal@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
/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).