aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2016-11-03 15:09:38 -0400
committerDoug Ledford <dledford@redhat.com>2016-11-16 20:10:36 -0500
commit5c6b2aaf9316fd0983c0c999d920306ddc65bd2d (patch)
treef1f6f98a80c3b67904bd00dc8329f46eef32abb7
parent4ff522ea47944ffd3d4d27023ace8bc6a722c834 (diff)
iw_cxgb4: invalidate the mr when posting a read_w_inv wr
Also, rearrange things a bit to have a common c4iw_invalidate_mr() function used everywhere that we need to invalidate. Fixes: 49b53a93a64a ("iw_cxgb4: add fast-path for small REG_MR operations") Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/hw/cxgb4/cq.c17
-rw-r--r--drivers/infiniband/hw/cxgb4/iw_cxgb4.h2
-rw-r--r--drivers/infiniband/hw/cxgb4/mem.c12
-rw-r--r--drivers/infiniband/hw/cxgb4/qp.c16
4 files changed, 24 insertions, 23 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index 867b8cf82be8..19c6477af19f 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -666,18 +666,6 @@ skip_cqe:
666 return ret; 666 return ret;
667} 667}
668 668
669static void invalidate_mr(struct c4iw_dev *rhp, u32 rkey)
670{
671 struct c4iw_mr *mhp;
672 unsigned long flags;
673
674 spin_lock_irqsave(&rhp->lock, flags);
675 mhp = get_mhp(rhp, rkey >> 8);
676 if (mhp)
677 mhp->attr.state = 0;
678 spin_unlock_irqrestore(&rhp->lock, flags);
679}
680
681/* 669/*
682 * Get one cq entry from c4iw and map it to openib. 670 * Get one cq entry from c4iw and map it to openib.
683 * 671 *
@@ -733,7 +721,7 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc)
733 CQE_OPCODE(&cqe) == FW_RI_SEND_WITH_SE_INV) { 721 CQE_OPCODE(&cqe) == FW_RI_SEND_WITH_SE_INV) {
734 wc->ex.invalidate_rkey = CQE_WRID_STAG(&cqe); 722 wc->ex.invalidate_rkey = CQE_WRID_STAG(&cqe);
735 wc->wc_flags |= IB_WC_WITH_INVALIDATE; 723 wc->wc_flags |= IB_WC_WITH_INVALIDATE;
736 invalidate_mr(qhp->rhp, wc->ex.invalidate_rkey); 724 c4iw_invalidate_mr(qhp->rhp, wc->ex.invalidate_rkey);
737 } 725 }
738 } else { 726 } else {
739 switch (CQE_OPCODE(&cqe)) { 727 switch (CQE_OPCODE(&cqe)) {
@@ -762,7 +750,8 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc)
762 750
763 /* Invalidate the MR if the fastreg failed */ 751 /* Invalidate the MR if the fastreg failed */
764 if (CQE_STATUS(&cqe) != T4_ERR_SUCCESS) 752 if (CQE_STATUS(&cqe) != T4_ERR_SUCCESS)
765 invalidate_mr(qhp->rhp, CQE_WRID_FR_STAG(&cqe)); 753 c4iw_invalidate_mr(qhp->rhp,
754 CQE_WRID_FR_STAG(&cqe));
766 break; 755 break;
767 default: 756 default:
768 printk(KERN_ERR MOD "Unexpected opcode %d " 757 printk(KERN_ERR MOD "Unexpected opcode %d "
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
index 7e7f79e55006..4788e1a46fde 100644
--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
@@ -999,6 +999,6 @@ extern int db_coalescing_threshold;
999extern int use_dsgl; 999extern int use_dsgl;
1000void c4iw_drain_rq(struct ib_qp *qp); 1000void c4iw_drain_rq(struct ib_qp *qp);
1001void c4iw_drain_sq(struct ib_qp *qp); 1001void c4iw_drain_sq(struct ib_qp *qp);
1002 1002void c4iw_invalidate_mr(struct c4iw_dev *rhp, u32 rkey);
1003 1003
1004#endif 1004#endif
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
index 80e27749420a..410408f886c1 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
@@ -770,3 +770,15 @@ int c4iw_dereg_mr(struct ib_mr *ib_mr)
770 kfree(mhp); 770 kfree(mhp);
771 return 0; 771 return 0;
772} 772}
773
774void c4iw_invalidate_mr(struct c4iw_dev *rhp, u32 rkey)
775{
776 struct c4iw_mr *mhp;
777 unsigned long flags;
778
779 spin_lock_irqsave(&rhp->lock, flags);
780 mhp = get_mhp(rhp, rkey >> 8);
781 if (mhp)
782 mhp->attr.state = 0;
783 spin_unlock_irqrestore(&rhp->lock, flags);
784}
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index 5790e1dbd618..b7ac97b27c88 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -706,12 +706,8 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe,
706 return 0; 706 return 0;
707} 707}
708 708
709static int build_inv_stag(struct c4iw_dev *dev, union t4_wr *wqe, 709static int build_inv_stag(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16)
710 struct ib_send_wr *wr, u8 *len16)
711{ 710{
712 struct c4iw_mr *mhp = get_mhp(dev, wr->ex.invalidate_rkey >> 8);
713
714 mhp->attr.state = 0;
715 wqe->inv.stag_inv = cpu_to_be32(wr->ex.invalidate_rkey); 711 wqe->inv.stag_inv = cpu_to_be32(wr->ex.invalidate_rkey);
716 wqe->inv.r2 = 0; 712 wqe->inv.r2 = 0;
717 *len16 = DIV_ROUND_UP(sizeof wqe->inv, 16); 713 *len16 = DIV_ROUND_UP(sizeof wqe->inv, 16);
@@ -842,10 +838,13 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
842 case IB_WR_RDMA_READ_WITH_INV: 838 case IB_WR_RDMA_READ_WITH_INV:
843 fw_opcode = FW_RI_RDMA_READ_WR; 839 fw_opcode = FW_RI_RDMA_READ_WR;
844 swsqe->opcode = FW_RI_READ_REQ; 840 swsqe->opcode = FW_RI_READ_REQ;
845 if (wr->opcode == IB_WR_RDMA_READ_WITH_INV) 841 if (wr->opcode == IB_WR_RDMA_READ_WITH_INV) {
842 c4iw_invalidate_mr(qhp->rhp,
843 wr->sg_list[0].lkey);
846 fw_flags = FW_RI_RDMA_READ_INVALIDATE; 844 fw_flags = FW_RI_RDMA_READ_INVALIDATE;
847 else 845 } else {
848 fw_flags = 0; 846 fw_flags = 0;
847 }
849 err = build_rdma_read(wqe, wr, &len16); 848 err = build_rdma_read(wqe, wr, &len16);
850 if (err) 849 if (err)
851 break; 850 break;
@@ -878,7 +877,8 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
878 fw_flags |= FW_RI_LOCAL_FENCE_FLAG; 877 fw_flags |= FW_RI_LOCAL_FENCE_FLAG;
879 fw_opcode = FW_RI_INV_LSTAG_WR; 878 fw_opcode = FW_RI_INV_LSTAG_WR;
880 swsqe->opcode = FW_RI_LOCAL_INV; 879 swsqe->opcode = FW_RI_LOCAL_INV;
881 err = build_inv_stag(qhp->rhp, wqe, wr, &len16); 880 err = build_inv_stag(wqe, wr, &len16);
881 c4iw_invalidate_mr(qhp->rhp, wr->ex.invalidate_rkey);
882 break; 882 break;
883 default: 883 default:
884 PDBG("%s post of type=%d TBD!\n", __func__, 884 PDBG("%s post of type=%d TBD!\n", __func__,