[openib-general] [PATCH] mthca: fix posting lists of 256 entries for tavor
Michael S. Tsirkin
mst at mellanox.co.il
Thu May 18 08:32:54 PDT 2006
If we post a list of length 256 exactly, nreq in doorbell gets set to 256 which
is wrong: should be encoded by 0. This is because we only zero it out on next
WR, which may not be there. The solution is to ring the doorbell after posting
a WQE, not before posting the next one.
Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
Index: linux-2.6.16/drivers/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- linux-2.6.16/drivers/infiniband/hw/mthca/mthca_qp.c (revision 7261)
+++ linux-2.6.16/drivers/infiniband/hw/mthca/mthca_qp.c (working copy)
@@ -1725,23 +1725,7 @@
ind = qp->rq.next_ind;
- for (nreq = 0; wr; ++nreq, wr = wr->next) {
- if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) {
- nreq = 0;
-
- doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
- doorbell[1] = cpu_to_be32(qp->qpn << 8);
-
- wmb();
-
- mthca_write64(doorbell,
- dev->kar + MTHCA_RECEIVE_DOORBELL,
- MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
-
- qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB;
- size0 = 0;
- }
-
+ for (nreq = 0; wr; wr = wr->next) {
if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) {
mthca_err(dev, "RQ %06x full (%u head, %u tail,"
" %d max, %d nreq)\n", qp->qpn,
@@ -1795,6 +1779,22 @@
++ind;
if (unlikely(ind >= qp->rq.max))
ind -= qp->rq.max;
+
+ if (unlikely(++nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) {
+ nreq = 0;
+
+ doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
+ doorbell[1] = cpu_to_be32(qp->qpn << 8);
+
+ wmb();
+
+ mthca_write64(doorbell,
+ dev->kar + MTHCA_RECEIVE_DOORBELL,
+ MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+
+ qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB;
+ size0 = 0;
+ }
}
out:
--
MST
More information about the general
mailing list