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.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index b3daf39eed4a..1720dc790d13 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -55,7 +55,7 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
55 V_FW_RI_RES_WR_NRES(1) | 55 V_FW_RI_RES_WR_NRES(1) |
56 FW_WR_COMPL(1)); 56 FW_WR_COMPL(1));
57 res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16)); 57 res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16));
58 res_wr->cookie = (u64)&wr_wait; 58 res_wr->cookie = (unsigned long) &wr_wait;
59 res = res_wr->res; 59 res = res_wr->res;
60 res->u.cq.restype = FW_RI_RES_TYPE_CQ; 60 res->u.cq.restype = FW_RI_RES_TYPE_CQ;
61 res->u.cq.op = FW_RI_RES_OP_RESET; 61 res->u.cq.op = FW_RI_RES_OP_RESET;
@@ -64,14 +64,7 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
64 c4iw_init_wr_wait(&wr_wait); 64 c4iw_init_wr_wait(&wr_wait);
65 ret = c4iw_ofld_send(rdev, skb); 65 ret = c4iw_ofld_send(rdev, skb);
66 if (!ret) { 66 if (!ret) {
67 wait_event_timeout(wr_wait.wait, wr_wait.done, C4IW_WR_TO); 67 ret = c4iw_wait_for_reply(rdev, &wr_wait, 0, 0, __func__);
68 if (!wr_wait.done) {
69 printk(KERN_ERR MOD "Device %s not responding!\n",
70 pci_name(rdev->lldi.pdev));
71 rdev->flags = T4_FATAL_ERROR;
72 ret = -EIO;
73 } else
74 ret = wr_wait.ret;
75 } 68 }
76 69
77 kfree(cq->sw_queue); 70 kfree(cq->sw_queue);
@@ -132,7 +125,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
132 V_FW_RI_RES_WR_NRES(1) | 125 V_FW_RI_RES_WR_NRES(1) |
133 FW_WR_COMPL(1)); 126 FW_WR_COMPL(1));
134 res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16)); 127 res_wr->len16_pkd = cpu_to_be32(DIV_ROUND_UP(wr_len, 16));
135 res_wr->cookie = (u64)&wr_wait; 128 res_wr->cookie = (unsigned long) &wr_wait;
136 res = res_wr->res; 129 res = res_wr->res;
137 res->u.cq.restype = FW_RI_RES_TYPE_CQ; 130 res->u.cq.restype = FW_RI_RES_TYPE_CQ;
138 res->u.cq.op = FW_RI_RES_OP_WRITE; 131 res->u.cq.op = FW_RI_RES_OP_WRITE;
@@ -157,14 +150,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
157 if (ret) 150 if (ret)
158 goto err4; 151 goto err4;
159 PDBG("%s wait_event wr_wait %p\n", __func__, &wr_wait); 152 PDBG("%s wait_event wr_wait %p\n", __func__, &wr_wait);
160 wait_event_timeout(wr_wait.wait, wr_wait.done, C4IW_WR_TO); 153 ret = c4iw_wait_for_reply(rdev, &wr_wait, 0, 0, __func__);
161 if (!wr_wait.done) {
162 printk(KERN_ERR MOD "Device %s not responding!\n",
163 pci_name(rdev->lldi.pdev));
164 rdev->flags = T4_FATAL_ERROR;
165 ret = -EIO;
166 } else
167 ret = wr_wait.ret;
168 if (ret) 154 if (ret)
169 goto err4; 155 goto err4;
170 156
@@ -476,6 +462,11 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe,
476 goto proc_cqe; 462 goto proc_cqe;
477 } 463 }
478 464
465 if (CQE_OPCODE(hw_cqe) == FW_RI_TERMINATE) {
466 ret = -EAGAIN;
467 goto skip_cqe;
468 }
469
479 /* 470 /*
480 * RECV completion. 471 * RECV completion.
481 */ 472 */
@@ -696,6 +687,7 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc)
696 case T4_ERR_MSN_RANGE: 687 case T4_ERR_MSN_RANGE:
697 case T4_ERR_IRD_OVERFLOW: 688 case T4_ERR_IRD_OVERFLOW:
698 case T4_ERR_OPCODE: 689 case T4_ERR_OPCODE:
690 case T4_ERR_INTERNAL_ERR:
699 wc->status = IB_WC_FATAL_ERR; 691 wc->status = IB_WC_FATAL_ERR;
700 break; 692 break;
701 case T4_ERR_SWFLUSH: 693 case T4_ERR_SWFLUSH:
@@ -809,6 +801,10 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
809 if (ucontext) { 801 if (ucontext) {
810 memsize = roundup(memsize, PAGE_SIZE); 802 memsize = roundup(memsize, PAGE_SIZE);
811 hwentries = memsize / sizeof *chp->cq.queue; 803 hwentries = memsize / sizeof *chp->cq.queue;
804 while (hwentries > T4_MAX_IQ_SIZE) {
805 memsize -= PAGE_SIZE;
806 hwentries = memsize / sizeof *chp->cq.queue;
807 }
812 } 808 }
813 chp->cq.size = hwentries; 809 chp->cq.size = hwentries;
814 chp->cq.memsize = memsize; 810 chp->cq.memsize = memsize;