Skip to contentSkip to conversation

accel-config: Do not set group traffic class for hw ver < 0x200

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

lore
Share & tools
lore

ramesh.thomas at intel.com

#0 lore raw

PATCH v2 1/1 accel-config: Do not set group traffic class for hw ver < 0x200

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

A default value will be set by driver for hw versions < 0x200

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>

---
v2:
Use enum for device versions

 accfg/libaccel_config.h | 5 +++++
 test/libaccfg.c         | 7 +++++++
 2 files changed, 12 insertions(+)
accfg/libaccel_config.h +5 -0
index a74571c..f8b9bf9 100644
@@ -27,6 +27,11 @@ extern "C" {
 #define WQ_PRIORITY_LIMIT 15
 #define UUID_ZERO "00000000-0000-0000-0000-000000000000"
 
+enum accfg_device_version {
+	ACCFG_DEVICE_VERSION_1 = 0x100,
+	ACCFG_DEVICE_VERSION_2 = 0x200,
+};
+
 /* no need to save device state */
 enum accfg_device_type {
 	ACCFG_DEVICE_DSA = 0,
test/libaccfg.c +7 -0
index c37b71c..7849d63 100644
@@ -186,6 +186,10 @@ static int config_group(struct accfg_ctx *ctx, struct accfg_device *device,
 				group_param->tokens_allowed));
 	SET_ERR(rc, accfg_group_set_use_token_limit(group,
 				group_param->use_token_limit));
+
+	if (accfg_device_get_version(device) < ACCFG_DEVICE_VERSION_2)
+		return rc;
+
 	SET_ERR(rc, accfg_group_set_traffic_class_a(group,
 				group_param->traffic_class_a));
 	SET_ERR(rc, accfg_group_set_traffic_class_b(group,
@@ -217,6 +221,9 @@ static int check_group(struct accfg_ctx *ctx, struct accfg_device *device,
 		return -EINVAL;
 	}
 
+	if (accfg_device_get_version(device) < ACCFG_DEVICE_VERSION_2)
+		return 0;
+
 	if (group_param->traffic_class_a !=
 			accfg_group_get_traffic_class_a(group)) {
 		fprintf(stderr, "%s failed on traffic_class_a\n", __func__);
Signature · 1 line
2.26.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · ramesh.thomas(a)intel.com

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

A default value will be set by driver for hw versions < 0x200

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
Reviewed-by Dave Jiang <dave.jiang(a)intel.com>
Quoted 49 lines

---
v2:
Use enum for device versions

  accfg/libaccel_config.h | 5 +++++
  test/libaccfg.c         | 7 +++++++
  2 files changed, 12 insertions(+)
accfg/libaccel_config.h +5 -0
index a74571c..f8b9bf9 100644
@@ -27,6 +27,11 @@ extern "C" {
  #define WQ_PRIORITY_LIMIT 15
  #define UUID_ZERO "00000000-0000-0000-0000-000000000000"
 
+enum accfg_device_version {
+	ACCFG_DEVICE_VERSION_1 = 0x100,
+	ACCFG_DEVICE_VERSION_2 = 0x200,
+};
+
  /* no need to save device state */
  enum accfg_device_type {
  	ACCFG_DEVICE_DSA = 0,
test/libaccfg.c +7 -0
index c37b71c..7849d63 100644
@@ -186,6 +186,10 @@ static int config_group(struct accfg_ctx *ctx, struct accfg_device *device,
  				group_param->tokens_allowed));
  	SET_ERR(rc, accfg_group_set_use_token_limit(group,
  				group_param->use_token_limit));
+
+	if (accfg_device_get_version(device) < ACCFG_DEVICE_VERSION_2)
+		return rc;
+
  	SET_ERR(rc, accfg_group_set_traffic_class_a(group,
  				group_param->traffic_class_a));
  	SET_ERR(rc, accfg_group_set_traffic_class_b(group,
@@ -217,6 +221,9 @@ static int check_group(struct accfg_ctx *ctx, struct accfg_device *device,
  		return -EINVAL;
  	}
 
+	if (accfg_device_get_version(device) < ACCFG_DEVICE_VERSION_2)
+		return 0;
+
  	if (group_param->traffic_class_a !=
  			accfg_group_get_traffic_class_a(group)) {
  		fprintf(stderr, "%s failed on traffic_class_a\n", __func__);