DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto/scheduler: add mode specific option support
@ 2017-02-21 14:29 Fan Zhang
  2017-03-21 14:34 ` De Lara Guarch, Pablo
  2017-03-31 15:30 ` [dpdk-dev] [PATCH v2] " Fan Zhang
  0 siblings, 2 replies; 10+ messages in thread
From: Fan Zhang @ 2017-02-21 14:29 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch

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

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

end of thread, other threads:[~2017-04-17 19:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21 14:29 [dpdk-dev] [PATCH] crypto/scheduler: add mode specific option support Fan Zhang
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

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).