Skip to contentSkip to conversation

Do not set traffic_class if dev ver < 200

PATCH In review ramesh.thomas at intel.com 2 participants 4 messages Jul 30, 2021

lore
Share & tools
lore

ramesh.thomas at intel.com

#0 lore raw

cover Do not set traffic_class if dev ver < 200

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

config-group command return error and load-config silently ignores setting of traffic_class attributes if device version < 0x200

Ramesh Thomas (2):
accel-config: Do not allow configuring traffic_class for dev ver <

    0x200

accel-config: Ignore traffic_class in load-config if dev ver < 0x200

 accfg/config.c      | 21 +++++++++++++++++++--
 accfg/config_attr.c |  9 +++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)
Signature · 1 line
2.26.3
#1 lore raw

PATCH 1/2 accel-config: Do not allow configuring traffic_class for dev ver < 0x200

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

Return error if config-group is called for traffic_class and device version < 0x200

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/config_attr.c | 9 +++++++++
 1 file changed, 9 insertions(+)
accfg/config_attr.c +9 -0
index 2e97c1f..2617b98 100644
@@ -58,6 +58,15 @@ static int accel_config_parse_group_attribs(struct accfg_group *group,
 		struct group_parameters *group_params)
 {
 	int rc = 0;
+	struct accfg_device *device;
+
+	device = accfg_group_get_device(group);
+	if (accfg_device_get_version(device) < ACCFG_DEVICE_VERSION_2 &&
+			(group_params->traffic_class_a != INT_MAX ||
+			 group_params->traffic_class_b != INT_MAX)) {
+		fprintf(stderr, "traffic-class cannot be configured\n");
+		return -EINVAL;
+	}
 
 	if (group_params->tokens_reserved != UINT_MAX &&
 			group_params->tokens_reserved >= UCHAR_MAX) {
Signature · 1 line
2.26.3
#2 lore raw

PATCH 2/2 accel-config: Ignore traffic_class in load-config if dev ver < 0x200

In reply to ramesh.thomas at intel.com

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(-)
accfg/config.c +19 -2
index a98048e..b0ab701 100644
@@ -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)
Signature · 1 line
2.26.3
Reviewed-by on the v1 series
#3 lore raw
In reply to ramesh.thomas at intel.com
Quoted 5 lines · ramesh.thomas(a)intel.com

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

config-group command return error and load-config silently ignores setting of traffic_class attributes if device version < 0x200

Quoted 8 lines

Ramesh Thomas (2):

   accel-config: Do not allow configuring traffic_class for dev ver <
     0x200
   accel-config: Ignore traffic_class in load-config if dev ver < 0x200
  accfg/config.c      | 21 +++++++++++++++++++--
  accfg/config_attr.c |  9 +++++++++
  2 files changed, 28 insertions(+), 2 deletions(-)
Reviewed-by Dave Jiang <dave.jiang(a)intel.com>

for the series.