net/rxrpc/peer_object.c
Source file repositories/reference/linux-study-clean/net/rxrpc/peer_object.c
File Facts
- System
- Linux kernel
- Corpus path
net/rxrpc/peer_object.c- Extension
.c- Size
- 14451 bytes
- Lines
- 561
- 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.
- 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/module.hlinux/net.hlinux/skbuff.hlinux/udp.hlinux/in.hlinux/in6.hlinux/slab.hlinux/hashtable.hnet/sock.hnet/af_rxrpc.hnet/ip.hnet/route.hnet/ip6_route.har-internal.h
Detected Declarations
function rxrpc_peer_hash_keyfunction rxrpc_peer_cmp_keyfunction hash_for_each_possible_rcufunction rxrpc_assess_MTU_sizefunction rxrpc_init_peerfunction rxrpc_free_peerfunction rxrpc_new_incoming_peerfunction __rxrpc_put_peerfunction rxrpc_put_peerfunction rxrpc_destroy_all_peersfunction hlist_for_each_entryfunction rxrpc_kernel_get_srttfunction rxrpc_kernel_set_peer_datafunction rxrpc_kernel_get_peer_dataexport rxrpc_kernel_get_call_peerexport rxrpc_kernel_get_srttexport rxrpc_kernel_remote_srxexport rxrpc_kernel_remote_addrexport rxrpc_kernel_set_peer_dataexport rxrpc_kernel_get_peer_data
Annotated Snippet
if (IS_ERR(rt)) {
_leave(" [route err %ld]", PTR_ERR(rt));
return;
}
dst = &rt->dst;
break;
#ifdef CONFIG_AF_RXRPC_IPV6
case AF_INET6:
fl6->flowi6_iif = LOOPBACK_IFINDEX;
fl6->flowi6_scope = RT_SCOPE_UNIVERSE;
fl6->flowi6_proto = IPPROTO_UDP;
memcpy(&fl6->daddr, &peer->srx.transport.sin6.sin6_addr,
sizeof(struct in6_addr));
fl6->fl6_dport = htons(7001);
fl6->fl6_sport = htons(7000);
dst = ip6_route_output(net, NULL, fl6);
if (dst->error) {
_leave(" [route err %d]", dst->error);
return;
}
break;
#endif
default:
BUG();
}
peer->if_mtu = dst_mtu(dst);
peer->hdrsize += dst->header_len + dst->trailer_len;
peer->tx_seg_max = dst->dev->gso_max_segs;
dst_release(dst);
peer->max_data = umin(RXRPC_JUMBO(1), peer->if_mtu - peer->hdrsize);
peer->pmtud_good = 500;
peer->pmtud_bad = peer->if_mtu - peer->hdrsize + 1;
peer->pmtud_trial = umin(peer->max_data, peer->pmtud_bad - 1);
peer->pmtud_pending = true;
_leave(" [if_mtu %u]", peer->if_mtu);
}
/*
* Allocate a peer.
*/
struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp,
enum rxrpc_peer_trace why)
{
struct rxrpc_peer *peer;
_enter("");
peer = kzalloc_obj(struct rxrpc_peer, gfp);
if (peer) {
refcount_set(&peer->ref, 1);
peer->local = rxrpc_get_local(local, rxrpc_local_get_peer);
INIT_HLIST_HEAD(&peer->error_targets);
peer->service_conns = RB_ROOT;
seqlock_init(&peer->service_conn_lock);
spin_lock_init(&peer->lock);
peer->debug_id = atomic_inc_return(&rxrpc_debug_id);
peer->recent_srtt_us = UINT_MAX;
peer->cong_ssthresh = RXRPC_TX_MAX_WINDOW;
trace_rxrpc_peer(peer->debug_id, 1, why);
}
_leave(" = %p", peer);
return peer;
}
/*
* Initialise peer record.
*/
static void rxrpc_init_peer(struct rxrpc_local *local, struct rxrpc_peer *peer,
unsigned long hash_key)
{
peer->hash_key = hash_key;
switch (peer->srx.transport.family) {
case AF_INET:
peer->hdrsize = sizeof(struct iphdr);
break;
#ifdef CONFIG_AF_RXRPC_IPV6
case AF_INET6:
peer->hdrsize = sizeof(struct ipv6hdr);
break;
#endif
default:
BUG();
Annotation
- Immediate include surface: `linux/module.h`, `linux/net.h`, `linux/skbuff.h`, `linux/udp.h`, `linux/in.h`, `linux/in6.h`, `linux/slab.h`, `linux/hashtable.h`.
- Detected declarations: `function rxrpc_peer_hash_key`, `function rxrpc_peer_cmp_key`, `function hash_for_each_possible_rcu`, `function rxrpc_assess_MTU_size`, `function rxrpc_init_peer`, `function rxrpc_free_peer`, `function rxrpc_new_incoming_peer`, `function __rxrpc_put_peer`, `function rxrpc_put_peer`, `function rxrpc_destroy_all_peers`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.