[Accel-config] Re: [PATCH] accel-config: Fix a bug in unit test
Dave Jiang <dave.jiang at intel.com>
| Newsgroups | dev.linux.lists.accel-config |
|---|---|
| Message-ID | <[email protected]> |
On 7/1/2021 7:50 PM, ramesh.thomas(a)intel.com wrote:
> From: Ramesh Thomas <ramesh.thomas(a)intel.com>
>
> Configuring wq as "mdev" type when mdev support is not present fails at
> configuration tests. Set the wq type as "user" in the template configs
> and set type as "mdev" only in the mdev tests.
>
> Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>
> ---
> test/libaccfg.c | 25 ++++++++++++++++++++++---
> 1 file changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/test/libaccfg.c b/test/libaccfg.c
> index 93229c6..e5676eb 100644
> --- a/test/libaccfg.c
> +++ b/test/libaccfg.c
> @@ -94,7 +94,7 @@ static struct wq_parameters wq02_param = {
> .max_batch_size = (1 << 8),
> .max_transfer_size = (1l << 30),
> .mode = "shared",
> - .type = "mdev",
> + .type = "user",
> .name = "guest1"
> };
>
> @@ -106,7 +106,7 @@ static struct wq_parameters wq03_param = {
> .max_batch_size = (1 << 9),
> .max_transfer_size = (1l << 31),
> .mode = "dedicated",
> - .type = "mdev",
> + .type = "user",
> .name = "guest2"
> };
>
> @@ -246,7 +246,7 @@ static int config_wq(struct accfg_ctx *ctx, struct accfg_device *device,
> if (wq_param->threshold)
> SET_ERR(rc, accfg_wq_set_threshold(wq, wq_param->threshold));
>
> - return 0;
> + return rc;
> }
>
> static int check_wq(struct accfg_ctx *ctx, struct accfg_device *device,
> @@ -744,6 +744,17 @@ 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)
> +{
> + int rc;
> +
> + rc = accfg_wq_set_str_type(wq, "mdev");
> + if (rc)
> + fprintf(stderr, "Error setting mdev type\n");
> +
> + return rc;
> +}
> +
> static int enable_wq(struct accfg_ctx *ctx, struct accfg_device *device,
> struct accfg_wq *wq)
> {
> @@ -779,6 +790,10 @@ static int test_mdev_1swq(struct accfg_ctx *ctx)
> if (rc)
> return rc;
>
> + rc = set_mdev_type(ctx, test_ctx.wq[2]);
> + if (rc)
> + return rc;
> +
> rc = enable_wq(ctx, test_ctx.device, test_ctx.wq[2]);
> if (rc)
> return rc;
> @@ -808,6 +823,10 @@ static int test_mdev_1dwq(struct accfg_ctx *ctx)
> if (rc)
> return rc;
>
> + rc = set_mdev_type(ctx, test_ctx.wq[3]);
> + if (rc)
> + return rc;
> +
> rc = enable_wq(ctx, test_ctx.device, test_ctx.wq[3]);
> if (rc)
> return rc;