net/rds/recv.c
Source file repositories/reference/linux-study-clean/net/rds/recv.c
File Facts
- System
- Linux kernel
- Corpus path
net/rds/recv.c- Extension
.c- Size
- 24926 bytes
- Lines
- 875
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/slab.hnet/sock.hlinux/in.hlinux/export.hlinux/sched/clock.hlinux/time.hlinux/rds.hrds.h
Detected Declarations
function Copyrightfunction rds_inc_path_initfunction rds_inc_addreffunction rds_inc_putfunction rds_recv_rcvbuf_deltafunction rds_conn_peer_gen_updatefunction list_for_each_entry_safefunction rds_recv_incoming_exthdrsfunction rds_recv_hs_exthdrsfunction Otherwisefunction rds_recv_incomingfunction rds_next_incomingfunction rds_still_queuedfunction rds_notify_queue_getfunction rds_notify_congfunction rds_cmsg_recvfunction rds_recvmsg_zcookiefunction rds_recvmsgfunction rds_clear_recv_queuefunction list_for_each_entry_safefunction rds_inc_info_copyfunction rds6_inc_info_copyexport rds_inc_initexport rds_inc_path_initexport rds_inc_putexport rds_recv_incoming
Annotated Snippet
else if (rs->rs_congested && (rs->rs_rcv_bytes < (rds_sk_rcvbuf(rs)/2))) {
rs->rs_congested = 0;
rds_cong_clear_bit(map, port);
rds_cong_queue_updates(map);
}
/* do nothing if no change in cong state */
}
static void rds_conn_peer_gen_update(struct rds_connection *conn,
u32 peer_gen_num)
{
int i;
struct rds_message *rm, *tmp;
unsigned long flags;
WARN_ON(conn->c_trans->t_type != RDS_TRANS_TCP);
if (peer_gen_num != 0) {
if (conn->c_peer_gen_num != 0 &&
peer_gen_num != conn->c_peer_gen_num) {
for (i = 0; i < RDS_MPATH_WORKERS; i++) {
struct rds_conn_path *cp;
cp = &conn->c_path[i];
spin_lock_irqsave(&cp->cp_lock, flags);
cp->cp_next_tx_seq = 1;
cp->cp_next_rx_seq = 0;
list_for_each_entry_safe(rm, tmp,
&cp->cp_retrans,
m_conn_item) {
set_bit(RDS_MSG_FLUSH, &rm->m_flags);
}
spin_unlock_irqrestore(&cp->cp_lock, flags);
}
}
conn->c_peer_gen_num = peer_gen_num;
}
}
/*
* Process all extension headers that come with this message.
*/
static void rds_recv_incoming_exthdrs(struct rds_incoming *inc, struct rds_sock *rs)
{
struct rds_header *hdr = &inc->i_hdr;
unsigned int pos = 0, type, len;
union {
struct rds_ext_header_version version;
struct rds_ext_header_rdma rdma;
struct rds_ext_header_rdma_dest rdma_dest;
} buffer;
while (1) {
len = sizeof(buffer);
type = rds_message_next_extension(hdr, &pos, &buffer, &len);
if (type == RDS_EXTHDR_NONE)
break;
/* Process extension header here */
switch (type) {
case RDS_EXTHDR_RDMA:
rds_rdma_unuse(rs, be32_to_cpu(buffer.rdma.h_rdma_rkey), 0);
break;
case RDS_EXTHDR_RDMA_DEST:
/* We ignore the size for now. We could stash it
* somewhere and use it for error checking. */
inc->i_usercopy.rdma_cookie = rds_rdma_make_cookie(
be32_to_cpu(buffer.rdma_dest.h_rdma_rkey),
be32_to_cpu(buffer.rdma_dest.h_rdma_offset));
break;
}
}
}
static void rds_recv_hs_exthdrs(struct rds_header *hdr,
struct rds_connection *conn)
{
unsigned int pos = 0, type, len;
union {
struct rds_ext_header_version version;
__be16 rds_npaths;
__be32 rds_gen_num;
u8 dummy;
} buffer;
bool new_with_sport_idx = false;
u32 new_peer_gen_num = 0;
int new_npaths;
bool fan_out;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `net/sock.h`, `linux/in.h`, `linux/export.h`, `linux/sched/clock.h`, `linux/time.h`, `linux/rds.h`.
- Detected declarations: `function Copyright`, `function rds_inc_path_init`, `function rds_inc_addref`, `function rds_inc_put`, `function rds_recv_rcvbuf_delta`, `function rds_conn_peer_gen_update`, `function list_for_each_entry_safe`, `function rds_recv_incoming_exthdrs`, `function rds_recv_hs_exthdrs`, `function Otherwise`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.
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.