From: ramesh.thomas at intel.com
To: accel-config@lists.01.org
Subject: [Accel-config] [PATCH v1 3/4] accel-config: New attrs to config-wq command
Date: Wed, 28 Oct 2020 12:54:51 -0400 [thread overview]
Message-ID: <20201028165452.86013-4-ramesh.thomas@intel.com> (raw)
In-Reply-To: 20201028165452.86013-1-ramesh.thomas@intel.com
[-- Attachment #1: Type: text/plain, Size: 3195 bytes --]
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Added max-transfer-size and max-batch-size attrs to config-wq
command.
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
accfg/config_attr.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/accfg/config_attr.c b/accfg/config_attr.c
index 3d9669c..f7f43b1 100644
--- a/accfg/config_attr.c
+++ b/accfg/config_attr.c
@@ -35,6 +35,8 @@ static struct wq_parameters wq_param = {
.priority = INT_MAX,
.block_on_fault = INT_MAX,
.threshold = INT_MAX,
+ .max_batch_size = INT_MAX,
+ .max_transfer_size = INT_MAX,
};
static struct engine_parameters engine_param;
@@ -131,7 +133,8 @@ static int accel_config_parse_group_attribs(struct accfg_group *group,
static int accel_config_parse_wq_attribs(struct accfg_device *device,
struct accfg_wq *wq, struct wq_parameters *wq_params)
{
- unsigned int max_groups, max_wq_size;
+ unsigned int max_groups, max_wq_size, max_batch_size;
+ unsigned long max_transfer_size;
int rc = 0;
if (wq_params->mode) {
@@ -145,6 +148,8 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,
max_groups = accfg_device_get_max_groups(device);
max_wq_size = accfg_device_get_max_work_queues_size(device);
+ max_batch_size = accfg_device_get_max_batch_size(device);
+ max_transfer_size = accfg_device_get_max_transfer_size(device);
if ((wq_params->wq_size > max_wq_size)
&& (wq_params->wq_size != INT_MAX)) {
@@ -167,6 +172,22 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,
return -EINVAL;
}
+ if ((wq_params->max_batch_size < 1
+ || wq_params->max_batch_size > max_batch_size)
+ && (wq_params->max_batch_size != INT_MAX)) {
+ fprintf(stderr,
+ "valid max-batch-size should be 1 to %d\n", max_batch_size);
+ return -EINVAL;
+ }
+
+ if ((wq_params->max_transfer_size < 1
+ || wq_params->max_transfer_size > max_transfer_size)
+ && (wq_params->max_transfer_size != INT_MAX)) {
+ fprintf(stderr,
+ "valid max-transfer-size should be 1 to %ld\n", max_transfer_size);
+ return -EINVAL;
+ }
+
if (wq_params->mode) {
rc = accfg_wq_set_str_mode(wq, wq_params->mode);
if (rc < 0)
@@ -216,6 +237,18 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,
return rc;
}
+ if (wq_params->max_batch_size != INT_MAX) {
+ rc = accfg_wq_set_max_batch_size(wq, wq_params->max_batch_size);
+ if (rc < 0)
+ return rc;
+ }
+
+ if (wq_params->max_transfer_size != INT_MAX) {
+ rc = accfg_wq_set_max_transfer_size(wq, wq_params->max_transfer_size);
+ if (rc < 0)
+ return rc;
+ }
+
return 0;
}
@@ -400,6 +433,10 @@ int cmd_config_wq(int argc, const char **argv, void *ctx)
"specify name by wq"),
OPT_STRING('m', "mode", &wq_param.mode, "mode",
"specify mode by wq"),
+ OPT_UINTEGER('c', "max-batch-size", &wq_param.max_batch_size,
+ "specify max-batch-size used by wq"),
+ OPT_U64('x', "max-transfer-size", &wq_param.max_transfer_size,
+ "specify max-transfer-size used by wq"),
OPT_END(),
};
--
2.26.2
reply other threads:[~2020-10-28 16:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201028165452.86013-4-ramesh.thomas@intel.com \
--to=accel-config@lists.01.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.