aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/ib_verbs.h
diff options
context:
space:
mode:
authorEli Cohen <eli@dev.mellanox.co.il>2013-10-31 09:26:32 -0400
committerRoland Dreier <roland@purestorage.com>2013-11-15 13:25:32 -0500
commit1c636f801615bdfc9b1d46904e8258c7a025670b (patch)
tree600ff4b245e9287489c6c4b8a3a132f5adae5eb9 /include/rdma/ib_verbs.h
parent180771a3707a4c0577cbf4f830c754dbabfdfccb (diff)
IB/core: Encorce MR access rights rules on kernel consumers
Enforce the rule that when requesting remote write or atomic permissions, local write must be indicated as well. See IB spec 11.2.8.2. Spotted by: Hagay Abramovsky <hagaya@mellanox.com> Signed-off-by: Eli Cohen <eli@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'include/rdma/ib_verbs.h')
-rw-r--r--include/rdma/ib_verbs.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 60354d53948e..68c053d0d629 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2386,4 +2386,17 @@ struct ib_flow *ib_create_flow(struct ib_qp *qp,
2386 struct ib_flow_attr *flow_attr, int domain); 2386 struct ib_flow_attr *flow_attr, int domain);
2387int ib_destroy_flow(struct ib_flow *flow_id); 2387int ib_destroy_flow(struct ib_flow *flow_id);
2388 2388
2389static inline int ib_check_mr_access(int flags)
2390{
2391 /*
2392 * Local write permission is required if remote write or
2393 * remote atomic permission is also requested.
2394 */
2395 if (flags & (IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_REMOTE_WRITE) &&
2396 !(flags & IB_ACCESS_LOCAL_WRITE))
2397 return -EINVAL;
2398
2399 return 0;
2400}
2401
2389#endif /* IB_VERBS_H */ 2402#endif /* IB_VERBS_H */