net/rxrpc/io_thread.c
Source file repositories/reference/linux-study-clean/net/rxrpc/io_thread.c
File Facts
- System
- Linux kernel
- Corpus path
net/rxrpc/io_thread.c- Extension
.c- Size
- 16092 bytes
- Lines
- 584
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
ar-internal.h
Detected Declarations
function rxrpc_encap_rcvfunction rxrpc_error_reportfunction rxrpc_direct_abortfunction rxrpc_direct_conn_abortfunction rxrpc_bad_messagefunction rxrpc_input_versionfunction rxrpc_extract_headerfunction rxrpc_extract_abortfunction rxrpc_input_packetfunction rxrpc_input_packet_on_connfunction rxrpc_io_thread
Annotated Snippet
if ((lose++ & 7) == 7) {
trace_rxrpc_rx_lose(sp);
return just_discard;
}
}
trace_rxrpc_rx_packet(sp);
switch (sp->hdr.type) {
case RXRPC_PACKET_TYPE_VERSION:
if (rxrpc_to_client(sp))
return just_discard;
return rxrpc_input_version(local, skb);
case RXRPC_PACKET_TYPE_BUSY:
if (rxrpc_to_server(sp))
return just_discard;
fallthrough;
case RXRPC_PACKET_TYPE_ACK:
case RXRPC_PACKET_TYPE_ACKALL:
if (sp->hdr.callNumber == 0)
return rxrpc_bad_message(skb, rxrpc_badmsg_zero_call);
break;
case RXRPC_PACKET_TYPE_ABORT:
if (!rxrpc_extract_abort(skb))
return just_discard; /* Just discard if malformed */
break;
case RXRPC_PACKET_TYPE_DATA:
if (sp->hdr.callNumber == 0)
return rxrpc_bad_message(skb, rxrpc_badmsg_zero_call);
if (sp->hdr.seq == 0)
return rxrpc_bad_message(skb, rxrpc_badmsg_zero_seq);
break;
case RXRPC_PACKET_TYPE_CHALLENGE:
if (rxrpc_to_server(sp))
return just_discard;
break;
case RXRPC_PACKET_TYPE_RESPONSE:
if (rxrpc_to_client(sp))
return just_discard;
break;
/* Packet types 9-11 should just be ignored. */
case RXRPC_PACKET_TYPE_PARAMS:
case RXRPC_PACKET_TYPE_10:
case RXRPC_PACKET_TYPE_11:
return just_discard;
default:
return rxrpc_bad_message(skb, rxrpc_badmsg_unsupported_packet);
}
if (sp->hdr.serviceId == 0)
return rxrpc_bad_message(skb, rxrpc_badmsg_zero_service);
if (WARN_ON_ONCE(rxrpc_extract_addr_from_skb(&peer_srx, skb) < 0))
return just_discard; /* Unsupported address type. */
if (peer_srx.transport.family != local->srx.transport.family &&
(peer_srx.transport.family == AF_INET &&
local->srx.transport.family != AF_INET6)) {
pr_warn_ratelimited("AF_RXRPC: Protocol mismatch %u not %u\n",
peer_srx.transport.family,
local->srx.transport.family);
return just_discard; /* Wrong address type. */
}
if (rxrpc_to_client(sp)) {
rcu_read_lock();
conn = rxrpc_find_client_connection_rcu(local, &peer_srx, skb);
conn = rxrpc_get_connection_maybe(conn, rxrpc_conn_get_call_input);
rcu_read_unlock();
if (!conn)
return rxrpc_protocol_error(skb, rxrpc_eproto_no_client_conn);
ret = rxrpc_input_packet_on_conn(conn, &peer_srx, skb);
rxrpc_put_connection(conn, rxrpc_conn_put_call_input);
return ret;
}
/* We need to look up service connections by the full protocol
* parameter set. We look up the peer first as an intermediate step
* and then the connection from the peer's tree.
*/
rcu_read_lock();
peer = rxrpc_lookup_peer_rcu(local, &peer_srx);
if (!peer) {
Annotation
- Immediate include surface: `ar-internal.h`.
- Detected declarations: `function rxrpc_encap_rcv`, `function rxrpc_error_report`, `function rxrpc_direct_abort`, `function rxrpc_direct_conn_abort`, `function rxrpc_bad_message`, `function rxrpc_input_version`, `function rxrpc_extract_header`, `function rxrpc_extract_abort`, `function rxrpc_input_packet`, `function rxrpc_input_packet_on_conn`.
- 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.