From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============1506338593019930141==" MIME-Version: 1.0 From: Dave Jiang Subject: [Accel-config] Re: [PATCH] accel-config: Fix a bug in unit test Date: Tue, 06 Jul 2021 08:33:30 -0700 Message-ID: <7af561cb-c9cd-e488-744b-e0e77441ebb9@intel.com> In-Reply-To: 20210702025026.1046344-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============1506338593019930141== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On 7/1/2021 7:50 PM, ramesh.thomas(a)intel.com wrote: > From: Ramesh Thomas > > 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 Reviewed-by: Dave Jiang > --- > 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 =3D { > .max_batch_size =3D (1 << 8), > .max_transfer_size =3D (1l << 30), > .mode =3D "shared", > - .type =3D "mdev", > + .type =3D "user", > .name =3D "guest1" > }; > = > @@ -106,7 +106,7 @@ static struct wq_parameters wq03_param =3D { > .max_batch_size =3D (1 << 9), > .max_transfer_size =3D (1l << 31), > .mode =3D "dedicated", > - .type =3D "mdev", > + .type =3D "user", > .name =3D "guest2" > }; > = > @@ -246,7 +246,7 @@ static int config_wq(struct accfg_ctx *ctx, struct ac= cfg_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 a= ccfg_device *device, > return 0; > } > = > +static int set_mdev_type(struct accfg_ctx *ctx, struct accfg_wq *wq) > +{ > + int rc; > + > + rc =3D 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 =3D set_mdev_type(ctx, test_ctx.wq[2]); > + if (rc) > + return rc; > + > rc =3D 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 =3D set_mdev_type(ctx, test_ctx.wq[3]); > + if (rc) > + return rc; > + > rc =3D enable_wq(ctx, test_ctx.device, test_ctx.wq[3]); > if (rc) > return rc; --===============1506338593019930141==--