Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
[cascardo/linux.git] / include / linux / sunrpc / rpc_rdma.h
index 3b1ff38..cfda6ad 100644 (file)
 #define _LINUX_SUNRPC_RPC_RDMA_H
 
 #include <linux/types.h>
+#include <linux/bitops.h>
 
 #define RPCRDMA_VERSION                1
 #define rpcrdma_version                cpu_to_be32(RPCRDMA_VERSION)
 
+enum {
+       RPCRDMA_V1_DEF_INLINE_SIZE      = 1024,
+};
+
 struct rpcrdma_segment {
        __be32 rs_handle;       /* Registered memory handle */
        __be32 rs_length;       /* Length of the chunk in bytes */
@@ -129,4 +134,38 @@ enum rpcrdma_proc {
 #define rdma_done      cpu_to_be32(RDMA_DONE)
 #define rdma_error     cpu_to_be32(RDMA_ERROR)
 
+/*
+ * Private extension to RPC-over-RDMA Version One.
+ * Message passed during RDMA-CM connection set-up.
+ *
+ * Add new fields at the end, and don't permute existing
+ * fields.
+ */
+struct rpcrdma_connect_private {
+       __be32                  cp_magic;
+       u8                      cp_version;
+       u8                      cp_flags;
+       u8                      cp_send_size;
+       u8                      cp_recv_size;
+} __packed;
+
+#define rpcrdma_cmp_magic      __cpu_to_be32(0xf6ab0e18)
+
+enum {
+       RPCRDMA_CMP_VERSION             = 1,
+       RPCRDMA_CMP_F_SND_W_INV_OK      = BIT(0),
+};
+
+static inline u8
+rpcrdma_encode_buffer_size(unsigned int size)
+{
+       return (size >> 10) - 1;
+}
+
+static inline unsigned int
+rpcrdma_decode_buffer_size(u8 val)
+{
+       return ((unsigned int)val + 1) << 10;
+}
+
 #endif                         /* _LINUX_SUNRPC_RPC_RDMA_H */