[Accel-config] Re: [PATCH] accel-config: Set wq name after setting mdev type

Dave Jiang <dave.jiang at intel.com> Tue, 20 Jul 2021 08:52:19 -0700
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
On 7/19/2021 8:44 PM, ramesh.thomas(a)intel.com wrote:
> From: Ramesh Thomas <ramesh.thomas(a)intel.com>
>
> Setting mdev type resets the name. After setting mdev set the name again
> from the template.
>
> Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>

Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>


> ---
>   test/libaccfg.c | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/test/libaccfg.c b/test/libaccfg.c
> index 57d97f2..516adbc 100644
> --- a/test/libaccfg.c
> +++ b/test/libaccfg.c
> @@ -764,7 +764,8 @@ static int mdev_test(struct accfg_ctx *ctx, struct accfg_device *device,
>   	return 0;
>   }
>   
> -static int set_mdev_type(struct accfg_ctx *ctx, struct accfg_wq *wq)
> +static int set_mdev_type(struct accfg_ctx *ctx, struct accfg_wq *wq,
> +		struct wq_parameters *wq_param)
>   {
>   	int rc;
>   
> @@ -772,6 +773,10 @@ static int set_mdev_type(struct accfg_ctx *ctx, struct accfg_wq *wq)
>   	if (rc)
>   		fprintf(stderr, "Error setting mdev type\n");
>   
> +	rc = accfg_wq_set_str_name(wq, wq_param->name);
> +	if (rc)
> +		fprintf(stderr, "Error setting name for mdev type wq\n");
> +
>   	return rc;
>   }
>   
> @@ -810,7 +815,7 @@ static int test_mdev_1swq(struct accfg_ctx *ctx)
>   	if (rc)
>   		return rc;
>   
> -	rc = set_mdev_type(ctx, test_ctx.wq[2]);
> +	rc = set_mdev_type(ctx, test_ctx.wq[2], test_ctx.wq_param[2]);
>   	if (rc)
>   		return rc;
>   
> @@ -843,7 +848,7 @@ static int test_mdev_1dwq(struct accfg_ctx *ctx)
>   	if (rc)
>   		return rc;
>   
> -	rc = set_mdev_type(ctx, test_ctx.wq[3]);
> +	rc = set_mdev_type(ctx, test_ctx.wq[3], test_ctx.wq_param[3]);
>   	if (rc)
>   		return rc;
>