All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiang, Dave <dave.jiang at intel.com>
To: accel-config@lists.01.org
Subject: [Accel-config] Re: [PATCH v1] accel-config/libaccel-config: Add IAX support
Date: Wed, 18 Nov 2020 17:46:44 +0000	[thread overview]
Message-ID: <5e79f3dac6bf4a9fb1e062f4be24a216@intel.com> (raw)
In-Reply-To: 20201118173922.170288-1-ramesh.thomas@intel.com

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



> -----Original Message-----
> From: ramesh.thomas(a)intel.com <ramesh.thomas(a)intel.com>
> Sent: Wednesday, November 18, 2020 10:39 AM
> 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 v1] accel-config/libaccel-config: Add IAX support
> 
> From: Ramesh Thomas <ramesh.thomas(a)intel.com>
> 
> Add Intel Analytics Accelerator support.
> 
> Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
> Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
> ---
>  accfg/config.c          | 18 ++++++++++++++++++
>  accfg/lib/libaccfg.c    |  3 +++
>  accfg/libaccel_config.h |  1 +
>  accfg/list.c            | 31 +++++++++++++++++++------------
>  util/json.c             | 16 ++++++++++++----
>  5 files changed, 53 insertions(+), 16 deletions(-)
> 
> diff --git a/accfg/config.c b/accfg/config.c index 3887873..c0d9333 100644
> --- a/accfg/config.c
> +++ b/accfg/config.c
> @@ -234,6 +234,10 @@ static int device_json_set_val(struct accfg_device
> *dev, json_object *jobj,  static int wq_json_set_val(struct accfg_wq *wq,
> json_object *jobj, char *key)  {
>  	int rc, i;
> +	struct accfg_device *dev = NULL;
> +
> +	if (wq)
> +		dev = accfg_wq_get_device(wq);
> 
>  	if (!wq || !jobj || !key)
>  		return -EINVAL;
> @@ -249,6 +253,10 @@ static int wq_json_set_val(struct accfg_wq *wq,
> json_object *jobj, char *key)
>  				if ((val == 0) && (errno == EINVAL))
>  					return -errno;
> 
> +				if ((accfg_device_get_type(dev) ==
> ACCFG_DEVICE_IAX)
> +					&& (!strcmp(wq_table[i].name,
> "block_on_fault"))) {
> +					return 0;
> +				}

One quick fix. Remove this please. They made IAX parity with DSA and the change is coming with D stepping. So IAX will support block on fault toggle. 

- Dave

>  				if (wq_table[i].is_writable &&
>  					!wq_table[i].is_writable(wq, val))
>  					return 0;
> @@ -296,6 +304,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 +323,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))
> diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c index 70553f7..cd9da42
> 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[] = {
>          [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;
> 
> 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 = 0,
> +	ACCFG_DEVICE_IAX = 1,
>  	ACCFG_DEVICE_TYPE_UNKNOWN = -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 = 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(
> diff --git a/util/json.c b/util/json.c
> index 3bf8950..bb3ee88 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 = 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) {
> @@ -353,8 +355,12 @@ struct json_object *util_wq_to_json(struct
> accfg_wq *wq,
>  	unsigned long size = ULLONG_MAX;
>  	enum accfg_wq_mode wq_mode;
>  	enum accfg_wq_state wq_state;
> +	struct accfg_device *dev = NULL;
>  	int int_val;
> 
> +	if (wq)
> +		dev = accfg_wq_get_device(wq);
> +
>  	if (!jaccfg)
>  		return NULL;
> 
> @@ -396,8 +402,10 @@ struct json_object *util_wq_to_json(struct
> accfg_wq *wq,
>  	}
> 
>  	jobj = json_object_new_int(accfg_wq_get_block_on_fault(wq));
> -	if (jobj)
> -		json_object_object_add(jaccfg, "block_on_fault", jobj);
> +	if (jobj) {
> +		if (accfg_device_get_type(dev) != ACCFG_DEVICE_IAX)
> +			json_object_object_add(jaccfg, "block_on_fault",
> jobj);
> +	}
> 
>  	jobj = json_object_new_int(accfg_wq_get_max_batch_size(wq));
>  	if (jobj)
> --
> 2.26.2

             reply	other threads:[~2020-11-18 17:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 17:46 Jiang, Dave [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-11-18 17:56 [Accel-config] Re: [PATCH v1] accel-config/libaccel-config: Add IAX support Luck, Tony

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e79f3dac6bf4a9fb1e062f4be24a216@intel.com \
    --to=accel-config@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.