diff options
Diffstat (limited to 'drivers/infiniband/hw/cxgb3/iwch_qp.c')
-rw-r--r-- | drivers/infiniband/hw/cxgb3/iwch_qp.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c index dd89b6b91f9c..ea2cdd73dd85 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_qp.c +++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c | |||
@@ -208,36 +208,19 @@ static int iwch_sgl2pbl_map(struct iwch_dev *rhp, struct ib_sge *sg_list, | |||
208 | static int iwch_build_rdma_recv(struct iwch_dev *rhp, union t3_wr *wqe, | 208 | static int iwch_build_rdma_recv(struct iwch_dev *rhp, union t3_wr *wqe, |
209 | struct ib_recv_wr *wr) | 209 | struct ib_recv_wr *wr) |
210 | { | 210 | { |
211 | int i, err = 0; | 211 | int i; |
212 | u32 pbl_addr[4]; | ||
213 | u8 page_size[4]; | ||
214 | if (wr->num_sge > T3_MAX_SGE) | 212 | if (wr->num_sge > T3_MAX_SGE) |
215 | return -EINVAL; | 213 | return -EINVAL; |
216 | err = iwch_sgl2pbl_map(rhp, wr->sg_list, wr->num_sge, pbl_addr, | ||
217 | page_size); | ||
218 | if (err) | ||
219 | return err; | ||
220 | wqe->recv.pagesz[0] = page_size[0]; | ||
221 | wqe->recv.pagesz[1] = page_size[1]; | ||
222 | wqe->recv.pagesz[2] = page_size[2]; | ||
223 | wqe->recv.pagesz[3] = page_size[3]; | ||
224 | wqe->recv.num_sgle = cpu_to_be32(wr->num_sge); | 214 | wqe->recv.num_sgle = cpu_to_be32(wr->num_sge); |
225 | for (i = 0; i < wr->num_sge; i++) { | 215 | for (i = 0; i < wr->num_sge; i++) { |
226 | wqe->recv.sgl[i].stag = cpu_to_be32(wr->sg_list[i].lkey); | 216 | wqe->recv.sgl[i].stag = cpu_to_be32(wr->sg_list[i].lkey); |
227 | wqe->recv.sgl[i].len = cpu_to_be32(wr->sg_list[i].length); | 217 | wqe->recv.sgl[i].len = cpu_to_be32(wr->sg_list[i].length); |
228 | 218 | wqe->recv.sgl[i].to = cpu_to_be64(wr->sg_list[i].addr); | |
229 | /* to in the WQE == the offset into the page */ | ||
230 | wqe->recv.sgl[i].to = cpu_to_be64(((u32) wr->sg_list[i].addr) % | ||
231 | (1UL << (12 + page_size[i]))); | ||
232 | |||
233 | /* pbl_addr is the adapters address in the PBL */ | ||
234 | wqe->recv.pbl_addr[i] = cpu_to_be32(pbl_addr[i]); | ||
235 | } | 219 | } |
236 | for (; i < T3_MAX_SGE; i++) { | 220 | for (; i < T3_MAX_SGE; i++) { |
237 | wqe->recv.sgl[i].stag = 0; | 221 | wqe->recv.sgl[i].stag = 0; |
238 | wqe->recv.sgl[i].len = 0; | 222 | wqe->recv.sgl[i].len = 0; |
239 | wqe->recv.sgl[i].to = 0; | 223 | wqe->recv.sgl[i].to = 0; |
240 | wqe->recv.pbl_addr[i] = 0; | ||
241 | } | 224 | } |
242 | return 0; | 225 | return 0; |
243 | } | 226 | } |
@@ -659,6 +642,7 @@ static void __flush_qp(struct iwch_qp *qhp, unsigned long *flag) | |||
659 | cxio_flush_rq(&qhp->wq, &rchp->cq, count); | 642 | cxio_flush_rq(&qhp->wq, &rchp->cq, count); |
660 | spin_unlock(&qhp->lock); | 643 | spin_unlock(&qhp->lock); |
661 | spin_unlock_irqrestore(&rchp->lock, *flag); | 644 | spin_unlock_irqrestore(&rchp->lock, *flag); |
645 | (*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context); | ||
662 | 646 | ||
663 | /* locking heirarchy: cq lock first, then qp lock. */ | 647 | /* locking heirarchy: cq lock first, then qp lock. */ |
664 | spin_lock_irqsave(&schp->lock, *flag); | 648 | spin_lock_irqsave(&schp->lock, *flag); |
@@ -668,6 +652,7 @@ static void __flush_qp(struct iwch_qp *qhp, unsigned long *flag) | |||
668 | cxio_flush_sq(&qhp->wq, &schp->cq, count); | 652 | cxio_flush_sq(&qhp->wq, &schp->cq, count); |
669 | spin_unlock(&qhp->lock); | 653 | spin_unlock(&qhp->lock); |
670 | spin_unlock_irqrestore(&schp->lock, *flag); | 654 | spin_unlock_irqrestore(&schp->lock, *flag); |
655 | (*schp->ibcq.comp_handler)(&schp->ibcq, schp->ibcq.cq_context); | ||
671 | 656 | ||
672 | /* deref */ | 657 | /* deref */ |
673 | if (atomic_dec_and_test(&qhp->refcnt)) | 658 | if (atomic_dec_and_test(&qhp->refcnt)) |
@@ -678,7 +663,7 @@ static void __flush_qp(struct iwch_qp *qhp, unsigned long *flag) | |||
678 | 663 | ||
679 | static void flush_qp(struct iwch_qp *qhp, unsigned long *flag) | 664 | static void flush_qp(struct iwch_qp *qhp, unsigned long *flag) |
680 | { | 665 | { |
681 | if (t3b_device(qhp->rhp)) | 666 | if (qhp->ibqp.uobject) |
682 | cxio_set_wq_in_error(&qhp->wq); | 667 | cxio_set_wq_in_error(&qhp->wq); |
683 | else | 668 | else |
684 | __flush_qp(qhp, flag); | 669 | __flush_qp(qhp, flag); |
@@ -732,6 +717,7 @@ static int rdma_init(struct iwch_dev *rhp, struct iwch_qp *qhp, | |||
732 | init_attr.qp_dma_addr = qhp->wq.dma_addr; | 717 | init_attr.qp_dma_addr = qhp->wq.dma_addr; |
733 | init_attr.qp_dma_size = (1UL << qhp->wq.size_log2); | 718 | init_attr.qp_dma_size = (1UL << qhp->wq.size_log2); |
734 | init_attr.flags = rqes_posted(qhp) ? RECVS_POSTED : 0; | 719 | init_attr.flags = rqes_posted(qhp) ? RECVS_POSTED : 0; |
720 | init_attr.flags |= capable(CAP_NET_BIND_SERVICE) ? PRIV_QP : 0; | ||
735 | init_attr.irs = qhp->ep->rcv_seq; | 721 | init_attr.irs = qhp->ep->rcv_seq; |
736 | PDBG("%s init_attr.rq_addr 0x%x init_attr.rq_size = %d " | 722 | PDBG("%s init_attr.rq_addr 0x%x init_attr.rq_size = %d " |
737 | "flags 0x%x qpcaps 0x%x\n", __FUNCTION__, | 723 | "flags 0x%x qpcaps 0x%x\n", __FUNCTION__, |
@@ -847,10 +833,11 @@ int iwch_modify_qp(struct iwch_dev *rhp, struct iwch_qp *qhp, | |||
847 | disconnect = 1; | 833 | disconnect = 1; |
848 | ep = qhp->ep; | 834 | ep = qhp->ep; |
849 | } | 835 | } |
836 | flush_qp(qhp, &flag); | ||
850 | break; | 837 | break; |
851 | case IWCH_QP_STATE_TERMINATE: | 838 | case IWCH_QP_STATE_TERMINATE: |
852 | qhp->attr.state = IWCH_QP_STATE_TERMINATE; | 839 | qhp->attr.state = IWCH_QP_STATE_TERMINATE; |
853 | if (t3b_device(qhp->rhp)) | 840 | if (qhp->ibqp.uobject) |
854 | cxio_set_wq_in_error(&qhp->wq); | 841 | cxio_set_wq_in_error(&qhp->wq); |
855 | if (!internal) | 842 | if (!internal) |
856 | terminate = 1; | 843 | terminate = 1; |