RDMA/cxgb3: Fix up MW access rights
authorSteve Wise <swise@opengridcomputing.com>
Mon, 4 Aug 2008 18:05:43 +0000 (11:05 -0700)
committerRoland Dreier <rolandd@cisco.com>
Mon, 4 Aug 2008 18:05:43 +0000 (11:05 -0700)
- MWs don't have local read/write permissions.
- Set the MW_BIND enabled bit if a MR has MW_BIND access.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/cxgb3/cxio_hal.c
drivers/infiniband/hw/cxgb3/iwch_provider.h
drivers/infiniband/hw/cxgb3/iwch_qp.c

index f6d5747153a5282f7318aea8dd1ae31a9057bee7..4dcf08b3fd832dd12d96a5a5ce3c9dcc1c8a5058 100644 (file)
@@ -725,9 +725,9 @@ static int __cxio_tpt_op(struct cxio_rdev *rdev_p, u32 reset_tpt_entry,
                                V_TPT_STAG_TYPE(type) | V_TPT_PDID(pdid));
                BUG_ON(page_size >= 28);
                tpt.flags_pagesize_qpid = cpu_to_be32(V_TPT_PERM(perm) |
-                               F_TPT_MW_BIND_ENABLE |
-                               V_TPT_ADDR_TYPE((zbva ? TPT_ZBTO : TPT_VATO)) |
-                               V_TPT_PAGE_SIZE(page_size));
+                       ((perm & TPT_MW_BIND) ? F_TPT_MW_BIND_ENABLE : 0) |
+                       V_TPT_ADDR_TYPE((zbva ? TPT_ZBTO : TPT_VATO)) |
+                       V_TPT_PAGE_SIZE(page_size));
                tpt.rsvd_pbl_addr = reset_tpt_entry ? 0 :
                                    cpu_to_be32(V_TPT_PBL_ADDR(PBL_OFF(rdev_p, pbl_addr)>>3));
                tpt.len = cpu_to_be32(len);
index f5ceca05c43512303d4ab0c236f2851c4ab0fa9a..a237d49bdcc9d79e1e25fa097190e25ee9d87599 100644 (file)
@@ -293,9 +293,16 @@ static inline u32 iwch_ib_to_tpt_access(int acc)
        return (acc & IB_ACCESS_REMOTE_WRITE ? TPT_REMOTE_WRITE : 0) |
               (acc & IB_ACCESS_REMOTE_READ ? TPT_REMOTE_READ : 0) |
               (acc & IB_ACCESS_LOCAL_WRITE ? TPT_LOCAL_WRITE : 0) |
+              (acc & IB_ACCESS_MW_BIND ? TPT_MW_BIND : 0) |
               TPT_LOCAL_READ;
 }
 
+static inline u32 iwch_ib_to_tpt_bind_access(int acc)
+{
+       return (acc & IB_ACCESS_REMOTE_WRITE ? TPT_REMOTE_WRITE : 0) |
+              (acc & IB_ACCESS_REMOTE_READ ? TPT_REMOTE_READ : 0);
+}
+
 enum iwch_mmid_state {
        IWCH_STAG_STATE_VALID,
        IWCH_STAG_STATE_INVALID
index 893971612eda2cbe5a7f2a4c235c1ece0a414199..3e4585c2318a1178262f88232926da5890c00331 100644 (file)
@@ -565,7 +565,7 @@ int iwch_bind_mw(struct ib_qp *qp,
        wqe->bind.type = TPT_VATO;
 
        /* TBD: check perms */
-       wqe->bind.perms = iwch_ib_to_tpt_access(mw_bind->mw_access_flags);
+       wqe->bind.perms = iwch_ib_to_tpt_bind_access(mw_bind->mw_access_flags);
        wqe->bind.mr_stag = cpu_to_be32(mw_bind->mr->lkey);
        wqe->bind.mw_stag = cpu_to_be32(mw->rkey);
        wqe->bind.mw_len = cpu_to_be32(mw_bind->length);