RDMA/cxgb3: Fix up MW access rights

- 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>

authored by Steve Wise and committed by Roland Dreier 1c355a6e 5f0f66b0

+11 -4
+3 -3
drivers/infiniband/hw/cxgb3/cxio_hal.c
··· 725 725 V_TPT_STAG_TYPE(type) | V_TPT_PDID(pdid)); 726 726 BUG_ON(page_size >= 28); 727 727 tpt.flags_pagesize_qpid = cpu_to_be32(V_TPT_PERM(perm) | 728 - F_TPT_MW_BIND_ENABLE | 729 - V_TPT_ADDR_TYPE((zbva ? TPT_ZBTO : TPT_VATO)) | 730 - V_TPT_PAGE_SIZE(page_size)); 728 + ((perm & TPT_MW_BIND) ? F_TPT_MW_BIND_ENABLE : 0) | 729 + V_TPT_ADDR_TYPE((zbva ? TPT_ZBTO : TPT_VATO)) | 730 + V_TPT_PAGE_SIZE(page_size)); 731 731 tpt.rsvd_pbl_addr = reset_tpt_entry ? 0 : 732 732 cpu_to_be32(V_TPT_PBL_ADDR(PBL_OFF(rdev_p, pbl_addr)>>3)); 733 733 tpt.len = cpu_to_be32(len);
+7
drivers/infiniband/hw/cxgb3/iwch_provider.h
··· 293 293 return (acc & IB_ACCESS_REMOTE_WRITE ? TPT_REMOTE_WRITE : 0) | 294 294 (acc & IB_ACCESS_REMOTE_READ ? TPT_REMOTE_READ : 0) | 295 295 (acc & IB_ACCESS_LOCAL_WRITE ? TPT_LOCAL_WRITE : 0) | 296 + (acc & IB_ACCESS_MW_BIND ? TPT_MW_BIND : 0) | 296 297 TPT_LOCAL_READ; 298 + } 299 + 300 + static inline u32 iwch_ib_to_tpt_bind_access(int acc) 301 + { 302 + return (acc & IB_ACCESS_REMOTE_WRITE ? TPT_REMOTE_WRITE : 0) | 303 + (acc & IB_ACCESS_REMOTE_READ ? TPT_REMOTE_READ : 0); 297 304 } 298 305 299 306 enum iwch_mmid_state {
+1 -1
drivers/infiniband/hw/cxgb3/iwch_qp.c
··· 565 565 wqe->bind.type = TPT_VATO; 566 566 567 567 /* TBD: check perms */ 568 - wqe->bind.perms = iwch_ib_to_tpt_access(mw_bind->mw_access_flags); 568 + wqe->bind.perms = iwch_ib_to_tpt_bind_access(mw_bind->mw_access_flags); 569 569 wqe->bind.mr_stag = cpu_to_be32(mw_bind->mr->lkey); 570 570 wqe->bind.mw_stag = cpu_to_be32(mw->rkey); 571 571 wqe->bind.mw_len = cpu_to_be32(mw_bind->length);