[openib-general] [PATCH] mthca: fix posting list of 256 to SRQ
Michael S. Tsirkin
mst at mellanox.co.il
Wed May 24 08:27:07 PDT 2006
Here's the same patch for kernel.
---
Fix posting WQE lists of length 246 to SRQ for tavor.
This is really the same bug we fixed for non-shared RQ.
Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
Index: linux-2.6.16/drivers/infiniband/hw/mthca/mthca_srq.c
===================================================================
--- linux-2.6.16.orig/drivers/infiniband/hw/mthca/mthca_srq.c 2006-05-24 18:07:24.000000000 +0300
+++ linux-2.6.16/drivers/infiniband/hw/mthca/mthca_srq.c 2006-05-24 18:07:19.000000000 +0300
@@ -490,26 +490,7 @@ int mthca_tavor_post_srq_recv(struct ib_
first_ind = srq->first_free;
- 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(first_ind << srq->wqe_shift);
- doorbell[1] = cpu_to_be32(srq->srqn << 8);
-
- /*
- * Make sure that descriptors are written
- * before doorbell is rung.
- */
- wmb();
-
- mthca_write64(doorbell,
- dev->kar + MTHCA_RECEIVE_DOORBELL,
- MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
-
- first_ind = srq->first_free;
- }
-
+ for (nreq = 0; wr; wr = wr->next) {
ind = srq->first_free;
if (ind < 0) {
@@ -569,6 +550,25 @@ int mthca_tavor_post_srq_recv(struct ib_
srq->wrid[ind] = wr->wr_id;
srq->first_free = next_ind;
+
+ if (unlikely(++nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) {
+ nreq = 0;
+
+ doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift);
+ doorbell[1] = cpu_to_be32(srq->srqn << 8);
+
+ /*
+ * Make sure that descriptors are written
+ * before doorbell is rung.
+ */
+ wmb();
+
+ mthca_write64(doorbell,
+ dev->kar + MTHCA_RECEIVE_DOORBELL,
+ MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+
+ first_ind = srq->first_free;
+ }
}
if (likely(nreq)) {
--
MST
More information about the general
mailing list