From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: pablo.de.lara.guarch@intel.com
Subject: [dpdk-dev] [PATCH] crypto/scheduler: add get attached slaves API
Date: Tue, 21 Feb 2017 15:14:46 +0000 [thread overview]
Message-ID: <1487690086-45732-1-git-send-email-roy.fan.zhang@intel.com> (raw)
This patch adds an API to get the run-time slaves number and list
of a cryptodev scheduler PMD.
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 31 ++++++++++++++++++++++
drivers/crypto/scheduler/rte_cryptodev_scheduler.h | 23 ++++++++++++++++
.../scheduler/rte_pmd_crypto_scheduler_version.map | 7 +++++
3 files changed, 61 insertions(+)
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 11e8143..55c0ec4 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -469,3 +469,34 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t scheduler_id,
return 0;
}
+
+int
+rte_cryptodev_scheduler_slaves_get(uint8_t scheduler_id, uint8_t *slaves)
+{
+ struct rte_cryptodev *dev = rte_cryptodev_pmd_get_dev(scheduler_id);
+ struct scheduler_ctx *sched_ctx;
+ int nb_slaves = 0;
+
+ if (!dev) {
+ CS_LOG_ERR("Operation not supported");
+ return -ENOTSUP;
+ }
+
+ if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) {
+ CS_LOG_ERR("Operation not supported");
+ return -ENOTSUP;
+ }
+
+ sched_ctx = dev->data->dev_private;
+
+ nb_slaves = (int)sched_ctx->nb_slaves;
+
+ if (slaves) {
+ int i;
+
+ for (i = 0; i < nb_slaves; i++)
+ slaves[i] = sched_ctx->slaves[i].dev_id;
+ }
+
+ return 0;
+}
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
index 7ef44e7..0e32895 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
@@ -40,6 +40,11 @@
extern "C" {
#endif
+/**< Maximum number of bonded devices per devices */
+#ifndef RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES
+#define RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES (8)
+#endif
+
/**
* Crypto scheduler PMD operation modes
*/
@@ -143,6 +148,24 @@ rte_cryptodev_scheduler_ordering_set(uint8_t scheduler_id,
int
rte_cryptodev_scheduler_ordering_get(uint8_t scheduler_id);
+/**
+ * Get the the attached slaves' count and/or ID
+ *
+ *@param scheduler_id The target scheduler device ID
+ * slaves If successful, the slaves' device
+ * IDs will be written. This parameter
+ * can be NULL, but otherwise please NOTE
+ * it should be an uint8_t array of at least
+ * RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES
+ * elements.
+ *
+ * @return
+ * non-negative number: the number of slaves attached
+ * negative integer if error occurs.
+ */
+int
+rte_cryptodev_scheduler_slaves_get(uint8_t scheduler_id, uint8_t *slaves);
+
typedef uint16_t (*rte_cryptodev_scheduler_burst_enqueue_t)(void *qp_ctx,
struct rte_crypto_op **ops, uint16_t nb_ops);
diff --git a/drivers/crypto/scheduler/rte_pmd_crypto_scheduler_version.map b/drivers/crypto/scheduler/rte_pmd_crypto_scheduler_version.map
index a485b43..69cf0c6 100644
--- a/drivers/crypto/scheduler/rte_pmd_crypto_scheduler_version.map
+++ b/drivers/crypto/scheduler/rte_pmd_crypto_scheduler_version.map
@@ -10,3 +10,10 @@ DPDK_17.02 {
rte_cryptodev_scheduler_ordering_get;
};
+
+DPDK_17.05 {
+ global:
+
+ rte_cryptodev_scheduler_slaves_get;
+
+} DPDK_17.02;
--
2.7.4
next reply other threads:[~2017-02-21 15:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 15:14 Fan Zhang [this message]
2017-03-29 16:16 ` Sergio Gonzalez Monroy
2017-03-29 21:24 ` De Lara Guarch, Pablo
2017-03-30 13:39 ` Fan Zhang
2017-03-31 8:38 ` De Lara Guarch, Pablo
2017-03-31 9:55 ` De Lara Guarch, Pablo
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=1487690086-45732-1-git-send-email-roy.fan.zhang@intel.com \
--to=roy.fan.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=pablo.de.lara.guarch@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).