Fix posting lists of 256 entries. Same as previous kernel patch.

Signed-off-by: Michael S. Tsirkin <[EMAIL PROTECTED]>

Index: openib/src/userspace/libmthca/src/qp.c
===================================================================
--- openib/src/userspace/libmthca/src/qp.c      (revision 7317)
+++ openib/src/userspace/libmthca/src/qp.c      (working copy)
@@ -332,25 +332,7 @@ int mthca_tavor_post_recv(struct ibv_qp 
 
        ind = qp->rq.next_ind;
 
-       for (nreq = 0; wr; ++nreq, wr = wr->next) {
-               if (nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB) {
-                       nreq = 0;
-
-                       doorbell[0] = htonl((qp->rq.next_ind << 
qp->rq.wqe_shift) | size0);
-                       doorbell[1] = htonl(ibqp->qp_num << 8);
-
-                       /*
-                        * Make sure that descriptors are written
-                        * before doorbell is rung.
-                        */
-                       mb();
-
-                       mthca_write64(doorbell, to_mctx(ibqp->context), 
MTHCA_RECV_DOORBELL);
-
-                       qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB;
-                       size0 = 0;
-               }
-
+       for (nreq = 0; wr; wr = wr->next) {
                if (wq_overflow(&qp->rq, nreq, to_mcq(qp->ibv_qp.recv_cq))) {
                        ret = -1;
                        *bad_wr = wr;
@@ -400,6 +382,24 @@ int mthca_tavor_post_recv(struct ibv_qp 
                ++ind;
                if (ind >= qp->rq.max)
                        ind -= qp->rq.max;
+
+               if (++nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB) {
+                       nreq = 0;
+
+                       doorbell[0] = htonl((qp->rq.next_ind << 
qp->rq.wqe_shift) | size0);
+                       doorbell[1] = htonl(ibqp->qp_num << 8);
+
+                       /*
+                        * Make sure that descriptors are written
+                        * before doorbell is rung.
+                        */
+                       mb();
+
+                       mthca_write64(doorbell, to_mctx(ibqp->context), 
MTHCA_RECV_DOORBELL);
+
+                       qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB;
+                       size0 = 0;
+               }
        }
 
 out:

-- 
MST
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to