accel-config/libaccel-config: Add IAX support
ramesh.thomas at intel.com
PATCH v3 1/1 accel-config/libaccel-config: Add IAX support
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add Intel Analytics Accelerator support.
Changes in v3:
- include v2 change in json object creation
Changes in v2:
- block on fault is available for IAX
--- accfg/config.c | 10 ++++++++++ accfg/lib/libaccfg.c | 3 +++ accfg/libaccel_config.h | 1 + accfg/list.c | 31 +++++++++++++++++++------------ util/json.c | 6 ++++-- 5 files changed, 37 insertions(+), 14 deletions(-)
accfg/config.c +10 -0
@@ -296,6 +296,10 @@ static int group_json_set_val(struct accfg_group *group, json_object *jobj, char *key) {int rc, i; +struct accfg_device *dev =NULL ; + +if (group) + dev =accfg_group_get_device (group);if (!group || !jobj || !key)return -EINVAL ;
@@ -311,6 +315,12 @@ static int group_json_set_val(struct accfg_group *group, || (val < 0))return -EINVAL ; +if ((accfg_device_get_type (dev) ==ACCFG_DEVICE_IAX ) + && ((!strcmp (group_table[i].name,"tokens_reserved" )) + || (!strcmp (group_table[i].name,"use_token_limit" )) + || (!strcmp (group_table[i].name,"tokens_allowed" )))) { +return 0 ; + }if (group_table[i].is_writable && !group_table[i].is_writable (group, val))
accfg/lib/libaccfg.c +3 -0
@@ -39,6 +39,7 @@ static int filename_prefix_len; ACCFG_EXPORT char *accfg_basenames[] = { [ACCFG_DEVICE_DSA ] ="dsa" , + [ACCFG_DEVICE_IAX ] ="iax" ,NULL };
@@ -397,6 +398,8 @@ static int device_parse_type(struct accfg_device *device)if (!strcmp (device->device_type_str,"dsa" )) device->type =ACCFG_DEVICE_DSA ; +else if (!strcmp (device->device_type_str,"iax" )) + device->type =ACCFG_DEVICE_IAX ;else device->type =ACCFG_DEVICE_TYPE_UNKNOWN ;
accfg/libaccel_config.h +1 -0
@@ -31,6 +31,7 @@ extern "C" {/* no need to save device state */ enum accfg_device_type {ACCFG_DEVICE_DSA =0 , +ACCFG_DEVICE_IAX =1 ,ACCFG_DEVICE_TYPE_UNKNOWN =-1 , };
accfg/list.c +19 -12
@@ -54,6 +54,10 @@ static struct json_object *group_to_json(struct accfg_group *group, {struct json_object *jgroup =json_object_new_object ();struct json_object *jobj =NULL ; +struct accfg_device *dev =NULL ; + +if (group) + dev =accfg_group_get_device (group);if (!jgroup)return NULL ;
@@ -67,20 +71,23 @@ static struct json_object *group_to_json(struct accfg_group *group,if (!jobj) goto err; -json_object_object_add (jgroup,"tokens_reserved" , jobj); - jobj =json_object_new_int (accfg_group_get_use_token_limit (group)); -if (!jobj) - goto err; +if (accfg_device_get_type (dev) !=ACCFG_DEVICE_IAX ) { +json_object_object_add (jgroup,"tokens_reserved" , jobj); + jobj =json_object_new_int (accfg_group_get_use_token_limit (group)); +if (!jobj) + goto err; -json_object_object_add (jgroup,"use_token_limit" , jobj); - jobj =json_object_new_int (accfg_group_get_tokens_allowed (group)); -if (!jobj) - goto err; +json_object_object_add (jgroup,"use_token_limit" , jobj); + jobj =json_object_new_int (accfg_group_get_tokens_allowed (group)); +if (!jobj) + goto err; -json_object_object_add (jgroup,"tokens_allowed" , jobj); - jobj =json_object_new_int (accfg_group_get_traffic_class_a (group)); -if (!jobj) - goto err; +json_object_object_add (jgroup,"tokens_allowed" , jobj); + jobj =json_object_new_int (accfg_group_get_traffic_class_a ( + group)); +if (!jobj) + goto err; + }json_object_object_add (jgroup,"traffic_class_a" , jobj); jobj = json_object_new_int(accfg_group_get_traffic_class_b(
util/json.c +4 -2
@@ -178,7 +178,8 @@ struct json_object *util_device_to_json(struct accfg_device *device, jobj =json_object_new_int (accfg_device_get_token_limit (device));if (!jobj) goto err; -json_object_object_add (jdevice,"token_limit" , jobj); +if (accfg_device_get_type (device) !=ACCFG_DEVICE_IAX ) +json_object_object_add (jdevice,"token_limit" , jobj);if (flags &UTIL_JSON_SAVE ) {free (error);
@@ -277,7 +278,8 @@ struct json_object *util_device_to_json(struct accfg_device *device, jobj =json_object_new_int (accfg_device_get_max_tokens (device));if (!jobj) goto err; -json_object_object_add (jdevice,"max_tokens" , jobj); +if (accfg_device_get_type (device) !=ACCFG_DEVICE_IAX ) +json_object_object_add (jdevice,"max_tokens" , jobj); ulong_val =accfg_device_get_max_batch_size (device);if (ulong_val >0 ) {
Signature · 1 line
2.26.2
Jiang
Quoted 15 lines
-----Original Message-----
From: ramesh.thomas(a)intel.com <ramesh.thomas(a)intel.com>
Sent: Wednesday, November 18, 2020 2:14 PM
To: accel-config(a)lists.01.org
Cc: Thomas, Ramesh <ramesh.thomas(a)intel.com>; Luck, Tony <tony.luck(a)intel.com>; Jiang, Dave <dave.jiang(a)intel.com>; Zhu, Tony <tony.zhu(a)intel.com>
Subject: [PATCH v3] accel-config/libaccel-config: Add IAX supportFrom: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add Intel Analytics Accelerator support.
Quoted 8 lines
Changes in v3:
- include v2 change in json object creationChanges in v2:
- block on fault is available for IAXSigned-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>Signed-off-by Dave Jiang <dave.jiang(a)intel.com>
Looks good!
Quoted 161 lines
--- accfg/config.c | 10 ++++++++++ accfg/lib/libaccfg.c | 3 +++ accfg/libaccel_config.h | 1 + accfg/list.c | 31 +++++++++++++++++++------------ util/json.c | 6 ++++-- 5 files changed, 37 insertions(+), 14 deletions(-)accfg/config.c +4
-0@@ -296,6 +296,10 @@ static int group_json_set_val(struct accfg_group *group, json_object *jobj, char *key) {int rc, i; +struct accfg_device *dev =NULL ; + +if (group) + dev =accfg_group_get_device (group);if (!group || !jobj || !key)accfg/config.c +3
-0return -EINVAL ;@@ -311,6 +315,12 @@ static int group_json_set_val(struct accfg_group *group, || (val < 0))return -EINVAL ; + if ((accfg_device_get_type(dev) == ACCFG_DEVICE_IAX) + && ((!strcmp(group_table[i].name, "tokens_reserved")) + || (!strcmp(group_table[i].name,"
use_token_limit"))accfg/config.c +1
-0+ || (!strcmp(group_table[i].name,"
tokens_allowed")))) {accfg/config.c +2
-0+return 0 ; + }if (group_table[i].is_writable && !group_table[i].is_writable (group, val))accfg/lib/libaccfg.c index 70553f7..cd9da42 renamed from accfg/lib/libaccfg.c +0
-0100644
accfg/lib/libaccfg.c +3
-0@@ -39,6 +39,7 @@ static int filename_prefix_len; ACCFG_EXPORT char *accfg_basenames[] = { [ACCFG_DEVICE_DSA ] ="dsa" , + [ACCFG_DEVICE_IAX ] ="iax" ,NULL };@@ -397,6 +398,8 @@ static int device_parse_type(struct accfg_device *device)if (!strcmp (device->device_type_str,"dsa" )) device->type =ACCFG_DEVICE_DSA ; +else if (!strcmp (device->device_type_str,"iax" )) + device->type =ACCFG_DEVICE_IAX ;else device->type =ACCFG_DEVICE_TYPE_UNKNOWN ;accfg/libaccel_config.h index renamed from accfg/libaccel_config.h +0
-0392188e..f85670c 100644
accfg/libaccel_config.h +1
-0@@ -31,6 +31,7 @@ extern "C" {/* no need to save device state */ enum accfg_device_type {ACCFG_DEVICE_DSA =0 , +ACCFG_DEVICE_IAX =1 ,ACCFG_DEVICE_TYPE_UNKNOWN =-1 , };accfg/list.c +13
-10@@ -54,6 +54,10 @@ static struct json_object *group_to_json(struct accfg_group *group, {struct json_object *jgroup =json_object_new_object ();struct json_object *jobj =NULL ; +struct accfg_device *dev =NULL ; + +if (group) + dev =accfg_group_get_device (group);if (!jgroup)return NULL ;@@ -67,20 +71,23 @@ static struct json_object *group_to_json(struct accfg_group *group, if (!jobj) goto err; -json_object_object_add (jgroup,"tokens_reserved" , jobj); - jobj =json_object_new_int (accfg_group_get_use_token_limit (group)); -if (!jobj) - goto err; +if (accfg_device_get_type (dev) !=ACCFG_DEVICE_IAX ) { +json_object_object_add (jgroup,"tokens_reserved" , jobj); + jobj =json_object_new_int (accfg_group_get_use_token_limit (group)); +if (!jobj) + goto err; -json_object_object_add (jgroup,"use_token_limit" , jobj); - jobj =json_object_new_int (accfg_group_get_tokens_allowed (group)); -if (!jobj) - goto err; +json_object_object_add (jgroup,"use_token_limit" , jobj); + jobj =json_object_new_int (accfg_group_get_tokens_allowed (group)); +if (!jobj) + goto err; -json_object_object_add (jgroup,"tokens_allowed" , jobj); - jobj =json_object_new_int(accfg_group_get_traffic_class_a(group));
accfg/list.c +2
-2-if (!jobj) - goto err; +json_object_object_add (jgroup,"tokens_allowed" , jobj); + jobj =json_object_new_int(accfg_group_get_traffic_class_a(
accfg/list.c +4
-0+ group)); +if (!jobj) + goto err; + }json_object_object_add (jgroup,"traffic_class_a" , jobj); jobj = json_object_new_int(accfg_group_get_traffic_class_b(util/json.c +2
-1@@ -178,7 +178,8 @@ struct json_object *util_device_to_json(structaccfg_device *device, jobj =json_object_new_int (accfg_device_get_token_limit (device));if (!jobj) goto err; -json_object_object_add (jdevice,"token_limit" , jobj); +if (accfg_device_get_type (device) !=ACCFG_DEVICE_IAX ) +json_object_object_add (jdevice,"token_limit" , jobj);if (flags &UTIL_JSON_SAVE ) {util/json.c +2
-1free (error);@@ -277,7 +278,8 @@ struct json_object *util_device_to_json(structaccfg_device *device, jobj =json_object_new_int (accfg_device_get_max_tokens (device));if (!jobj) goto err; -json_object_object_add (jdevice,"max_tokens" , jobj); +if (accfg_device_get_type (device) !=ACCFG_DEVICE_IAX ) +json_object_object_add (jdevice,"max_tokens" , jobj);util/json.c +0
-1ulong_val =accfg_device_get_max_batch_size (device);if (ulong_val >0 ) { --2.26.2
Luck
Quoted 12 lines · ramesh.thomas(a)intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add Intel Analytics Accelerator support.
Changes in v3:
- include v2 change in json object creationChanges in v2:
- block on fault is available for IAXSigned-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>Signed-off-by Dave Jiang <dave.jiang(a)intel.com>
Quoted 7 lines
--- accfg/config.c | 10 ++++++++++ accfg/lib/libaccfg.c | 3 +++ accfg/libaccel_config.h | 1 + accfg/list.c | 31 +++++++++++++++++++------------ util/json.c | 6 ++++-- 5 files changed, 37 insertions(+), 14 deletions(-)
Ramesh,
Just a note to point out that the convention is to put the history information after the "---" line and before the diffstat.
This is because projects don't really want the history of each patch preserved in the GIT commit history for all time. The "git am" tool automatically stops saving the commit comment at the "---" line.
-Tony
Thomas
Quoted 23 lines · Tony Luck
Quoted 12 lines · ramesh.thomas(a)intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add Intel Analytics Accelerator support.
Changes in v3:
- include v2 change in json object creationChanges in v2:
- block on fault is available for IAXSigned-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>Signed-off-by Dave Jiang <dave.jiang(a)intel.com>Quoted 7 lines
--- accfg/config.c | 10 ++++++++++ accfg/lib/libaccfg.c | 3 +++ accfg/libaccel_config.h | 1 + accfg/list.c | 31 +++++++++++++++++++------------ util/json.c | 6 ++++-- 5 files changed, 37 insertions(+), 14 deletions(-)Ramesh,
Quoted 8 lines
Just a note to point out that the convention is to put the history information after the "---" line and before the diffstat.
This is because projects don't really want the history of each patch preserved in the GIT commit history for all time. The "git am" tool automatically stops saving the commit comment at the "---" line.
-Tony
Hi Tony,
Thanks for bringing that to my attention and also your feedbacks. I will remove the history from the commit when I merge to the stable branch.
Regards,
Ramesh