aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2013-08-06 11:34:36 -0400
committerRoland Dreier <roland@purestorage.com>2013-08-13 14:55:46 -0400
commit27ca34f54a70cb85895aa7147a6c35f1cd07fa55 (patch)
tree460c3cad1c580ce0070c8312c0311f982d6fffda /drivers/infiniband
parent1cf24dcef4e1dd0c34d8c39b09a9ce9a01accc72 (diff)
RDMA/cxgb4: Fix accounting for unsignaled SQ WRs to deal with wrap
When determining how many WRs are completed with a signaled CQE, correctly deal with queue wraps. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Vipul Pandya <vipul@chelsio.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/cxgb4/cq.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index 6657390de956..88de3aa9c5b0 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -611,9 +611,12 @@ proc_cqe:
611 * to the first unsignaled one, and idx points to the 611 * to the first unsignaled one, and idx points to the
612 * signaled one. So adjust in_use based on this delta. 612 * signaled one. So adjust in_use based on this delta.
613 * if this is not completing any unsigned wrs, then the 613 * if this is not completing any unsigned wrs, then the
614 * delta will be 0. 614 * delta will be 0. Handle wrapping also!
615 */ 615 */
616 wq->sq.in_use -= idx - wq->sq.cidx; 616 if (idx < wq->sq.cidx)
617 wq->sq.in_use -= wq->sq.size + idx - wq->sq.cidx;
618 else
619 wq->sq.in_use -= idx - wq->sq.cidx;
617 BUG_ON(wq->sq.in_use < 0 && wq->sq.in_use < wq->sq.size); 620 BUG_ON(wq->sq.in_use < 0 && wq->sq.in_use < wq->sq.size);
618 621
619 wq->sq.cidx = (uint16_t)idx; 622 wq->sq.cidx = (uint16_t)idx;