TOMOYO: Use GFP_NOFS rather than GFP_KERNEL.
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / net / rds / rdma.h
blob909c39835a5dab689dccc4cf76e1729582f56d34
1 #ifndef _RDS_RDMA_H
2 #define _RDS_RDMA_H
4 #include <linux/rbtree.h>
5 #include <linux/spinlock.h>
6 #include <linux/scatterlist.h>
8 #include "rds.h"
10 struct rds_mr {
11 struct rb_node r_rb_node;
12 atomic_t r_refcount;
13 u32 r_key;
15 /* A copy of the creation flags */
16 unsigned int r_use_once:1;
17 unsigned int r_invalidate:1;
18 unsigned int r_write:1;
20 /* This is for RDS_MR_DEAD.
21 * It would be nice & consistent to make this part of the above
22 * bit field here, but we need to use test_and_set_bit.
24 unsigned long r_state;
25 struct rds_sock *r_sock; /* back pointer to the socket that owns us */
26 struct rds_transport *r_trans;
27 void *r_trans_private;
30 /* Flags for mr->r_state */
31 #define RDS_MR_DEAD 0
33 struct rds_rdma_op {
34 u32 r_key;
35 u64 r_remote_addr;
36 unsigned int r_write:1;
37 unsigned int r_fence:1;
38 unsigned int r_notify:1;
39 unsigned int r_recverr:1;
40 unsigned int r_mapped:1;
41 struct rds_notifier *r_notifier;
42 unsigned int r_bytes;
43 unsigned int r_nents;
44 unsigned int r_count;
45 struct scatterlist r_sg[0];
48 static inline rds_rdma_cookie_t rds_rdma_make_cookie(u32 r_key, u32 offset)
50 return r_key | (((u64) offset) << 32);
53 static inline u32 rds_rdma_cookie_key(rds_rdma_cookie_t cookie)
55 return cookie;
58 static inline u32 rds_rdma_cookie_offset(rds_rdma_cookie_t cookie)
60 return cookie >> 32;
63 int rds_get_mr(struct rds_sock *rs, char __user *optval, int optlen);
64 int rds_get_mr_for_dest(struct rds_sock *rs, char __user *optval, int optlen);
65 int rds_free_mr(struct rds_sock *rs, char __user *optval, int optlen);
66 void rds_rdma_drop_keys(struct rds_sock *rs);
67 int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
68 struct cmsghdr *cmsg);
69 int rds_cmsg_rdma_dest(struct rds_sock *rs, struct rds_message *rm,
70 struct cmsghdr *cmsg);
71 int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
72 struct cmsghdr *cmsg);
73 int rds_cmsg_rdma_map(struct rds_sock *rs, struct rds_message *rm,
74 struct cmsghdr *cmsg);
75 void rds_rdma_free_op(struct rds_rdma_op *ro);
76 void rds_rdma_send_complete(struct rds_message *rm, int);
78 extern void __rds_put_mr_final(struct rds_mr *mr);
79 static inline void rds_mr_put(struct rds_mr *mr)
81 if (atomic_dec_and_test(&mr->r_refcount))
82 __rds_put_mr_final(mr);
85 #endif