Content-Type: multipart/mixed; boundary="===============0679313910331071176==" MIME-Version: 1.0 From: ramesh.thomas at intel.com Subject: [Accel-config] [PATCH 2/3] accel-config/test: Split config func to handle sh and ded wqs Date: Wed, 11 Aug 2021 22:34:27 -0400 Message-ID: <20210812023428.1185313-3-ramesh.thomas@intel.com> In-Reply-To: 20210812023428.1185313-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============0679313910331071176== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ramesh Thomas Split config functions and related tests into 2 functions handling shared and dedicated wqs separately. Signed-off-by: Ramesh Thomas --- test/libaccfg.c | 69 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/test/libaccfg.c b/test/libaccfg.c index 44e10df..9ac4bcd 100644 --- a/test/libaccfg.c +++ b/test/libaccfg.c @@ -394,7 +394,8 @@ static void test_cleanup(struct accfg_ctx *ctx) device_test_reset(ctx, device, true); } = -static int set_config(struct accfg_ctx *ctx, struct config_test_ctx *ct_ct= x) +static int set_config(struct accfg_ctx *ctx, struct config_test_ctx *ct_ct= x, + char *wq_mode) { int rc =3D 0; struct accfg_device *device; @@ -422,6 +423,9 @@ static int set_config(struct accfg_ctx *ctx, struct con= fig_test_ctx *ct_ctx) } = for (i =3D 0; i < 4; i++) { + if (wq_mode && strcmp(ct_ctx->wq_param[i]->mode, wq_mode)) + continue; + wq =3D ct_ctx->wq[i]; printf("configuring wq %s\n", accfg_wq_get_devname(wq)); rc =3D config_wq(ctx, device, wq, ct_ctx->wq_param[i]); @@ -444,7 +448,8 @@ static int set_config(struct accfg_ctx *ctx, struct con= fig_test_ctx *ct_ctx) return 0; } = -static int check_config(struct accfg_ctx *ctx, struct config_test_ctx *ct_= ctx) +static int check_config(struct accfg_ctx *ctx, struct config_test_ctx *ct_= ctx, + char *wq_mode) { int rc =3D 0; struct accfg_device *device; @@ -472,6 +477,9 @@ static int check_config(struct accfg_ctx *ctx, struct c= onfig_test_ctx *ct_ctx) } = for (i =3D 0; i < 4; i++) { + if (wq_mode && strcmp(ct_ctx->wq_param[i]->mode, wq_mode)) + continue; + wq =3D ct_ctx->wq[i]; printf("check wq %s\n", accfg_wq_get_devname(wq)); rc =3D check_wq(ctx, device, wq, ct_ctx->wq_param[i]); @@ -519,17 +527,17 @@ static int set_exceed_config(struct accfg_ctx *ctx, } = /* configure 2 wqs with some wq sizes */ - wq =3D ct_ctx->wq[0]; + wq =3D ct_ctx->wq[1]; printf("configuring wq %s\n", accfg_wq_get_devname(wq)); - rc =3D config_wq(ctx, device, wq, ct_ctx->wq_param[0]); + rc =3D config_wq(ctx, device, wq, ct_ctx->wq_param[1]); if (rc) { fprintf(stderr, "config wq failed\n"); return rc; } = - wq =3D ct_ctx->wq[2]; + wq =3D ct_ctx->wq[3]; printf("configuring wq %s\n", accfg_wq_get_devname(wq)); - rc =3D config_wq(ctx, device, wq, ct_ctx->wq_param[2]); + rc =3D config_wq(ctx, device, wq, ct_ctx->wq_param[3]); if (rc) { fprintf(stderr, "config wq failed\n"); return rc; @@ -561,7 +569,7 @@ static int wq_bounds_test(struct accfg_ctx *ctx, struct= config_test_ctx *ct_ctx) = device =3D ct_ctx->device; group =3D ct_ctx->group[0]; - wq =3D ct_ctx->wq[0]; + wq =3D ct_ctx->wq[1]; = printf("configure device %s, group %s, wq %s for bounds test\n", accfg_device_get_devname(device), @@ -580,7 +588,7 @@ static int wq_bounds_test(struct accfg_ctx *ctx, struct= config_test_ctx *ct_ctx) return rc; } = - rc =3D config_wq(ctx, device, wq, ct_ctx->wq_param[0]); + rc =3D config_wq(ctx, device, wq, ct_ctx->wq_param[1]); if (rc) { fprintf(stderr, "config wq failed\n"); return rc; @@ -659,8 +667,8 @@ static int fill_test_ctx(struct accfg_ctx *ctx) return 0; } = -/* test the set and get libaccfg functions */ -static int test_config(struct accfg_ctx *ctx) +/* test set and get libaccfg functions for shared wqs */ +static int test_config_shared(struct accfg_ctx *ctx) { int rc =3D 0; = @@ -668,11 +676,35 @@ static int test_config(struct accfg_ctx *ctx) if (rc) return rc; = - rc =3D set_config(ctx, &test_ctx); + rc =3D set_config(ctx, &test_ctx, "shared"); if (rc) return rc; = - rc =3D check_config(ctx, &test_ctx); + rc =3D check_config(ctx, &test_ctx, "shared"); + if (rc) + return rc; + + rc =3D device_test_reset(ctx, test_ctx.device, false); + if (rc) + return rc; + + return 0; +} + +/* test set and get libaccfg functions for dedicated wqs */ +static int test_config_dedicated(struct accfg_ctx *ctx) +{ + int rc =3D 0; + + rc =3D device_test_reset(ctx, test_ctx.device, false); + if (rc) + return rc; + + rc =3D set_config(ctx, &test_ctx, "dedicated"); + if (rc) + return rc; + + rc =3D check_config(ctx, &test_ctx, "dedicated"); if (rc) return rc; = @@ -814,7 +846,7 @@ static int test_mdev_1swq(struct accfg_ctx *ctx) if (rc) return rc; = - rc =3D set_config(ctx, &test_ctx); + rc =3D set_config(ctx, &test_ctx, NULL); if (rc) return rc; = @@ -850,7 +882,7 @@ static int test_mdev_1dwq(struct accfg_ctx *ctx) if (rc) return rc; = - rc =3D set_config(ctx, &test_ctx); + rc =3D set_config(ctx, &test_ctx, NULL); if (rc) return rc; = @@ -883,8 +915,13 @@ struct _test_case { = static struct _test_case test_cases[] =3D { { - .test_fn =3D test_config, - .desc =3D "set and get configurations", + .test_fn =3D test_config_shared, + .desc =3D "set and get configurations for shared wqs", + .enabled =3D true, + }, + { + .test_fn =3D test_config_dedicated, + .desc =3D "set and get configurations for dedicated wqs", .enabled =3D true, }, { -- = 2.26.3 --===============0679313910331071176==--