Commit 8d0208cb authored by Bryan O'Sullivan's avatar Bryan O'Sullivan Committed by Roland Dreier

IB/ipath: Flush RWQEs if access error or invalid error seen

If the receiver goes into the error state, we need to flush the
posted receive WQEs.
Signed-off-by: default avatarBryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 1fd3b40f
...@@ -335,6 +335,7 @@ static void ipath_reset_qp(struct ipath_qp *qp) ...@@ -335,6 +335,7 @@ static void ipath_reset_qp(struct ipath_qp *qp)
qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE;
qp->r_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; qp->r_ack_state = IB_OPCODE_RC_ACKNOWLEDGE;
qp->r_nak_state = 0; qp->r_nak_state = 0;
qp->r_wrid_valid = 0;
qp->s_rnr_timeout = 0; qp->s_rnr_timeout = 0;
qp->s_head = 0; qp->s_head = 0;
qp->s_tail = 0; qp->s_tail = 0;
...@@ -353,12 +354,13 @@ static void ipath_reset_qp(struct ipath_qp *qp) ...@@ -353,12 +354,13 @@ static void ipath_reset_qp(struct ipath_qp *qp)
/** /**
* ipath_error_qp - put a QP into an error state * ipath_error_qp - put a QP into an error state
* @qp: the QP to put into an error state * @qp: the QP to put into an error state
* @err: the receive completion error to signal if a RWQE is active
* *
* Flushes both send and receive work queues. * Flushes both send and receive work queues.
* QP s_lock should be held and interrupts disabled. * QP s_lock should be held and interrupts disabled.
*/ */
void ipath_error_qp(struct ipath_qp *qp) void ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err)
{ {
struct ipath_ibdev *dev = to_idev(qp->ibqp.device); struct ipath_ibdev *dev = to_idev(qp->ibqp.device);
struct ib_wc wc; struct ib_wc wc;
...@@ -374,7 +376,6 @@ void ipath_error_qp(struct ipath_qp *qp) ...@@ -374,7 +376,6 @@ void ipath_error_qp(struct ipath_qp *qp)
list_del_init(&qp->piowait); list_del_init(&qp->piowait);
spin_unlock(&dev->pending_lock); spin_unlock(&dev->pending_lock);
wc.status = IB_WC_WR_FLUSH_ERR;
wc.vendor_err = 0; wc.vendor_err = 0;
wc.byte_len = 0; wc.byte_len = 0;
wc.imm_data = 0; wc.imm_data = 0;
...@@ -386,6 +387,12 @@ void ipath_error_qp(struct ipath_qp *qp) ...@@ -386,6 +387,12 @@ void ipath_error_qp(struct ipath_qp *qp)
wc.sl = 0; wc.sl = 0;
wc.dlid_path_bits = 0; wc.dlid_path_bits = 0;
wc.port_num = 0; wc.port_num = 0;
if (qp->r_wrid_valid) {
qp->r_wrid_valid = 0;
wc.status = err;
ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1);
}
wc.status = IB_WC_WR_FLUSH_ERR;
while (qp->s_last != qp->s_head) { while (qp->s_last != qp->s_head) {
struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last); struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last);
...@@ -502,7 +509,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, ...@@ -502,7 +509,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
break; break;
case IB_QPS_ERR: case IB_QPS_ERR:
ipath_error_qp(qp); ipath_error_qp(qp, IB_WC_GENERAL_ERR);
break; break;
default: default:
......
...@@ -1293,6 +1293,14 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev, ...@@ -1293,6 +1293,14 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
return 1; return 1;
} }
static void ipath_rc_error(struct ipath_qp *qp, enum ib_wc_status err)
{
spin_lock_irq(&qp->s_lock);
qp->state = IB_QPS_ERR;
ipath_error_qp(qp, err);
spin_unlock_irq(&qp->s_lock);
}
/** /**
* ipath_rc_rcv - process an incoming RC packet * ipath_rc_rcv - process an incoming RC packet
* @dev: the device this packet came in on * @dev: the device this packet came in on
...@@ -1385,8 +1393,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, ...@@ -1385,8 +1393,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
*/ */
if (qp->r_ack_state >= OP(COMPARE_SWAP)) if (qp->r_ack_state >= OP(COMPARE_SWAP))
goto send_ack; goto send_ack;
/* XXX Flush WQEs */ ipath_rc_error(qp, IB_WC_REM_INV_REQ_ERR);
qp->state = IB_QPS_ERR;
qp->r_ack_state = OP(SEND_ONLY); qp->r_ack_state = OP(SEND_ONLY);
qp->r_nak_state = IB_NAK_INVALID_REQUEST; qp->r_nak_state = IB_NAK_INVALID_REQUEST;
qp->r_ack_psn = qp->r_psn; qp->r_ack_psn = qp->r_psn;
...@@ -1492,9 +1499,9 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, ...@@ -1492,9 +1499,9 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
goto nack_inv; goto nack_inv;
ipath_copy_sge(&qp->r_sge, data, tlen); ipath_copy_sge(&qp->r_sge, data, tlen);
qp->r_msn++; qp->r_msn++;
if (opcode == OP(RDMA_WRITE_LAST) || if (!qp->r_wrid_valid)
opcode == OP(RDMA_WRITE_ONLY))
break; break;
qp->r_wrid_valid = 0;
wc.wr_id = qp->r_wr_id; wc.wr_id = qp->r_wr_id;
wc.status = IB_WC_SUCCESS; wc.status = IB_WC_SUCCESS;
wc.opcode = IB_WC_RECV; wc.opcode = IB_WC_RECV;
...@@ -1685,8 +1692,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, ...@@ -1685,8 +1692,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
* is pending though. * is pending though.
*/ */
if (qp->r_ack_state < OP(COMPARE_SWAP)) { if (qp->r_ack_state < OP(COMPARE_SWAP)) {
/* XXX Flush WQEs */ ipath_rc_error(qp, IB_WC_REM_ACCESS_ERR);
qp->state = IB_QPS_ERR;
qp->r_ack_state = OP(RDMA_WRITE_ONLY); qp->r_ack_state = OP(RDMA_WRITE_ONLY);
qp->r_nak_state = IB_NAK_REMOTE_ACCESS_ERROR; qp->r_nak_state = IB_NAK_REMOTE_ACCESS_ERROR;
qp->r_ack_psn = qp->r_psn; qp->r_ack_psn = qp->r_psn;
......
...@@ -229,6 +229,7 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only) ...@@ -229,6 +229,7 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only)
} }
} }
spin_unlock_irqrestore(&rq->lock, flags); spin_unlock_irqrestore(&rq->lock, flags);
qp->r_wrid_valid = 1;
bail: bail:
return ret; return ret;
......
...@@ -365,6 +365,7 @@ struct ipath_qp { ...@@ -365,6 +365,7 @@ struct ipath_qp {
u8 r_min_rnr_timer; /* retry timeout value for RNR NAKs */ u8 r_min_rnr_timer; /* retry timeout value for RNR NAKs */
u8 r_reuse_sge; /* for UC receive errors */ u8 r_reuse_sge; /* for UC receive errors */
u8 r_sge_inx; /* current index into sg_list */ u8 r_sge_inx; /* current index into sg_list */
u8 r_wrid_valid; /* r_wrid set but CQ entry not yet made */
u8 qp_access_flags; u8 qp_access_flags;
u8 s_max_sge; /* size of s_wq->sg_list */ u8 s_max_sge; /* size of s_wq->sg_list */
u8 s_retry_cnt; /* number of times to retry */ u8 s_retry_cnt; /* number of times to retry */
...@@ -639,6 +640,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, ...@@ -639,6 +640,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
int ipath_destroy_qp(struct ib_qp *ibqp); int ipath_destroy_qp(struct ib_qp *ibqp);
void ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err);
int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
int attr_mask, struct ib_udata *udata); int attr_mask, struct ib_udata *udata);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment