[Accel-config] [PATCH 1/1] accel-config/test: fix dedicated mode wq size 1 failure

Tony Zhu <tony.zhu at intel.com> Tue, 29 Mar 2022 15:49:11 +0800
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
dsa_test fails on dedicated WQ size 1, the root cause is if the size is
1 and subtract 1, it is 0. So it is looped there. The correct way is
if it is shared mode, the test range is threshold. If it is dedicated,
the test range is wq size, don't need to subtract 1.

Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
---
 test/dsa_test.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/dsa_test.c b/test/dsa_test.c
index 8e8dc25..f593cdf 100644
--- a/test/dsa_test.c
+++ b/test/dsa_test.c
@@ -51,7 +51,7 @@ static int test_batch(struct dsa_context *ctx, size_t buf_size,
 	if (ctx->dedicated == ACCFG_WQ_SHARED)
 		range = ctx->threshold;
 	else
-		range = ctx->wq_size - 1;
+		range = ctx->wq_size;
 
 	while (itr > 0 && rc == DSA_STATUS_OK) {
 		i = (itr < range) ? itr : range;
@@ -226,7 +226,7 @@ static int test_dif(struct dsa_context *ctx, size_t buf_size,
 	if (ctx->dedicated == ACCFG_WQ_SHARED)
 		range = ctx->threshold;
 	else
-		range = ctx->wq_size - 1;
+		range = ctx->wq_size;
 
 	while (itr > 0 && rc == DSA_STATUS_OK) {
 		i = (itr < range) ? itr : range;
@@ -303,7 +303,7 @@ static int test_noop(struct dsa_context *ctx, int tflags, int num_desc)
 	if (ctx->dedicated == ACCFG_WQ_SHARED)
 		range = ctx->threshold;
 	else
-		range = ctx->wq_size - 1;
+		range = ctx->wq_size;
 
 	while (itr > 0 && rc == DSA_STATUS_OK) {
 		i = (itr < range) ? itr : range;
@@ -353,7 +353,7 @@ static int test_memory(struct dsa_context *ctx, size_t buf_size,
 	if (ctx->dedicated == ACCFG_WQ_SHARED)
 		range = ctx->threshold;
 	else
-		range = ctx->wq_size - 1;
+		range = ctx->wq_size;
 
 	while (itr > 0 && rc == DSA_STATUS_OK) {
 		i = (itr < range) ? itr : range;
@@ -514,7 +514,7 @@ static int test_delta(struct dsa_context *ctx, size_t buf_size,
 	if (ctx->dedicated == ACCFG_WQ_SHARED)
 		range = ctx->threshold;
 	else
-		range = ctx->wq_size - 1;
+		range = ctx->wq_size;
 
 	while (itr > 0 && rc == DSA_STATUS_OK) {
 		i = (itr < range) ? itr : range;
@@ -584,7 +584,7 @@ static int test_crc(struct dsa_context *ctx, size_t buf_size,
 	if (ctx->dedicated == ACCFG_WQ_SHARED)
 		range = ctx->threshold;
 	else
-		range = ctx->wq_size - 1;
+		range = ctx->wq_size;
 
 	while (itr > 0 && rc == DSA_STATUS_OK) {
 		i = (itr < range) ? itr : range;
-- 
2.27.0