All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core RESEND] providers/rxe: Replace '%' with '&' in check_qp_queue_full()
@ 2022-01-11  2:24 Xiao Yang
  2022-01-11  4:12 ` Devesh Sharma
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Xiao Yang @ 2022-01-11  2:24 UTC (permalink / raw)
  To: rpearsonhpe, leon; +Cc: linux-rdma, Xiao Yang

The expression "cons == ((qp->cur_index + 1) % q->index_mask)" mistakenly
assumes the queue is full when the number of entires is equal to "maximum - 1"
(maximum is correct).

For example:
If cons and qp->cur_index are 0 and q->index_mask is 1, check_qp_queue_full()
reports 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] 9+ messages in thread

end of thread, other threads:[~2022-01-18  8:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11  2:24 [PATCH rdma-core RESEND] providers/rxe: Replace '%' with '&' in check_qp_queue_full() Xiao Yang
2022-01-11  4:12 ` Devesh Sharma
2022-01-11  9:10   ` yangx.jy
2022-01-11 10:21     ` Devesh Sharma
2022-01-11  6:11 ` Leon Romanovsky
2022-01-11  9:19   ` yangx.jy
2022-01-11 10:47     ` Leon Romanovsky
2022-01-12  3:39       ` yangx.jy
2022-01-18  8:37 ` yangx.jy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.