include/linux/sunrpc/rpc_rdma.h

Source file repositories/reference/linux-study-clean/include/linux/sunrpc/rpc_rdma.h

File Facts

System
Linux kernel
Corpus path
include/linux/sunrpc/rpc_rdma.h
Extension
.h
Size
6219 bytes
Lines
202
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

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;
}

/**
 * xdr_encode_rdma_segment - Encode contents of an RDMA segment
 * @p: Pointer into a send buffer
 * @handle: The RDMA handle to encode
 * @length: The RDMA length to encode
 * @offset: The RDMA offset to encode
 *
 * Return value:
 *   Pointer to the XDR position that follows the encoded RDMA segment
 */
static inline __be32 *xdr_encode_rdma_segment(__be32 *p, u32 handle,
					      u32 length, u64 offset)
{
	*p++ = cpu_to_be32(handle);
	*p++ = cpu_to_be32(length);
	return xdr_encode_hyper(p, offset);
}

/**
 * xdr_encode_read_segment - Encode contents of a Read segment
 * @p: Pointer into a send buffer
 * @position: The position to encode
 * @handle: The RDMA handle to encode
 * @length: The RDMA length to encode
 * @offset: The RDMA offset to encode
 *
 * Return value:
 *   Pointer to the XDR position that follows the encoded Read segment
 */
static inline __be32 *xdr_encode_read_segment(__be32 *p, u32 position,
					      u32 handle, u32 length,
					      u64 offset)
{
	*p++ = cpu_to_be32(position);
	return xdr_encode_rdma_segment(p, handle, length, offset);
}

/**
 * xdr_decode_rdma_segment - Decode contents of an RDMA segment
 * @p: Pointer to the undecoded RDMA segment
 * @handle: Upon return, the RDMA handle
 * @length: Upon return, the RDMA length
 * @offset: Upon return, the RDMA offset
 *
 * Return value:
 *   Pointer to the XDR item that follows the RDMA segment
 */
static inline __be32 *xdr_decode_rdma_segment(__be32 *p, u32 *handle,
					      u32 *length, u64 *offset)
{
	*handle = be32_to_cpup(p++);
	*length = be32_to_cpup(p++);
	return xdr_decode_hyper(p, offset);
}

/**
 * xdr_decode_read_segment - Decode contents of a Read segment
 * @p: Pointer to the undecoded Read segment
 * @position: Upon return, the segment's position
 * @handle: Upon return, the RDMA handle
 * @length: Upon return, the RDMA length
 * @offset: Upon return, the RDMA offset
 *

Annotation

Implementation Notes