IB/ipath: Fix RDMA write with immediate copy of last packet

When the last packet of a RDMA write with immediate is received, the
next receive work queue entry ID should be used to generate a completion
entry. The code was incorrectly resetting part of the state used to copy
the last packet.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

authored by Ralph Campbell and committed by Roland Dreier a8b56f29 332edc2f

+5 -5
+5 -5
drivers/infiniband/hw/ipath/ipath_ruc.c
··· 156 156 /** 157 157 * ipath_get_rwqe - copy the next RWQE into the QP's RWQE 158 158 * @qp: the QP 159 - * @wr_id_only: update wr_id only, not SGEs 159 + * @wr_id_only: update qp->r_wr_id only, not qp->r_sge 160 160 * 161 161 * Return 0 if no RWQE is available, otherwise return 1. 162 162 * ··· 172 172 void (*handler)(struct ib_event *, void *); 173 173 u32 tail; 174 174 int ret; 175 - 176 - qp->r_sge.sg_list = qp->r_sg_list; 177 175 178 176 if (qp->ibqp.srq) { 179 177 srq = to_isrq(qp->ibqp.srq); ··· 204 206 wqe = get_rwqe_ptr(rq, tail); 205 207 if (++tail >= rq->size) 206 208 tail = 0; 207 - } while (!wr_id_only && !ipath_init_sge(qp, wqe, &qp->r_len, 208 - &qp->r_sge)); 209 + if (wr_id_only) 210 + break; 211 + qp->r_sge.sg_list = qp->r_sg_list; 212 + } while (!ipath_init_sge(qp, wqe, &qp->r_len, &qp->r_sge)); 209 213 qp->r_wr_id = wqe->wr_id; 210 214 wq->tail = tail; 211 215