net/sunrpc/xprtrdma/xprt_rdma.h
Source file repositories/reference/linux-study-clean/net/sunrpc/xprtrdma/xprt_rdma.h
File Facts
- System
- Linux kernel
- Corpus path
net/sunrpc/xprtrdma/xprt_rdma.h- Extension
.h- Size
- 19497 bytes
- Lines
- 623
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/wait.hlinux/spinlock.hlinux/atomic.hlinux/kref.hlinux/workqueue.hlinux/llist.hrdma/rdma_cm.hrdma/ib_verbs.hlinux/sunrpc/clnt.hlinux/sunrpc/rpc_rdma_cid.hlinux/sunrpc/rpc_rdma.hlinux/sunrpc/xprtrdma.hlinux/sunrpc/rdma_rn.h
Detected Declarations
struct rpcrdma_mrstruct rpcrdma_epstruct rpcrdma_regbufstruct rpcrdma_repstruct rpcrdma_reqstruct rpcrdma_sendctxstruct rpcrdma_reqstruct rpcrdma_mrstruct rpcrdma_xdr_cursorstruct rpcrdma_bufferstruct rpcrdma_reqstruct rpcrdma_bufferstruct rpcrdma_statsstruct rpcrdma_xprtenum rpcrdma_chunktypefunction rdmab_addrfunction rdmab_lengthfunction rdmab_lkeyfunction rpcr_to_rdmarfunction rpcrdma_mr_pushfunction rpcrdma_mr_popfunction rpcrdma_addrstrfunction rpcrdma_portstrfunction rpcrdma_regbuf_is_mappedfunction rpcrdma_regbuf_dma_mapfunction rpcrdma_data_dirfunction rpcrdma_set_xdrlen
Annotated Snippet
struct rpcrdma_ep {
struct kref re_kref;
struct rdma_cm_id *re_id;
struct ib_pd *re_pd;
unsigned int re_max_rdma_segs;
unsigned int re_max_fr_depth;
struct rpcrdma_mr *re_write_pad_mr;
enum ib_mr_type re_mrtype;
struct completion re_done;
unsigned int re_send_count;
unsigned int re_send_batch;
unsigned int re_max_inline_send;
unsigned int re_max_inline_recv;
int re_async_rc;
int re_connect_status;
atomic_t re_receiving;
atomic_t re_force_disconnect;
struct ib_qp_init_attr re_attr;
wait_queue_head_t re_connect_wait;
struct rpc_xprt *re_xprt;
struct rpcrdma_connect_private
re_cm_private;
struct rdma_conn_param re_remote_cma;
struct rpcrdma_notification re_rn;
int re_receive_count;
unsigned int re_max_requests; /* depends on device */
unsigned int re_recv_batch;
unsigned int re_inline_send; /* negotiated */
unsigned int re_inline_recv; /* negotiated */
atomic_t re_completion_ids;
char re_write_pad[XDR_UNIT];
};
/* Pre-allocate extra Work Requests for handling reverse-direction
* Receives and Sends. This is a fixed value because the Work Queues
* are allocated when the forward channel is set up, long before the
* backchannel is provisioned. This value is two times
* NFS4_DEF_CB_SLOT_TABLE_SIZE.
*/
#if defined(CONFIG_SUNRPC_BACKCHANNEL)
#define RPCRDMA_BACKWARD_WRS (32)
#else
#define RPCRDMA_BACKWARD_WRS (0)
#endif
/* Registered buffer -- registered kmalloc'd memory for RDMA SEND/RECV
*/
struct rpcrdma_regbuf {
struct ib_sge rg_iov;
struct ib_device *rg_device;
enum dma_data_direction rg_direction;
void *rg_data;
};
static inline u64 rdmab_addr(struct rpcrdma_regbuf *rb)
{
return rb->rg_iov.addr;
}
static inline u32 rdmab_length(struct rpcrdma_regbuf *rb)
{
return rb->rg_iov.length;
}
static inline u32 rdmab_lkey(struct rpcrdma_regbuf *rb)
{
return rb->rg_iov.lkey;
}
static inline struct ib_device *rdmab_device(struct rpcrdma_regbuf *rb)
{
return rb->rg_device;
}
static inline void *rdmab_data(const struct rpcrdma_regbuf *rb)
{
return rb->rg_data;
}
/* Do not use emergency memory reserves, and fail quickly if memory
* cannot be allocated easily. These flags may be used wherever there
* is robust logic to handle a failure to allocate.
*/
#define XPRTRDMA_GFP_FLAGS (__GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN)
/* To ensure a transport can always make forward progress,
* the number of RDMA segments allowed in header chunk lists
Annotation
- Immediate include surface: `linux/wait.h`, `linux/spinlock.h`, `linux/atomic.h`, `linux/kref.h`, `linux/workqueue.h`, `linux/llist.h`, `rdma/rdma_cm.h`, `rdma/ib_verbs.h`.
- Detected declarations: `struct rpcrdma_mr`, `struct rpcrdma_ep`, `struct rpcrdma_regbuf`, `struct rpcrdma_rep`, `struct rpcrdma_req`, `struct rpcrdma_sendctx`, `struct rpcrdma_req`, `struct rpcrdma_mr`, `struct rpcrdma_xdr_cursor`, `struct rpcrdma_buffer`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.