aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/cxgb3/iwch_provider.h
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2007-03-06 15:44:07 -0500
committerRoland Dreier <rolandd@cisco.com>2007-03-06 15:51:02 -0500
commite64518f3736971f22d5c22a6bab40891d2db337f (patch)
treea2ae27fac4f9630aa8f92d7e68e683e0a054b67f /drivers/infiniband/hw/cxgb3/iwch_provider.h
parent1f6a849b7ce6c3007088cd437dfc2b9c7cb5d21e (diff)
RDMA/cxgb3: Fix MR permission problems
Fix memory region permission problems: - remove useless and redundant iwch_mem_perms enum. - create ib_to_tpt_access_rights() for mapping ib access rights to T3 TPT permissions. - create ib_to_mwbind_access_rights() for mapping ib access rights to T3 MWBIND WR permissions. - fix up the mem reg code to utilize the new functions. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb3/iwch_provider.h')
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.h33
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.h b/drivers/infiniband/hw/cxgb3/iwch_provider.h
index de0fe1b93a0c..93bcc56756bd 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.h
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.h
@@ -286,27 +286,20 @@ static inline int iwch_convert_state(enum ib_qp_state ib_state)
286 } 286 }
287} 287}
288 288
289enum iwch_mem_perms { 289static inline u32 iwch_ib_to_tpt_access(int acc)
290 IWCH_MEM_ACCESS_LOCAL_READ = 1 << 0,
291 IWCH_MEM_ACCESS_LOCAL_WRITE = 1 << 1,
292 IWCH_MEM_ACCESS_REMOTE_READ = 1 << 2,
293 IWCH_MEM_ACCESS_REMOTE_WRITE = 1 << 3,
294 IWCH_MEM_ACCESS_ATOMICS = 1 << 4,
295 IWCH_MEM_ACCESS_BINDING = 1 << 5,
296 IWCH_MEM_ACCESS_LOCAL =
297 (IWCH_MEM_ACCESS_LOCAL_READ | IWCH_MEM_ACCESS_LOCAL_WRITE),
298 IWCH_MEM_ACCESS_REMOTE =
299 (IWCH_MEM_ACCESS_REMOTE_WRITE | IWCH_MEM_ACCESS_REMOTE_READ)
300 /* cannot go beyond 1 << 31 */
301} __attribute__ ((packed));
302
303static inline u32 iwch_convert_access(int acc)
304{ 290{
305 return (acc & IB_ACCESS_REMOTE_WRITE ? IWCH_MEM_ACCESS_REMOTE_WRITE : 0) 291 return (acc & IB_ACCESS_REMOTE_WRITE ? TPT_REMOTE_WRITE : 0) |
306 | (acc & IB_ACCESS_REMOTE_READ ? IWCH_MEM_ACCESS_REMOTE_READ : 0) | 292 (acc & IB_ACCESS_REMOTE_READ ? TPT_REMOTE_READ : 0) |
307 (acc & IB_ACCESS_LOCAL_WRITE ? IWCH_MEM_ACCESS_LOCAL_WRITE : 0) | 293 (acc & IB_ACCESS_LOCAL_WRITE ? TPT_LOCAL_WRITE : 0) |
308 (acc & IB_ACCESS_MW_BIND ? IWCH_MEM_ACCESS_BINDING : 0) | 294 TPT_LOCAL_READ;
309 IWCH_MEM_ACCESS_LOCAL_READ; 295}
296
297static inline u32 iwch_ib_to_mwbind_access(int acc)
298{
299 return (acc & IB_ACCESS_REMOTE_WRITE ? T3_MEM_ACCESS_REM_WRITE : 0) |
300 (acc & IB_ACCESS_REMOTE_READ ? T3_MEM_ACCESS_REM_READ : 0) |
301 (acc & IB_ACCESS_LOCAL_WRITE ? T3_MEM_ACCESS_LOCAL_WRITE : 0) |
302 T3_MEM_ACCESS_LOCAL_READ;
310} 303}
311 304
312enum iwch_mmid_state { 305enum iwch_mmid_state {