[Accel-config] [PATCH 1/2] accel-config: Allow -1 wq->group-id

ramesh.thomas at intel.com
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
From: Ramesh Thomas <ramesh.thomas(a)intel.com>

-1 is a special value passed in config-wq to dissasociate the wq from
groups

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/config_attr.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/accfg/config_attr.c b/accfg/config_attr.c
index 52b9fa8..1f884fd 100644
--- a/accfg/config_attr.c
+++ b/accfg/config_attr.c
@@ -133,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, max_batch_size;
+	int max_groups;
+	unsigned int max_wq_size, max_batch_size;
 	uint64_t max_transfer_size;
 	int rc = 0;
 
@@ -158,10 +159,11 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,
 		return -EINVAL;
 	}
 
-	if (((unsigned int)wq_params->group_id >= max_groups)
-		&& (wq_params->group_id != INT_MAX)) {
+	if ((wq_params->group_id >= max_groups) &&
+			(wq_params->group_id != INT_MAX)) {
 		fprintf(stderr,
-			"valid group_id should be 0 to %d\n", max_groups-1);
+			"valid group id should be 0 to %d or -1 to dissociate the wq from groups\n",
+			max_groups-1);
 		return -EINVAL;
 	}
 
-- 
2.26.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.