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

Zhu, Tony <tony.zhu at intel.com> Wed, 30 Mar 2022 00:58:56 +0000
Newsgroups dev.linux.lists.accel-config
Message-ID <BN9PR11MB54334A75B66106F3F27B4CC68A1F9@BN9PR11MB5433.namprd11.prod.outlook.com>
No confidence to remove the -1 when porting it. 
That value is original used for both shared and dedicated, usually, when shared mode the threshold is less 1 than size(the logic is not good). 
I modified when shared mode loop range equal threshold, but didn't remove -1 for dedicated. 
So the issue happened. 

Tony(zhu, xinzhan)
Cube:SHZ1-3W-279
iNet:8821-5077

-----Original Message-----
From: Jiang, Dave <dave.jiang(a)intel.com> 
Sent: Tuesday, March 29, 2022 11:11 PM
To: Zhu, Tony <tony.zhu(a)intel.com>; accel-config(a)lists.01.org; Thomas, Ramesh <ramesh.thomas(a)intel.com>
Subject: Re: [PATCH 1/1] accel-config/test: fix dedicated mode wq size 1 failure


On 3/29/2022 12:49 AM, Tony Zhu wrote:
> 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>

Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>

Wonder why it was set to size - 1 before.....


> ---
>   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;