aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ocrdma/ocrdma_hw.h
diff options
context:
space:
mode:
authorNaresh Gottumukkala <bgottumukkala@emulex.com>2013-08-26 05:57:44 -0400
committerRoland Dreier <roland@purestorage.com>2013-09-03 00:18:32 -0400
commitcffce99051b80c90630a9fff662a1b25e278069d (patch)
tree58257cc50f34458649c412d5a723063d53b417a3 /drivers/infiniband/hw/ocrdma/ocrdma_hw.h
parent2b51a9b9eb6bf240d2592e10d2f8823dd1f5ee3e (diff)
RDMA/ocrdma: Dont use PD 0 for userpace CQ DB
Create_CQ verb doesn't provide a PD pointer. So, until now we are creating all (both userspace and kernel) CQ DB regions from PD0. This will result in mmapping PD0 to applications. A rogue userspace application can mess things up. Also more serious issues is even the be2net NIC uses PD0. This patch addresses this problem by: 1) Create a PD page for every userspace application when the alloc_ucontext is called. This will be destroyed in dealloc_ucontext. 2) All CQs for that context will use the PD allocated in ucontext. 3) The first create_PD call from application will result in returning the PD address from its ucontext (no new PD will be created). 4) For subsecquent create_pd calls from application, we create new PDs for the application. Signed-off-by: Naresh Gottumukkala <bgottumukkala@emulex.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/ocrdma/ocrdma_hw.h')
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_hw.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.h b/drivers/infiniband/hw/ocrdma/ocrdma_hw.h
index cc90ac3b6d42..044db74e780a 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.h
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.h
@@ -78,6 +78,11 @@ static inline void ocrdma_copy_le32_to_cpu(void *dst, void *src, u32 len)
78#endif 78#endif
79} 79}
80 80
81static inline u64 ocrdma_get_db_addr(struct ocrdma_dev *dev, u32 pdid)
82{
83 return dev->nic_info.unmapped_db + (pdid * dev->nic_info.db_page_size);
84}
85
81int ocrdma_init_hw(struct ocrdma_dev *); 86int ocrdma_init_hw(struct ocrdma_dev *);
82void ocrdma_cleanup_hw(struct ocrdma_dev *); 87void ocrdma_cleanup_hw(struct ocrdma_dev *);
83 88
@@ -100,7 +105,7 @@ int ocrdma_mbx_dealloc_lkey(struct ocrdma_dev *, int fmr, u32 lkey);
100int ocrdma_reg_mr(struct ocrdma_dev *, struct ocrdma_hw_mr *hwmr, 105int ocrdma_reg_mr(struct ocrdma_dev *, struct ocrdma_hw_mr *hwmr,
101 u32 pd_id, int acc); 106 u32 pd_id, int acc);
102int ocrdma_mbx_create_cq(struct ocrdma_dev *, struct ocrdma_cq *, 107int ocrdma_mbx_create_cq(struct ocrdma_dev *, struct ocrdma_cq *,
103 int entries, int dpp_cq); 108 int entries, int dpp_cq, u16 pd_id);
104int ocrdma_mbx_destroy_cq(struct ocrdma_dev *, struct ocrdma_cq *); 109int ocrdma_mbx_destroy_cq(struct ocrdma_dev *, struct ocrdma_cq *);
105 110
106int ocrdma_mbx_create_qp(struct ocrdma_qp *, struct ib_qp_init_attr *attrs, 111int ocrdma_mbx_create_qp(struct ocrdma_qp *, struct ib_qp_init_attr *attrs,