Content-Type: multipart/mixed; boundary="===============8068346039740851865==" MIME-Version: 1.0 From: ramesh.thomas at intel.com Subject: [Accel-config] [PATCH] accel-config: Do not fail shared wq tests if platform does not support shared wqs Date: Tue, 10 Aug 2021 22:55:44 -0400 Message-ID: <20210811025544.1182713-1-ramesh.thomas@intel.com> To: accel-config@lists.01.org List-ID: --===============8068346039740851865== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ramesh Thomas If shared wq is not supported by platform use dedicated mode to avoid failing batch configuration tests Signed-off-by: Ramesh Thomas --- test/libaccfg.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/libaccfg.c b/test/libaccfg.c index 516adbc..a982344 100644 --- a/test/libaccfg.c +++ b/test/libaccfg.c @@ -244,7 +244,13 @@ static int config_wq(struct accfg_ctx *ctx, struct acc= fg_device *device, { int rc =3D 0; = - SET_ERR(rc, accfg_wq_set_str_mode(wq, wq_param->mode)); + rc =3D accfg_wq_set_str_mode(wq, wq_param->mode); + if (rc =3D=3D -EINVAL) { + fprintf(stderr, "%s shared wq not supported, configuring as dedicated\n", + __func__); + rc =3D accfg_wq_set_str_mode(wq, "dedicated"); + } + SET_ERR(rc, accfg_wq_set_str_type(wq, wq_param->type)); SET_ERR(rc, accfg_wq_set_str_name(wq, wq_param->name)); SET_ERR(rc, accfg_wq_set_size(wq, wq_param->wq_size)); @@ -254,7 +260,7 @@ static int config_wq(struct accfg_ctx *ctx, struct accf= g_device *device, SET_ERR(rc, accfg_wq_set_max_batch_size(wq, wq_param->max_batch_size)); SET_ERR(rc, accfg_wq_set_max_transfer_size(wq, wq_param->max_transfer_size)); - if (wq_param->threshold) + if (wq_param->threshold && accfg_wq_get_mode(wq) =3D=3D ACCFG_WQ_SHARED) SET_ERR(rc, accfg_wq_set_threshold(wq, wq_param->threshold)); = SET_ERR(rc, accfg_wq_set_ats_disable(wq, wq_param->ats_disable)); @@ -288,7 +294,7 @@ static int check_wq(struct accfg_ctx *ctx, struct accfg= _device *device, fprintf(stderr, "%s failed on block_on_fault\n", __func__); return -EINVAL; } - if (wq_param->threshold !=3D + if (accfg_wq_get_mode(wq) =3D=3D ACCFG_WQ_SHARED && wq_param->threshold != =3D (unsigned int)accfg_wq_get_threshold(wq)) { fprintf(stderr, "%s failed on threshold\n", __func__); return -EINVAL; @@ -815,6 +821,11 @@ static int test_mdev_1swq(struct accfg_ctx *ctx) if (rc) return rc; = + if (accfg_wq_get_mode(test_ctx.wq[2]) !=3D ACCFG_WQ_SHARED) { + fprintf(stderr, "%s shared wq not supported\n", __func__); + return -EOPNOTSUPP; + } + rc =3D set_mdev_type(ctx, test_ctx.wq[2], test_ctx.wq_param[2]); if (rc) return rc; -- = 2.26.3 --===============8068346039740851865==--