aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRalph Campbell <ralph.campbell@qlogic.com>2007-08-25 19:48:29 -0400
committerRoland Dreier <rolandd@cisco.com>2007-10-09 23:50:29 -0400
commitc9cf7db2bca9180f5888eebc23dc607666a9685b (patch)
tree5503c082c930bf69d1f0b0b05d131e4e03347b23 /drivers
parent036be09ca55ee8512c05742f4f6b88911d012a90 (diff)
IB/ipath: Generate flush CQE when QP is in error state
Follow the IB spec. (C10-96) for post send which states that a flushed completion event should be generated for work requests posted when a QP is in the error state. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 3cc82b62b3c5..495194bb84a5 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -230,6 +230,18 @@ void ipath_skip_sge(struct ipath_sge_state *ss, u32 length)
230 } 230 }
231} 231}
232 232
233static void ipath_flush_wqe(struct ipath_qp *qp, struct ib_send_wr *wr)
234{
235 struct ib_wc wc;
236
237 memset(&wc, 0, sizeof(wc));
238 wc.wr_id = wr->wr_id;
239 wc.status = IB_WC_WR_FLUSH_ERR;
240 wc.opcode = ib_ipath_wc_opcode[wr->opcode];
241 wc.qp = &qp->ibqp;
242 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1);
243}
244
233/** 245/**
234 * ipath_post_one_send - post one RC, UC, or UD send work request 246 * ipath_post_one_send - post one RC, UC, or UD send work request
235 * @qp: the QP to post on 247 * @qp: the QP to post on
@@ -248,8 +260,14 @@ static int ipath_post_one_send(struct ipath_qp *qp, struct ib_send_wr *wr)
248 spin_lock_irqsave(&qp->s_lock, flags); 260 spin_lock_irqsave(&qp->s_lock, flags);
249 261
250 /* Check that state is OK to post send. */ 262 /* Check that state is OK to post send. */
251 if (!(ib_ipath_state_ops[qp->state] & IPATH_POST_SEND_OK)) 263 if (unlikely(!(ib_ipath_state_ops[qp->state] & IPATH_POST_SEND_OK))) {
252 goto bail_inval; 264 if (qp->state != IB_QPS_SQE && qp->state != IB_QPS_ERR)
265 goto bail_inval;
266 /* C10-96 says generate a flushed completion entry. */
267 ipath_flush_wqe(qp, wr);
268 ret = 0;
269 goto bail;
270 }
253 271
254 /* IB spec says that num_sge == 0 is OK. */ 272 /* IB spec says that num_sge == 0 is OK. */
255 if (wr->num_sge > qp->s_max_sge) 273 if (wr->num_sge > qp->s_max_sge)