aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/cxgb4/cq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/cxgb4/cq.c')
-rw-r--r--drivers/infiniband/hw/cxgb4/cq.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index ce468e542428..cfaa56ada189 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -235,27 +235,21 @@ int c4iw_flush_sq(struct c4iw_qp *qhp)
235 struct t4_cq *cq = &chp->cq; 235 struct t4_cq *cq = &chp->cq;
236 int idx; 236 int idx;
237 struct t4_swsqe *swsqe; 237 struct t4_swsqe *swsqe;
238 int error = (qhp->attr.state != C4IW_QP_STATE_CLOSING &&
239 qhp->attr.state != C4IW_QP_STATE_IDLE);
240 238
241 if (wq->sq.flush_cidx == -1) 239 if (wq->sq.flush_cidx == -1)
242 wq->sq.flush_cidx = wq->sq.cidx; 240 wq->sq.flush_cidx = wq->sq.cidx;
243 idx = wq->sq.flush_cidx; 241 idx = wq->sq.flush_cidx;
244 BUG_ON(idx >= wq->sq.size); 242 BUG_ON(idx >= wq->sq.size);
245 while (idx != wq->sq.pidx) { 243 while (idx != wq->sq.pidx) {
246 if (error) { 244 swsqe = &wq->sq.sw_sq[idx];
247 swsqe = &wq->sq.sw_sq[idx]; 245 BUG_ON(swsqe->flushed);
248 BUG_ON(swsqe->flushed); 246 swsqe->flushed = 1;
249 swsqe->flushed = 1; 247 insert_sq_cqe(wq, cq, swsqe);
250 insert_sq_cqe(wq, cq, swsqe); 248 if (wq->sq.oldest_read == swsqe) {
251 if (wq->sq.oldest_read == swsqe) { 249 BUG_ON(swsqe->opcode != FW_RI_READ_REQ);
252 BUG_ON(swsqe->opcode != FW_RI_READ_REQ); 250 advance_oldest_read(wq);
253 advance_oldest_read(wq);
254 }
255 flushed++;
256 } else {
257 t4_sq_consume(wq);
258 } 251 }
252 flushed++;
259 if (++idx == wq->sq.size) 253 if (++idx == wq->sq.size)
260 idx = 0; 254 idx = 0;
261 } 255 }
@@ -678,7 +672,7 @@ skip_cqe:
678static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc) 672static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc)
679{ 673{
680 struct c4iw_qp *qhp = NULL; 674 struct c4iw_qp *qhp = NULL;
681 struct t4_cqe cqe = {0, 0}, *rd_cqe; 675 struct t4_cqe uninitialized_var(cqe), *rd_cqe;
682 struct t4_wq *wq; 676 struct t4_wq *wq;
683 u32 credit = 0; 677 u32 credit = 0;
684 u8 cqe_flushed; 678 u8 cqe_flushed;