Skip to content

Commit

Permalink
RDMA/cxgb4: CQ size must be IQ size - 2
Browse files Browse the repository at this point in the history
We need 1 extra entry for the status page and 1 to always have 1 free
entry to detect when the queue is full.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Steve Wise authored and Roland Dreier committed May 25, 2010
1 parent 1c01c53 commit 895cf5f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/infiniband/hw/cxgb4/cq.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,9 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
/* account for the status page. */
entries++;

/* IQ needs one extra entry to differentiate full vs empty. */
entries++;

/*
* entries must be multiple of 16 for HW.
*/
Expand All @@ -801,7 +804,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,

chp->rhp = rhp;
chp->cq.size--; /* status page */
chp->ibcq.cqe = chp->cq.size;
chp->ibcq.cqe = chp->cq.size - 1;
spin_lock_init(&chp->lock);
atomic_set(&chp->refcnt, 1);
init_waitqueue_head(&chp->wait);
Expand Down

0 comments on commit 895cf5f

Please sign in to comment.