Merge commit 'v2.6.28-rc7' into core/locking
[sfrench/cifs-2.6.git] / drivers / infiniband / hw / ipath / ipath_ruc.c
index fc0f6d9e6030f04f5412975f4d2102c67267cbd7..2296832f94da868e3c2f884bfbcd2d9e94cc4fed 100644 (file)
@@ -156,7 +156,7 @@ bail:
 /**
  * ipath_get_rwqe - copy the next RWQE into the QP's RWQE
  * @qp: the QP
- * @wr_id_only: update wr_id only, not SGEs
+ * @wr_id_only: update qp->r_wr_id only, not qp->r_sge
  *
  * Return 0 if no RWQE is available, otherwise return 1.
  *
@@ -173,8 +173,6 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only)
        u32 tail;
        int ret;
 
-       qp->r_sge.sg_list = qp->r_sg_list;
-
        if (qp->ibqp.srq) {
                srq = to_isrq(qp->ibqp.srq);
                handler = srq->ibsrq.event_handler;
@@ -206,8 +204,10 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only)
                wqe = get_rwqe_ptr(rq, tail);
                if (++tail >= rq->size)
                        tail = 0;
-       } while (!wr_id_only && !ipath_init_sge(qp, wqe, &qp->r_len,
-                                               &qp->r_sge));
+               if (wr_id_only)
+                       break;
+               qp->r_sge.sg_list = qp->r_sg_list;
+       } while (!ipath_init_sge(qp, wqe, &qp->r_len, &qp->r_sge));
        qp->r_wr_id = wqe->wr_id;
        wq->tail = tail;