DPDK patches and discussions
 help / color / mirror / Atom feed
From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: pablo.de.lara.guarch@intel.com
Subject: [dpdk-dev] [PATCH v2 1/2] crypto/scheduler: add mode param parsing
Date: Mon, 23 Jul 2018 14:17:14 +0100	[thread overview]
Message-ID: <20180723131715.62875-2-roy.fan.zhang@intel.com> (raw)
In-Reply-To: <20180723131715.62875-1-roy.fan.zhang@intel.com>

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

  reply	other threads:[~2018-07-23 13:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Fan Zhang [this message]
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

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=20180723131715.62875-2-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).