From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============1299960068326897575==" MIME-Version: 1.0 From: Jiang, Dave Subject: [Accel-config] Re: [PATCH v3] accel-config/libaccel-config: Add IAX support Date: Wed, 18 Nov 2020 21:16:42 +0000 Message-ID: In-Reply-To: 20201118211417.184724-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============1299960068326897575== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: ramesh.thomas(a)intel.com > Sent: Wednesday, November 18, 2020 2:14 PM > To: accel-config(a)lists.01.org > Cc: Thomas, Ramesh ; Luck, Tony > ; Jiang, Dave ; Zhu, Tony > > Subject: [PATCH v3] accel-config/libaccel-config: Add IAX support > = > From: Ramesh Thomas > = > 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 > = > Signed-off-by: Ramesh Thomas > Signed-off-by: Dave Jiang Looks good! > --- > 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(-) > = > diff --git a/accfg/config.c b/accfg/config.c index 3887873..d36f1d9 100644 > --- a/accfg/config.c > +++ b/accfg/config.c > @@ -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 =3D NULL; > + > + if (group) > + dev =3D 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) =3D=3D > 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)) > diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c index 70553f7..c= d9da42 > 100644 > --- a/accfg/lib/libaccfg.c > +++ b/accfg/lib/libaccfg.c > @@ -39,6 +39,7 @@ static int filename_prefix_len; > = > ACCFG_EXPORT char *accfg_basenames[] =3D { > [ACCFG_DEVICE_DSA] =3D "dsa", > + [ACCFG_DEVICE_IAX] =3D "iax", > NULL > }; > = > @@ -397,6 +398,8 @@ static int device_parse_type(struct accfg_device > *device) > = > if (!strcmp(device->device_type_str, "dsa")) > device->type =3D ACCFG_DEVICE_DSA; > + else if (!strcmp(device->device_type_str, "iax")) > + device->type =3D ACCFG_DEVICE_IAX; > else > device->type =3D ACCFG_DEVICE_TYPE_UNKNOWN; > = > diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h index > 392188e..f85670c 100644 > --- a/accfg/libaccel_config.h > +++ b/accfg/libaccel_config.h > @@ -31,6 +31,7 @@ extern "C" { > /* no need to save device state */ > enum accfg_device_type { > ACCFG_DEVICE_DSA =3D 0, > + ACCFG_DEVICE_IAX =3D 1, > ACCFG_DEVICE_TYPE_UNKNOWN =3D -1, > }; > = > diff --git a/accfg/list.c b/accfg/list.c index dfaac1f..c22da41 100644 > --- a/accfg/list.c > +++ b/accfg/list.c > @@ -54,6 +54,10 @@ static struct json_object *group_to_json(struct > accfg_group *group, { > struct json_object *jgroup =3D json_object_new_object(); > struct json_object *jobj =3D NULL; > + struct accfg_device *dev =3D NULL; > + > + if (group) > + dev =3D 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 =3D > json_object_new_int(accfg_group_get_use_token_limit(group)); > - if (!jobj) > - goto err; > + if (accfg_device_get_type(dev) !=3D ACCFG_DEVICE_IAX) { > + json_object_object_add(jgroup, "tokens_reserved", jobj); > + jobj =3D > 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 =3D > json_object_new_int(accfg_group_get_tokens_allowed(group)); > - if (!jobj) > - goto err; > + json_object_object_add(jgroup, "use_token_limit", jobj); > + jobj =3D > json_object_new_int(accfg_group_get_tokens_allowed(group)); > + if (!jobj) > + goto err; > = > - json_object_object_add(jgroup, "tokens_allowed", jobj); > - jobj =3D > json_object_new_int(accfg_group_get_traffic_class_a(group)); > - if (!jobj) > - goto err; > + json_object_object_add(jgroup, "tokens_allowed", jobj); > + jobj =3D > 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 =3D json_object_new_int(accfg_group_get_traffic_class_b( > diff --git a/util/json.c b/util/json.c > index 3bf8950..6f4b4d1 100644 > --- a/util/json.c > +++ b/util/json.c > @@ -178,7 +178,8 @@ struct json_object *util_device_to_json(struct > accfg_device *device, > jobj =3D 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) !=3D 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 =3D > 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) !=3D ACCFG_DEVICE_IAX) > + json_object_object_add(jdevice, "max_tokens", jobj); > = > ulong_val =3D accfg_device_get_max_batch_size(device); > if (ulong_val > 0) { > -- > 2.26.2 --===============1299960068326897575==--