[Accel-config] [PATCH] accel-config: Do not fail shared wq tests if platform does not support shared wqs
ramesh.thomas at intel.com Tue, 10 Aug 2021 22:55:44 -0400
| Newsgroups | dev.linux.lists.accel-config |
|---|---|
| Message-ID | <[email protected]> |
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
If shared wq is not supported by platform use dedicated mode to avoid
failing batch configuration tests
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
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 accfg_device *device,
{
int rc = 0;
- SET_ERR(rc, accfg_wq_set_str_mode(wq, wq_param->mode));
+ rc = accfg_wq_set_str_mode(wq, wq_param->mode);
+ if (rc == -EINVAL) {
+ fprintf(stderr, "%s shared wq not supported, configuring as dedicated\n",
+ __func__);
+ rc = 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 accfg_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) == 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 !=
+ if (accfg_wq_get_mode(wq) == ACCFG_WQ_SHARED && wq_param->threshold !=
(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]) != ACCFG_WQ_SHARED) {
+ fprintf(stderr, "%s shared wq not supported\n", __func__);
+ return -EOPNOTSUPP;
+ }
+
rc = set_mdev_type(ctx, test_ctx.wq[2], test_ctx.wq_param[2]);
if (rc)
return rc;
--
2.26.3