summaryrefslogtreecommitdiff
path: root/net/rds/rds.h
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2010-01-12 12:57:27 -0800
committerAndy Grover <andy.grover@oracle.com>2010-09-08 18:11:37 -0700
commit21f79afa5fda2820671a8f64c3d0e43bb118053b (patch)
tree54029e0dbe3e4a68d579c02c5e9ed9d1fb63cfae /net/rds/rds.h
parentfc445084f185cdd877bec323bfe724a361e2292a (diff)
downloadlinux-3.10-21f79afa5fda2820671a8f64c3d0e43bb118053b.tar.gz
linux-3.10-21f79afa5fda2820671a8f64c3d0e43bb118053b.tar.bz2
linux-3.10-21f79afa5fda2820671a8f64c3d0e43bb118053b.zip
RDS: fold rdma.h into rds.h
RDMA is now an intrinsic part of RDS, so it's easier to just have a single header. Signed-off-by: Andy Grover <andy.grover@oracle.com>
Diffstat (limited to 'net/rds/rds.h')
-rw-r--r--net/rds/rds.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/net/rds/rds.h b/net/rds/rds.h
index d29c71aabbd..7c4adbe8c28 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -206,6 +206,60 @@ struct rds_incoming {
rds_rdma_cookie_t i_rdma_cookie;
};
+struct rds_mr {
+ struct rb_node r_rb_node;
+ atomic_t r_refcount;
+ u32 r_key;
+
+ /* A copy of the creation flags */
+ unsigned int r_use_once:1;
+ unsigned int r_invalidate:1;
+ unsigned int r_write:1;
+
+ /* This is for RDS_MR_DEAD.
+ * It would be nice & consistent to make this part of the above
+ * bit field here, but we need to use test_and_set_bit.
+ */
+ unsigned long r_state;
+ struct rds_sock *r_sock; /* back pointer to the socket that owns us */
+ struct rds_transport *r_trans;
+ void *r_trans_private;
+};
+
+/* Flags for mr->r_state */
+#define RDS_MR_DEAD 0
+
+struct rds_rdma_op {
+ u32 r_key;
+ u64 r_remote_addr;
+ unsigned int r_write:1;
+ unsigned int r_fence:1;
+ unsigned int r_notify:1;
+ unsigned int r_recverr:1;
+ unsigned int r_mapped:1;
+ unsigned int r_active:1;
+ struct rds_notifier *r_notifier;
+ unsigned int r_bytes;
+ unsigned int r_nents;
+ unsigned int r_count;
+ struct scatterlist *r_sg;
+};
+
+static inline rds_rdma_cookie_t rds_rdma_make_cookie(u32 r_key, u32 offset)
+{
+ return r_key | (((u64) offset) << 32);
+}
+
+static inline u32 rds_rdma_cookie_key(rds_rdma_cookie_t cookie)
+{
+ return cookie;
+}
+
+static inline u32 rds_rdma_cookie_offset(rds_rdma_cookie_t cookie)
+{
+ return cookie >> 32;
+}
+
/*
* m_sock_item and m_conn_item are on lists that are serialized under
* conn->c_lock. m_sock_item has additional meaning in that once it is empty
@@ -654,6 +708,28 @@ struct rds_message *rds_send_get_message(struct rds_connection *,
/* rdma.c */
void rds_rdma_unuse(struct rds_sock *rs, u32 r_key, int force);
+int rds_get_mr(struct rds_sock *rs, char __user *optval, int optlen);
+int rds_get_mr_for_dest(struct rds_sock *rs, char __user *optval, int optlen);
+int rds_free_mr(struct rds_sock *rs, char __user *optval, int optlen);
+void rds_rdma_drop_keys(struct rds_sock *rs);
+int rds_rdma_extra_size(struct rds_rdma_args *args);
+int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
+ struct cmsghdr *cmsg);
+int rds_cmsg_rdma_dest(struct rds_sock *rs, struct rds_message *rm,
+ struct cmsghdr *cmsg);
+int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
+ struct cmsghdr *cmsg);
+int rds_cmsg_rdma_map(struct rds_sock *rs, struct rds_message *rm,
+ struct cmsghdr *cmsg);
+void rds_rdma_free_op(struct rds_rdma_op *ro);
+void rds_rdma_send_complete(struct rds_message *rm, int);
+
+extern void __rds_put_mr_final(struct rds_mr *mr);
+static inline void rds_mr_put(struct rds_mr *mr)
+{
+ if (atomic_dec_and_test(&mr->r_refcount))
+ __rds_put_mr_final(mr);
+}
/* stats.c */
DECLARE_PER_CPU_SHARED_ALIGNED(struct rds_statistics, rds_stats);