rpcrdma: RDMA/CM private message data structure
authorChuck Lever <chuck.lever@oracle.com>
Tue, 13 Sep 2016 14:53:07 +0000 (10:53 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 23 Sep 2016 14:18:53 +0000 (10:18 -0400)
Introduce data structure used by both client and server to exchange
implementation details during RDMA/CM connection establishment.

This is an experimental out-of-band exchange between Linux
RPC-over-RDMA Version One implementations, replacing the deprecated
CCP (see RFC 5666bis). The purpose of this extension is to enable
prototyping of features that might be introduced in a subsequent
version of RPC-over-RDMA.

Suggested by Christoph Hellwig and Devesh Sharma.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
include/linux/sunrpc/rpc_rdma.h

index 3b1ff38..a7da6bf 100644 (file)
@@ -41,6 +41,7 @@
 #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)
@@ -129,4 +130,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 */