IB/rdmavt: Post receive for QP in ERR state
Accordingly IB Spec post WR to receive queue must complete with error if QP is in Error state. Please refer to C10-42, C10-97.2.1 Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Alex Estrin <alex.estrin@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
d0e859c328
commit
000a830efd
|
@ -1364,6 +1364,8 @@ int rvt_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
|
||||||
struct rvt_qp *qp = ibqp_to_rvtqp(ibqp);
|
struct rvt_qp *qp = ibqp_to_rvtqp(ibqp);
|
||||||
struct rvt_rwq *wq = qp->r_rq.wq;
|
struct rvt_rwq *wq = qp->r_rq.wq;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
int qp_err_flush = (ib_rvt_state_ops[qp->state] & RVT_FLUSH_RECV) &&
|
||||||
|
!qp->ibqp.srq;
|
||||||
|
|
||||||
/* Check that state is OK to post receive. */
|
/* Check that state is OK to post receive. */
|
||||||
if (!(ib_rvt_state_ops[qp->state] & RVT_POST_RECV_OK) || !wq) {
|
if (!(ib_rvt_state_ops[qp->state] & RVT_POST_RECV_OK) || !wq) {
|
||||||
|
@ -1390,15 +1392,28 @@ int rvt_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
|
||||||
*bad_wr = wr;
|
*bad_wr = wr;
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
if (unlikely(qp_err_flush)) {
|
||||||
|
struct ib_wc wc;
|
||||||
|
|
||||||
wqe = rvt_get_rwqe_ptr(&qp->r_rq, wq->head);
|
memset(&wc, 0, sizeof(wc));
|
||||||
wqe->wr_id = wr->wr_id;
|
wc.qp = &qp->ibqp;
|
||||||
wqe->num_sge = wr->num_sge;
|
wc.opcode = IB_WC_RECV;
|
||||||
for (i = 0; i < wr->num_sge; i++)
|
wc.wr_id = wr->wr_id;
|
||||||
wqe->sg_list[i] = wr->sg_list[i];
|
wc.status = IB_WC_WR_FLUSH_ERR;
|
||||||
/* Make sure queue entry is written before the head index. */
|
rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc, 1);
|
||||||
smp_wmb();
|
} else {
|
||||||
wq->head = next;
|
wqe = rvt_get_rwqe_ptr(&qp->r_rq, wq->head);
|
||||||
|
wqe->wr_id = wr->wr_id;
|
||||||
|
wqe->num_sge = wr->num_sge;
|
||||||
|
for (i = 0; i < wr->num_sge; i++)
|
||||||
|
wqe->sg_list[i] = wr->sg_list[i];
|
||||||
|
/*
|
||||||
|
* Make sure queue entry is written
|
||||||
|
* before the head index.
|
||||||
|
*/
|
||||||
|
smp_wmb();
|
||||||
|
wq->head = next;
|
||||||
|
}
|
||||||
spin_unlock_irqrestore(&qp->r_rq.lock, flags);
|
spin_unlock_irqrestore(&qp->r_rq.lock, flags);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue