All of lore.kernel.org
 help / color / mirror / Atom feed
* [Accel-config] [PATCH 2/2] accel-config: Ignore traffic_class in load-config if dev ver < 0x200
@ 2021-07-30  4:23 ramesh.thomas
  0 siblings, 0 replies; only message in thread
From: ramesh.thomas @ 2021-07-30  4:23 UTC (permalink / raw)
  To: accel-config

[-- Attachment #1: Type: text/plain, Size: 1889 bytes --]

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Silently ignore setting of traffic class if device version < 0x200

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/config.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/accfg/config.c b/accfg/config.c
index a98048e..b0ab701 100644
--- a/accfg/config.c
+++ b/accfg/config.c
@@ -69,6 +69,8 @@ static const struct device_set_table device_table[] = {
 	{ "token_limit", accfg_device_set_token_limit, NULL }
 };
 
+static bool is_group_traffic_class_writable(struct accfg_group *group,
+		int val);
 static bool is_group_token_attribs_writable(struct accfg_group *group,
 		int val);
 static bool is_group_token_limit_writable(struct accfg_group *group,
@@ -82,9 +84,9 @@ static const struct group_set_table group_table[] = {
 	{ "tokens_allowed", accfg_group_set_tokens_allowed, NULL,
 		is_group_token_attribs_writable },
 	{ "traffic_class_a", accfg_group_set_traffic_class_a, NULL,
-		is_group_token_attribs_writable },
+		is_group_traffic_class_writable},
 	{ "traffic_class_b", accfg_group_set_traffic_class_b, NULL,
-		is_group_token_attribs_writable },
+		is_group_traffic_class_writable},
 };
 
 static bool is_wq_threshold_writable(struct accfg_wq *wq, int val);
@@ -140,6 +142,21 @@ static bool is_group_token_attribs_writable(struct accfg_group *group,
 	return true;
 }
 
+static bool is_group_traffic_class_writable(struct accfg_group *group,
+		int val)
+{
+	struct accfg_device *device;
+
+	device = accfg_group_get_device(group);
+	if (accfg_device_get_version(device) < ACCFG_DEVICE_VERSION_2)
+		return false;
+
+	if (val == -1)
+		return false;
+
+	return true;
+}
+
 static bool is_wq_threshold_writable(struct accfg_wq *wq, int val)
 {
 	if (accfg_wq_get_mode(wq) == ACCFG_WQ_DEDICATED)
-- 
2.26.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-30  4:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30  4:23 [Accel-config] [PATCH 2/2] accel-config: Ignore traffic_class in load-config if dev ver < 0x200 ramesh.thomas

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.