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 mode specific option support
Date: Tue, 21 Feb 2017 14:29:39 +0000 [thread overview]
Message-ID: <1487687379-43345-1-git-send-email-roy.fan.zhang@intel.com> (raw)
Some scheduling modes may need extra options to be configured,
this patch adds the function prototype for setting/getting
options.
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 57 ++++++++++++++++++++++
drivers/crypto/scheduler/rte_cryptodev_scheduler.h | 27 ++++++++++
.../scheduler/rte_cryptodev_scheduler_operations.h | 5 ++
drivers/crypto/scheduler/scheduler_roundrobin.c | 10 +++-
4 files changed, 98 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 11e8143..c1491ff 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -469,3 +469,60 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t scheduler_id,
return 0;
}
+
+int
+rte_cryptodev_scheduler_option_set(uint8_t scheduler_id, void *option)
+{
+ struct rte_cryptodev *dev = rte_cryptodev_pmd_get_dev(scheduler_id);
+ struct scheduler_ctx *sched_ctx;
+
+ if (!dev) {
+ CS_LOG_ERR("Operation not supported");
+ return -ENOTSUP;
+ }
+
+ if (!option) {
+ CS_LOG_ERR("Invalid option parameter");
+ return -EINVAL;
+ }
+
+ if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) {
+ CS_LOG_ERR("Operation not supported");
+ return -ENOTSUP;
+ }
+
+ if (dev->data->dev_started) {
+ CS_LOG_ERR("Illegal operation");
+ return -EBUSY;
+ }
+
+ sched_ctx = dev->data->dev_private;
+
+ return (*sched_ctx->ops.option_config)(dev, option, 1);
+}
+
+int
+rte_cryptodev_scheduler_option_get(uint8_t scheduler_id, void *option)
+{
+ struct rte_cryptodev *dev = rte_cryptodev_pmd_get_dev(scheduler_id);
+ struct scheduler_ctx *sched_ctx;
+
+ if (!dev) {
+ CS_LOG_ERR("Operation not supported");
+ return -ENOTSUP;
+ }
+
+ if (!option) {
+ CS_LOG_ERR("Invalid option parameter");
+ return -EINVAL;
+ }
+
+ if (dev->dev_type != RTE_CRYPTODEV_SCHEDULER_PMD) {
+ CS_LOG_ERR("Operation not supported");
+ return -ENOTSUP;
+ }
+
+ sched_ctx = dev->data->dev_private;
+
+ return (*sched_ctx->ops.option_config)(dev, option, 0);
+}
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
index 7ef44e7..c10867a 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
@@ -143,6 +143,33 @@ rte_cryptodev_scheduler_ordering_set(uint8_t scheduler_id,
int
rte_cryptodev_scheduler_ordering_get(uint8_t scheduler_id);
+/**
+ * Set the mode specific option
+ *
+ * @param dev_id The target scheduler device ID
+ * option The mode specific option
+ *
+ * @return
+ * 0 if successful
+ * negative integer if otherwise.
+ */
+int
+rte_cryptodev_scheduler_option_set(uint8_t scheduler_id, void *option);
+
+/**
+ * Get the mode specific option
+ *
+ * @param dev_id The target scheduler device ID
+ * option The mode specific option to be written
+ *
+ * @return
+ * 0 if successful
+ * negative integer if otherwise.
+ */
+int
+rte_cryptodev_scheduler_option_get(uint8_t scheduler_id, void *option);
+
+
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_cryptodev_scheduler_operations.h b/drivers/crypto/scheduler/rte_cryptodev_scheduler_operations.h
index 93cf123..fe36c1e 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler_operations.h
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler_operations.h
@@ -53,6 +53,9 @@ typedef int (*rte_cryptodev_scheduler_config_queue_pair)(
typedef int (*rte_cryptodev_scheduler_create_private_ctx)(
struct rte_cryptodev *dev);
+typedef int (*rte_cryptodev_scheduler_config_option)(
+ struct rte_cryptodev *dev, void *option, uint32_t is_set);
+
struct rte_cryptodev_scheduler_ops {
rte_cryptodev_scheduler_slave_attach_t slave_attach;
rte_cryptodev_scheduler_slave_attach_t slave_detach;
@@ -63,6 +66,8 @@ struct rte_cryptodev_scheduler_ops {
rte_cryptodev_scheduler_config_queue_pair config_queue_pair;
rte_cryptodev_scheduler_create_private_ctx create_private_ctx;
+
+ rte_cryptodev_scheduler_config_option option_config;
};
#ifdef __cplusplus
diff --git a/drivers/crypto/scheduler/scheduler_roundrobin.c b/drivers/crypto/scheduler/scheduler_roundrobin.c
index 9545aa9..d262edd 100644
--- a/drivers/crypto/scheduler/scheduler_roundrobin.c
+++ b/drivers/crypto/scheduler/scheduler_roundrobin.c
@@ -415,13 +415,21 @@ scheduler_create_private_ctx(__rte_unused struct rte_cryptodev *dev)
return 0;
}
+static int
+scheduler_option(__rte_unused struct rte_cryptodev *dev,
+ __rte_unused void *option, __rte_unused uint32_t is_set)
+{
+ return 0;
+}
+
struct rte_cryptodev_scheduler_ops scheduler_rr_ops = {
slave_attach,
slave_detach,
scheduler_start,
scheduler_stop,
scheduler_config_qp,
- scheduler_create_private_ctx
+ scheduler_create_private_ctx,
+ scheduler_option
};
struct rte_cryptodev_scheduler scheduler = {
--
2.7.4
next reply other threads:[~2017-02-21 14:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 14:29 Fan Zhang [this message]
2017-03-21 14:34 ` De Lara Guarch, Pablo
2017-03-31 15:30 ` [dpdk-dev] [PATCH v2] " Fan Zhang
2017-04-05 8:46 ` De Lara Guarch, Pablo
2017-04-05 9:02 ` [dpdk-dev] [PATCH v3] " Fan Zhang
2017-04-05 10:02 ` Declan Doherty
2017-04-05 11:43 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2017-04-05 15:54 ` [dpdk-dev] [PATCH v4] " Fan Zhang
2017-04-05 16:07 ` [dpdk-dev] [PATCH v5] " Fan Zhang
2017-04-17 19:46 ` 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=1487687379-43345-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).