* [PATCH rdma-core v2] providers/rxe: Replace '%' with '&' in check_qp_queue_full()
@ 2022-01-21 6:22 Xiao Yang
2022-01-21 6:47 ` Bob Pearson
2022-01-23 11:04 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: Xiao Yang @ 2022-01-21 6:22 UTC (permalink / raw)
To: linux-rdma; +Cc: rpearsonhpe, jgg, leon, Xiao Yang
The expression "cons == ((qp->cur_index + 1) % q->index_mask)" doesn't
check the state of queue (full or empty) correctly. For example:
If cons and qp->cur_index are 0 and q->index_mask is 1, the queue is actually
empty but check_qp_queue_full() reports full (ENOSPC).
Fixes: 1a894ca10105 ("Providers/rxe: Implement ibv_create_qp_ex verb")
Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
providers/rxe/rxe_queue.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/rxe/rxe_queue.h b/providers/rxe/rxe_queue.h
index 6de8140c..708e76ac 100644
--- a/providers/rxe/rxe_queue.h
+++ b/providers/rxe/rxe_queue.h
@@ -205,7 +205,7 @@ static inline int check_qp_queue_full(struct rxe_qp *qp)
if (qp->err)
goto err;
- if (cons == ((qp->cur_index + 1) % q->index_mask))
+ if (cons == ((qp->cur_index + 1) & q->index_mask))
qp->err = ENOSPC;
err:
return qp->err;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH rdma-core v2] providers/rxe: Replace '%' with '&' in check_qp_queue_full()
2022-01-21 6:22 [PATCH rdma-core v2] providers/rxe: Replace '%' with '&' in check_qp_queue_full() Xiao Yang
@ 2022-01-21 6:47 ` Bob Pearson
2022-01-23 11:04 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Bob Pearson @ 2022-01-21 6:47 UTC (permalink / raw)
To: Xiao Yang, linux-rdma; +Cc: jgg, leon
On 1/21/22 00:22, Xiao Yang wrote:
> The expression "cons == ((qp->cur_index + 1) % q->index_mask)" doesn't
> check the state of queue (full or empty) correctly. For example:
> If cons and qp->cur_index are 0 and q->index_mask is 1, the queue is actually
> empty but check_qp_queue_full() reports full (ENOSPC).
>
> Fixes: 1a894ca10105 ("Providers/rxe: Implement ibv_create_qp_ex verb")
> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> ---
> providers/rxe/rxe_queue.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/providers/rxe/rxe_queue.h b/providers/rxe/rxe_queue.h
> index 6de8140c..708e76ac 100644
> --- a/providers/rxe/rxe_queue.h
> +++ b/providers/rxe/rxe_queue.h
> @@ -205,7 +205,7 @@ static inline int check_qp_queue_full(struct rxe_qp *qp)
> if (qp->err)
> goto err;
>
> - if (cons == ((qp->cur_index + 1) % q->index_mask))
> + if (cons == ((qp->cur_index + 1) & q->index_mask))
> qp->err = ENOSPC;
> err:
> return qp->err;
>
This is fine.
Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH rdma-core v2] providers/rxe: Replace '%' with '&' in check_qp_queue_full()
2022-01-21 6:22 [PATCH rdma-core v2] providers/rxe: Replace '%' with '&' in check_qp_queue_full() Xiao Yang
2022-01-21 6:47 ` Bob Pearson
@ 2022-01-23 11:04 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-01-23 11:04 UTC (permalink / raw)
To: Xiao Yang; +Cc: linux-rdma, rpearsonhpe, jgg
On Fri, Jan 21, 2022 at 02:22:22PM +0800, Xiao Yang wrote:
> The expression "cons == ((qp->cur_index + 1) % q->index_mask)" doesn't
> check the state of queue (full or empty) correctly. For example:
> If cons and qp->cur_index are 0 and q->index_mask is 1, the queue is actually
> empty but check_qp_queue_full() reports full (ENOSPC).
>
> Fixes: 1a894ca10105 ("Providers/rxe: Implement ibv_create_qp_ex verb")
> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> ---
> providers/rxe/rxe_queue.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Thanks, applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-23 11:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-21 6:22 [PATCH rdma-core v2] providers/rxe: Replace '%' with '&' in check_qp_queue_full() Xiao Yang
2022-01-21 6:47 ` Bob Pearson
2022-01-23 11:04 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox