net/rds/rds.h
Source file repositories/reference/linux-study-clean/net/rds/rds.h
File Facts
- System
- Linux kernel
- Corpus path
net/rds/rds.h- Extension
.h- Size
- 32242 bytes
- Lines
- 1051
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/sock.hlinux/scatterlist.hlinux/highmem.hrdma/rdma_cm.hlinux/mutex.hlinux/rds.hlinux/rhashtable.hlinux/refcount.hlinux/in6.hinfo.h
Detected Declarations
struct rds_cong_mapstruct rds_conn_pathstruct rds_connectionstruct rds_headerstruct rds_ext_header_versionstruct rds_ext_header_rdmastruct rds_ext_header_rdma_deststruct rds_ext_header_rdma_bytesstruct rds_inc_usercopystruct rds_incomingstruct rds_mrstruct rds_znotifierstruct rds_msg_zcopy_infostruct rds_msg_zcopy_queuestruct rds_iov_vectorstruct rds_iov_vector_arrstruct rds_messagestruct rm_atomic_opstruct rm_rdma_opstruct rm_data_opstruct rds_notifierstruct rds_transportstruct rds_sockstruct rds_statisticsstruct sockaddr_infunction __printffunction rds_conn_net_setfunction rds_rdma_make_cookiefunction rds_rdma_cookie_keyfunction rds_rdma_cookie_offsetfunction rds_message_zcopy_queue_initfunction rds_sk_sndbuffunction rds_sk_rcvbuffunction __rds_wake_sk_sleepfunction rds_conn_path_transitionfunction rds_conn_transitionfunction rds_conn_path_statefunction rds_conn_statefunction rds_conn_path_upfunction rds_conn_path_downfunction rds_conn_upfunction rds_conn_path_connectingfunction rds_conn_connectingfunction rds_message_make_checksumfunction rds_message_verify_checksumfunction rds_destroy_pending
Annotated Snippet
struct rds_cong_map {
struct rb_node m_rb_node;
struct in6_addr m_addr;
wait_queue_head_t m_waitq;
struct list_head m_conn_list;
unsigned long m_page_addrs[RDS_CONG_MAP_PAGES];
};
/*
* This is how we will track the connection state:
* A connection is always in one of the following
* states. Updates to the state are atomic and imply
* a memory barrier.
*/
enum {
RDS_CONN_DOWN = 0,
RDS_CONN_CONNECTING,
RDS_CONN_DISCONNECTING,
RDS_CONN_UP,
RDS_CONN_RESETTING,
RDS_CONN_ERROR,
};
/* Bits for c_flags */
#define RDS_LL_SEND_FULL 0
#define RDS_RECONNECT_PENDING 1
#define RDS_IN_XMIT 2
#define RDS_RECV_REFILL 3
#define RDS_DESTROY_PENDING 4
/* Max number of multipaths per RDS connection. Must be a power of 2 */
#define RDS_MPATH_WORKERS 8
#define RDS_MPATH_HASH(rs, n) (jhash_1word(ntohs((rs)->rs_bound_port), \
(rs)->rs_hash_initval) & ((n) - 1))
#define IS_CANONICAL(laddr, faddr) (htonl(laddr) < htonl(faddr))
/* Per mpath connection state */
struct rds_conn_path {
struct rds_connection *cp_conn;
struct rds_message *cp_xmit_rm;
unsigned long cp_xmit_sg;
unsigned int cp_xmit_hdr_off;
unsigned int cp_xmit_data_off;
unsigned int cp_xmit_atomic_sent;
unsigned int cp_xmit_rdma_sent;
unsigned int cp_xmit_data_sent;
spinlock_t cp_lock; /* protect msg queues */
u64 cp_next_tx_seq;
struct list_head cp_send_queue;
struct list_head cp_retrans;
u64 cp_next_rx_seq;
void *cp_transport_data;
struct workqueue_struct *cp_wq;
atomic_t cp_state;
unsigned long cp_send_gen;
unsigned long cp_flags;
unsigned long cp_reconnect_jiffies;
struct delayed_work cp_send_w;
struct delayed_work cp_recv_w;
struct delayed_work cp_conn_w;
struct work_struct cp_down_w;
struct mutex cp_cm_lock; /* protect cp_state & cm */
wait_queue_head_t cp_waitq;
unsigned int cp_unacked_packets;
unsigned int cp_unacked_bytes;
unsigned int cp_index;
};
/* One rds_connection per RDS address pair */
struct rds_connection {
struct hlist_node c_hash_node;
struct in6_addr c_laddr;
struct in6_addr c_faddr;
int c_dev_if; /* ifindex used for this conn */
int c_bound_if; /* ifindex of c_laddr */
unsigned int c_loopback:1,
c_isv6:1,
c_ping_triggered:1,
c_pad_to_32:29;
int c_npaths;
bool c_with_sport_idx;
struct rds_connection *c_passive;
struct rds_transport *c_trans;
Annotation
- Immediate include surface: `net/sock.h`, `linux/scatterlist.h`, `linux/highmem.h`, `rdma/rdma_cm.h`, `linux/mutex.h`, `linux/rds.h`, `linux/rhashtable.h`, `linux/refcount.h`.
- Detected declarations: `struct rds_cong_map`, `struct rds_conn_path`, `struct rds_connection`, `struct rds_header`, `struct rds_ext_header_version`, `struct rds_ext_header_rdma`, `struct rds_ext_header_rdma_dest`, `struct rds_ext_header_rdma_bytes`, `struct rds_inc_usercopy`, `struct rds_incoming`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.