DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] crypto/scheduler: add mode specific parameter support
@ 2018-06-22 12:08 Fan Zhang
  2018-06-22 12:08 ` [dpdk-dev] [PATCH 1/2] crypto/scheduler: add mode param parsing Fan Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Fan Zhang @ 2018-06-22 12:08 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch, roy.fan.zhang

This patch adds scheduler PMD mode specific parameter support. The 
packet-size-distr mode now support custom threshold during initialization.

Fan Zhang (2):
  crypto/scheduler: add mode param parsing
  crypto/scheduler: add packet-size-distr mode param parse

 doc/guides/cryptodevs/scheduler.rst                | 12 +++-
 drivers/crypto/scheduler/rte_cryptodev_scheduler.h |  1 +
 drivers/crypto/scheduler/scheduler_pmd.c           | 75 ++++++++++++++++++++++
 3 files changed, 87 insertions(+), 1 deletion(-)

-- 
2.13.6

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

* [dpdk-dev] [PATCH 1/2] crypto/scheduler: add mode param parsing
  2018-06-22 12:08 [dpdk-dev] [PATCH 0/2] crypto/scheduler: add mode specific parameter support Fan Zhang
@ 2018-06-22 12:08 ` Fan Zhang
  2018-06-22 12:08 ` [dpdk-dev] [PATCH 2/2] crypto/scheduler: add packet-size-distr mode param parse Fan Zhang
  2018-07-23 13:17 ` [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support Fan Zhang
  2 siblings, 0 replies; 7+ messages in thread
From: Fan Zhang @ 2018-06-22 12:08 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch, roy.fan.zhang

This patch adds the mode parameter parsing to scheduler PMD.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 doc/guides/cryptodevs/scheduler.rst      |  5 +++++
 drivers/crypto/scheduler/scheduler_pmd.c | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/doc/guides/cryptodevs/scheduler.rst b/doc/guides/cryptodevs/scheduler.rst
index d67894d55..4d7f5b152 100644
--- a/doc/guides/cryptodevs/scheduler.rst
+++ b/doc/guides/cryptodevs/scheduler.rst
@@ -71,6 +71,11 @@ two calls:
   mode parameter values are specified in the "Cryptodev Scheduler Modes
   Overview" section.
 
+* mode_param: Specify the mode-specific parameter. Some scheduling modes
+  may be initialized with specific parameters other than the default ones,
+  such as the **threshold** packet size of **packet-size-distr** mode. This
+  parameter fulfills the purpose.
+
 * ordering: Specify the status of the crypto operations ordering feature.
   The value of this parameter can be "enable" or "disable". This feature
   is disabled by default.
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 25d6409f3..04eac114e 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -9,6 +9,7 @@
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_reorder.h>
+#include <rte_string_fns.h>
 
 #include "rte_cryptodev_scheduler.h"
 #include "scheduler_pmd_private.h"
@@ -19,6 +20,7 @@ struct scheduler_init_params {
 	struct rte_cryptodev_pmd_init_params def_p;
 	uint32_t nb_slaves;
 	enum rte_cryptodev_scheduler_mode mode;
+	char mode_param_str[RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN];
 	uint32_t enable_ordering;
 	uint16_t wc_pool[RTE_MAX_LCORE];
 	uint16_t nb_wc;
@@ -29,6 +31,7 @@ struct scheduler_init_params {
 #define RTE_CRYPTODEV_VDEV_NAME			("name")
 #define RTE_CRYPTODEV_VDEV_SLAVE		("slave")
 #define RTE_CRYPTODEV_VDEV_MODE			("mode")
+#define RTE_CRYPTODEV_VDEV_MODE_PARAM		("mode_param")
 #define RTE_CRYPTODEV_VDEV_ORDERING		("ordering")
 #define RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG	("max_nb_queue_pairs")
 #define RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG	("max_nb_sessions")
@@ -40,6 +43,7 @@ const char *scheduler_valid_params[] = {
 	RTE_CRYPTODEV_VDEV_NAME,
 	RTE_CRYPTODEV_VDEV_SLAVE,
 	RTE_CRYPTODEV_VDEV_MODE,
+	RTE_CRYPTODEV_VDEV_MODE_PARAM,
 	RTE_CRYPTODEV_VDEV_ORDERING,
 	RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
 	RTE_CRYPTODEV_VDEV_MAX_NB_SESS_ARG,
@@ -348,6 +352,7 @@ parse_mode_arg(const char *key __rte_unused,
 		if (strcmp(value, scheduler_mode_map[i].name) == 0) {
 			param->mode = (enum rte_cryptodev_scheduler_mode)
 					scheduler_mode_map[i].val;
+
 			break;
 		}
 	}
@@ -361,6 +366,18 @@ parse_mode_arg(const char *key __rte_unused,
 }
 
 static int
+parse_mode_param_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	struct scheduler_init_params *param = extra_args;
+
+	strlcpy(param->mode_param_str, value,
+			RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN);
+
+	return 0;
+}
+
+static int
 parse_ordering_arg(const char *key __rte_unused,
 		const char *value, void *extra_args)
 {
@@ -447,6 +464,11 @@ scheduler_parse_init_params(struct scheduler_init_params *params,
 		if (ret < 0)
 			goto free_kvlist;
 
+		ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_MODE_PARAM,
+				&parse_mode_param_arg, params);
+		if (ret < 0)
+			goto free_kvlist;
+
 		ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_ORDERING,
 				&parse_ordering_arg, params);
 		if (ret < 0)
-- 
2.13.6

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

* [dpdk-dev] [PATCH 2/2] crypto/scheduler: add packet-size-distr mode param parse
  2018-06-22 12:08 [dpdk-dev] [PATCH 0/2] crypto/scheduler: add mode specific parameter support Fan Zhang
  2018-06-22 12:08 ` [dpdk-dev] [PATCH 1/2] crypto/scheduler: add mode param parsing Fan Zhang
@ 2018-06-22 12:08 ` Fan Zhang
  2018-07-23 13:17 ` [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support Fan Zhang
  2 siblings, 0 replies; 7+ messages in thread
From: Fan Zhang @ 2018-06-22 12:08 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch, roy.fan.zhang

This patch adds packet-size-distr mode specific parameter parse to
support different threshold packet size value other than default
128 bytes.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 doc/guides/cryptodevs/scheduler.rst                |  7 ++-
 drivers/crypto/scheduler/rte_cryptodev_scheduler.h |  1 +
 drivers/crypto/scheduler/scheduler_pmd.c           | 53 ++++++++++++++++++++++
 3 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/doc/guides/cryptodevs/scheduler.rst b/doc/guides/cryptodevs/scheduler.rst
index 4d7f5b152..d4e695760 100644
--- a/doc/guides/cryptodevs/scheduler.rst
+++ b/doc/guides/cryptodevs/scheduler.rst
@@ -137,7 +137,12 @@ operation:
    **option_type** must be **CDEV_SCHED_OPTION_THRESHOLD** and **option** should
    point to a rte_cryptodev_scheduler_threshold_option structure filled with
    appropriate threshold value. Please NOTE this threshold has be a power-of-2
-   unsigned integer.
+   unsigned integer. It is possible to use **mode_param** initialization
+   parameter to achieve the same purpose. For example:
+
+   ... --vdev "crypto_scheduler,mode=packet-size-distr,threshold:512" ...
+
+   The above parameter will overwrite the threshold value to 512.
 
 *   **CDEV_SCHED_MODE_FAILOVER:**
 
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
index 1c164da7c..3faea4099 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
@@ -76,6 +76,7 @@ enum rte_cryptodev_schedule_option_type {
 /**
  * Threshold option structure
  */
+#define RTE_CRYPTODEV_SCHEDULER_PARAM_THRES	"threshold"
 struct rte_cryptodev_scheduler_threshold_option {
 	uint32_t threshold;	/**< Threshold for packet-size mode */
 };
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 04eac114e..41a13ee90 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -73,6 +73,8 @@ const struct scheduler_parse_map scheduler_ordering_map[] = {
 		{"disable", 0}
 };
 
+#define CDEV_SCHED_MODE_PARAM_SEP_CHAR		':'
+
 static int
 cryptodev_scheduler_create(const char *name,
 		struct rte_vdev_device *vdev,
@@ -112,6 +114,15 @@ cryptodev_scheduler_create(const char *name,
 
 	if (init_params->mode > CDEV_SCHED_MODE_USERDEFINED &&
 			init_params->mode < CDEV_SCHED_MODE_COUNT) {
+		union {
+			struct rte_cryptodev_scheduler_threshold_option
+					threshold_option;
+		} option;
+		enum rte_cryptodev_schedule_option_type option_type;
+		char param_name[RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN] = {0};
+		char param_val[RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN] = {0};
+		char *s, *end;
+
 		ret = rte_cryptodev_scheduler_mode_set(dev->data->dev_id,
 			init_params->mode);
 		if (ret < 0) {
@@ -127,6 +138,48 @@ cryptodev_scheduler_create(const char *name,
 					scheduler_mode_map[i].name);
 			break;
 		}
+
+		if (strlen(init_params->mode_param_str) > 0) {
+			s = strchr(init_params->mode_param_str,
+					CDEV_SCHED_MODE_PARAM_SEP_CHAR);
+			if (s == NULL) {
+				CS_LOG_ERR("Invalid mode param");
+				return -EINVAL;
+			}
+
+			strlcpy(param_name, init_params->mode_param_str,
+					s - init_params->mode_param_str + 1);
+			s++;
+			strlcpy(param_val, s,
+					RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN);
+
+			switch (init_params->mode) {
+			case CDEV_SCHED_MODE_PKT_SIZE_DISTR:
+				if (strcmp(param_name,
+					RTE_CRYPTODEV_SCHEDULER_PARAM_THRES)
+						!= 0) {
+					CS_LOG_ERR("Invalid mode param");
+					return -EINVAL;
+				}
+				option_type = CDEV_SCHED_OPTION_THRESHOLD;
+
+				option.threshold_option.threshold =
+						strtoul(param_val, &end, 0);
+				break;
+			default:
+				CS_LOG_ERR("Invalid mode param");
+				return -EINVAL;
+			}
+
+			if (sched_ctx->ops.option_set(dev, option_type,
+					(void *)&option) < 0) {
+				CS_LOG_ERR("Invalid mode param");
+				return -EINVAL;
+			}
+
+			RTE_LOG(INFO, PMD, "  Sched mode param (%s = %s)\n",
+					param_name, param_val);
+		}
 	}
 
 	sched_ctx->reordering_enabled = init_params->enable_ordering;
-- 
2.13.6

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

* [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support
  2018-06-22 12:08 [dpdk-dev] [PATCH 0/2] crypto/scheduler: add mode specific parameter support Fan Zhang
  2018-06-22 12:08 ` [dpdk-dev] [PATCH 1/2] crypto/scheduler: add mode param parsing Fan Zhang
  2018-06-22 12:08 ` [dpdk-dev] [PATCH 2/2] crypto/scheduler: add packet-size-distr mode param parse Fan Zhang
@ 2018-07-23 13:17 ` Fan Zhang
  2018-07-23 13:17   ` [dpdk-dev] [PATCH v2 1/2] crypto/scheduler: add mode param parsing Fan Zhang
                     ` (2 more replies)
  2 siblings, 3 replies; 7+ messages in thread
From: Fan Zhang @ 2018-07-23 13:17 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch

This patch adds scheduler PMD mode specific parameter support. The              
packet-size-distr mode now support custom threshold during initialization.

v2:
- Rebased to master (thanks to Pablo)
- Fixed documentation

Fan Zhang (2):
  crypto/scheduler: add mode param parsing
  crypto/scheduler: add packet-size-distr mode param parse

 doc/guides/cryptodevs/scheduler.rst                | 12 +++-
 drivers/crypto/scheduler/rte_cryptodev_scheduler.h |  1 +
 drivers/crypto/scheduler/scheduler_pmd.c           | 75 ++++++++++++++++++++++
 3 files changed, 87 insertions(+), 1 deletion(-)

-- 
2.13.6

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

* [dpdk-dev] [PATCH v2 1/2] crypto/scheduler: add mode param parsing
  2018-07-23 13:17 ` [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support Fan Zhang
@ 2018-07-23 13:17   ` Fan Zhang
  2018-07-23 13:17   ` [dpdk-dev] [PATCH v2 2/2] crypto/scheduler: add packet-size-distr mode param parse Fan Zhang
  2018-07-24  8:17   ` [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support De Lara Guarch, Pablo
  2 siblings, 0 replies; 7+ messages in thread
From: Fan Zhang @ 2018-07-23 13:17 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch

This patch adds the mode parameter parsing to scheduler PMD.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 doc/guides/cryptodevs/scheduler.rst      |  5 +++++
 drivers/crypto/scheduler/scheduler_pmd.c | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/doc/guides/cryptodevs/scheduler.rst b/doc/guides/cryptodevs/scheduler.rst
index d67894d55..4d7f5b152 100644
--- a/doc/guides/cryptodevs/scheduler.rst
+++ b/doc/guides/cryptodevs/scheduler.rst
@@ -71,6 +71,11 @@ two calls:
   mode parameter values are specified in the "Cryptodev Scheduler Modes
   Overview" section.
 
+* mode_param: Specify the mode-specific parameter. Some scheduling modes
+  may be initialized with specific parameters other than the default ones,
+  such as the **threshold** packet size of **packet-size-distr** mode. This
+  parameter fulfills the purpose.
+
 * ordering: Specify the status of the crypto operations ordering feature.
   The value of this parameter can be "enable" or "disable". This feature
   is disabled by default.
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 6c5c01d63..ac9185e65 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -9,6 +9,7 @@
 #include <rte_malloc.h>
 #include <rte_cpuflags.h>
 #include <rte_reorder.h>
+#include <rte_string_fns.h>
 
 #include "rte_cryptodev_scheduler.h"
 #include "scheduler_pmd_private.h"
@@ -19,6 +20,7 @@ struct scheduler_init_params {
 	struct rte_cryptodev_pmd_init_params def_p;
 	uint32_t nb_slaves;
 	enum rte_cryptodev_scheduler_mode mode;
+	char mode_param_str[RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN];
 	uint32_t enable_ordering;
 	uint16_t wc_pool[RTE_MAX_LCORE];
 	uint16_t nb_wc;
@@ -29,6 +31,7 @@ struct scheduler_init_params {
 #define RTE_CRYPTODEV_VDEV_NAME			("name")
 #define RTE_CRYPTODEV_VDEV_SLAVE		("slave")
 #define RTE_CRYPTODEV_VDEV_MODE			("mode")
+#define RTE_CRYPTODEV_VDEV_MODE_PARAM		("mode_param")
 #define RTE_CRYPTODEV_VDEV_ORDERING		("ordering")
 #define RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG	("max_nb_queue_pairs")
 #define RTE_CRYPTODEV_VDEV_SOCKET_ID		("socket_id")
@@ -39,6 +42,7 @@ const char *scheduler_valid_params[] = {
 	RTE_CRYPTODEV_VDEV_NAME,
 	RTE_CRYPTODEV_VDEV_SLAVE,
 	RTE_CRYPTODEV_VDEV_MODE,
+	RTE_CRYPTODEV_VDEV_MODE_PARAM,
 	RTE_CRYPTODEV_VDEV_ORDERING,
 	RTE_CRYPTODEV_VDEV_MAX_NB_QP_ARG,
 	RTE_CRYPTODEV_VDEV_SOCKET_ID,
@@ -346,6 +350,7 @@ parse_mode_arg(const char *key __rte_unused,
 		if (strcmp(value, scheduler_mode_map[i].name) == 0) {
 			param->mode = (enum rte_cryptodev_scheduler_mode)
 					scheduler_mode_map[i].val;
+
 			break;
 		}
 	}
@@ -359,6 +364,18 @@ parse_mode_arg(const char *key __rte_unused,
 }
 
 static int
+parse_mode_param_arg(const char *key __rte_unused,
+		const char *value, void *extra_args)
+{
+	struct scheduler_init_params *param = extra_args;
+
+	strlcpy(param->mode_param_str, value,
+			RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN);
+
+	return 0;
+}
+
+static int
 parse_ordering_arg(const char *key __rte_unused,
 		const char *value, void *extra_args)
 {
@@ -438,6 +455,11 @@ scheduler_parse_init_params(struct scheduler_init_params *params,
 		if (ret < 0)
 			goto free_kvlist;
 
+		ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_MODE_PARAM,
+				&parse_mode_param_arg, params);
+		if (ret < 0)
+			goto free_kvlist;
+
 		ret = rte_kvargs_process(kvlist, RTE_CRYPTODEV_VDEV_ORDERING,
 				&parse_ordering_arg, params);
 		if (ret < 0)
-- 
2.13.6

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

* [dpdk-dev] [PATCH v2 2/2] crypto/scheduler: add packet-size-distr mode param parse
  2018-07-23 13:17 ` [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support Fan Zhang
  2018-07-23 13:17   ` [dpdk-dev] [PATCH v2 1/2] crypto/scheduler: add mode param parsing Fan Zhang
@ 2018-07-23 13:17   ` Fan Zhang
  2018-07-24  8:17   ` [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support De Lara Guarch, Pablo
  2 siblings, 0 replies; 7+ messages in thread
From: Fan Zhang @ 2018-07-23 13:17 UTC (permalink / raw)
  To: dev; +Cc: pablo.de.lara.guarch

This patch adds packet-size-distr mode specific parameter parser
to support different threshold packet size value other than default
128 bytes.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 doc/guides/cryptodevs/scheduler.rst                |  7 ++-
 drivers/crypto/scheduler/rte_cryptodev_scheduler.h |  1 +
 drivers/crypto/scheduler/scheduler_pmd.c           | 53 ++++++++++++++++++++++
 3 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/doc/guides/cryptodevs/scheduler.rst b/doc/guides/cryptodevs/scheduler.rst
index 4d7f5b152..a754a27e6 100644
--- a/doc/guides/cryptodevs/scheduler.rst
+++ b/doc/guides/cryptodevs/scheduler.rst
@@ -137,7 +137,12 @@ operation:
    **option_type** must be **CDEV_SCHED_OPTION_THRESHOLD** and **option** should
    point to a rte_cryptodev_scheduler_threshold_option structure filled with
    appropriate threshold value. Please NOTE this threshold has be a power-of-2
-   unsigned integer.
+   unsigned integer. It is possible to use **mode_param** initialization
+   parameter to achieve the same purpose. For example:
+
+   ... --vdev "crypto_scheduler,mode=packet-size-distr,mode_param=threshold:512" ...
+
+   The above parameter will overwrite the threshold value to 512.
 
 *   **CDEV_SCHED_MODE_FAILOVER:**
 
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
index 1c164da7c..3faea4099 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
@@ -76,6 +76,7 @@ enum rte_cryptodev_schedule_option_type {
 /**
  * Threshold option structure
  */
+#define RTE_CRYPTODEV_SCHEDULER_PARAM_THRES	"threshold"
 struct rte_cryptodev_scheduler_threshold_option {
 	uint32_t threshold;	/**< Threshold for packet-size mode */
 };
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index ac9185e65..a9221a946 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -71,6 +71,8 @@ const struct scheduler_parse_map scheduler_ordering_map[] = {
 		{"disable", 0}
 };
 
+#define CDEV_SCHED_MODE_PARAM_SEP_CHAR		':'
+
 static int
 cryptodev_scheduler_create(const char *name,
 		struct rte_vdev_device *vdev,
@@ -110,6 +112,15 @@ cryptodev_scheduler_create(const char *name,
 
 	if (init_params->mode > CDEV_SCHED_MODE_USERDEFINED &&
 			init_params->mode < CDEV_SCHED_MODE_COUNT) {
+		union {
+			struct rte_cryptodev_scheduler_threshold_option
+					threshold_option;
+		} option;
+		enum rte_cryptodev_schedule_option_type option_type;
+		char param_name[RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN] = {0};
+		char param_val[RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN] = {0};
+		char *s, *end;
+
 		ret = rte_cryptodev_scheduler_mode_set(dev->data->dev_id,
 			init_params->mode);
 		if (ret < 0) {
@@ -125,6 +136,48 @@ cryptodev_scheduler_create(const char *name,
 					scheduler_mode_map[i].name);
 			break;
 		}
+
+		if (strlen(init_params->mode_param_str) > 0) {
+			s = strchr(init_params->mode_param_str,
+					CDEV_SCHED_MODE_PARAM_SEP_CHAR);
+			if (s == NULL) {
+				CR_SCHED_LOG(ERR, "Invalid mode param");
+				return -EINVAL;
+			}
+
+			strlcpy(param_name, init_params->mode_param_str,
+					s - init_params->mode_param_str + 1);
+			s++;
+			strlcpy(param_val, s,
+					RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN);
+
+			switch (init_params->mode) {
+			case CDEV_SCHED_MODE_PKT_SIZE_DISTR:
+				if (strcmp(param_name,
+					RTE_CRYPTODEV_SCHEDULER_PARAM_THRES)
+						!= 0) {
+					CR_SCHED_LOG(ERR, "Invalid mode param");
+					return -EINVAL;
+				}
+				option_type = CDEV_SCHED_OPTION_THRESHOLD;
+
+				option.threshold_option.threshold =
+						strtoul(param_val, &end, 0);
+				break;
+			default:
+				CR_SCHED_LOG(ERR, "Invalid mode param");
+				return -EINVAL;
+			}
+
+			if (sched_ctx->ops.option_set(dev, option_type,
+					(void *)&option) < 0) {
+				CR_SCHED_LOG(ERR, "Invalid mode param");
+				return -EINVAL;
+			}
+
+			RTE_LOG(INFO, PMD, "  Sched mode param (%s = %s)\n",
+					param_name, param_val);
+		}
 	}
 
 	sched_ctx->reordering_enabled = init_params->enable_ordering;
-- 
2.13.6

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

* Re: [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support
  2018-07-23 13:17 ` [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support Fan Zhang
  2018-07-23 13:17   ` [dpdk-dev] [PATCH v2 1/2] crypto/scheduler: add mode param parsing Fan Zhang
  2018-07-23 13:17   ` [dpdk-dev] [PATCH v2 2/2] crypto/scheduler: add packet-size-distr mode param parse Fan Zhang
@ 2018-07-24  8:17   ` De Lara Guarch, Pablo
  2 siblings, 0 replies; 7+ messages in thread
From: De Lara Guarch, Pablo @ 2018-07-24  8:17 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev



> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Monday, July 23, 2018 2:17 PM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support
> 
> This patch adds scheduler PMD mode specific parameter support. The
> packet-size-distr mode now support custom threshold during initialization.
> 
> v2:
> - Rebased to master (thanks to Pablo)
> - Fixed documentation
> 
> Fan Zhang (2):
>   crypto/scheduler: add mode param parsing
>   crypto/scheduler: add packet-size-distr mode param parse
> 
>  doc/guides/cryptodevs/scheduler.rst                | 12 +++-
>  drivers/crypto/scheduler/rte_cryptodev_scheduler.h |  1 +
>  drivers/crypto/scheduler/scheduler_pmd.c           | 75
> ++++++++++++++++++++++
>  3 files changed, 87 insertions(+), 1 deletion(-)
> 
> --
> 2.13.6

Series applied to dpdk-next-crypto.
Thanks,

Pablo

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

end of thread, other threads:[~2018-07-24  8:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-22 12:08 [dpdk-dev] [PATCH 0/2] crypto/scheduler: add mode specific parameter support Fan Zhang
2018-06-22 12:08 ` [dpdk-dev] [PATCH 1/2] crypto/scheduler: add mode param parsing Fan Zhang
2018-06-22 12:08 ` [dpdk-dev] [PATCH 2/2] crypto/scheduler: add packet-size-distr mode param parse Fan Zhang
2018-07-23 13:17 ` [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support Fan Zhang
2018-07-23 13:17   ` [dpdk-dev] [PATCH v2 1/2] crypto/scheduler: add mode param parsing Fan Zhang
2018-07-23 13:17   ` [dpdk-dev] [PATCH v2 2/2] crypto/scheduler: add packet-size-distr mode param parse Fan Zhang
2018-07-24  8:17   ` [dpdk-dev] [PATCH v2 0/2] crypto/scheduler: add mode specific parameter support 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).