net/rxrpc/conn_client.c
Source file repositories/reference/linux-study-clean/net/rxrpc/conn_client.c
File Facts
- System
- Linux kernel
- Corpus path
net/rxrpc/conn_client.c- Extension
.c- Size
- 23466 bytes
- Lines
- 834
- 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/slab.hlinux/idr.hlinux/timer.hlinux/sched/signal.har-internal.h
Detected Declarations
function rxrpc_activate_bundlefunction rxrpc_put_client_connection_idfunction rxrpc_destroy_client_conn_idsfunction rxrpc_free_bundlefunction rxrpc_put_bundlefunction rxrpc_purge_client_connectionsfunction rxrpc_alloc_client_connectionfunction rxrpc_may_reuse_connfunction rxrpc_look_up_bundlefunction rxrpc_add_conn_to_bundlefunction rxrpc_bundle_has_spacefunction rxrpc_activate_one_channelfunction rxrpc_unidle_connfunction rxrpc_activate_channelsfunction channelsfunction rxrpc_expose_client_callfunction rxrpc_set_client_reap_timerfunction rxrpc_disconnect_client_callfunction test_bitfunction rxrpc_unbundle_connfunction rxrpc_deactivate_bundlefunction rxrpc_kill_client_connfunction rxrpc_discard_expired_client_connsfunction rxrpc_clean_up_local_conns
Annotated Snippet
idr_for_each_entry(&local->conn_ids, conn, id) {
pr_err("AF_RXRPC: Leaked client conn %p {%d}\n",
conn, refcount_read(&conn->ref));
}
BUG();
}
idr_destroy(&local->conn_ids);
}
/*
* Allocate a connection bundle.
*/
static struct rxrpc_bundle *rxrpc_alloc_bundle(struct rxrpc_call *call,
gfp_t gfp)
{
static atomic_t rxrpc_bundle_id;
struct rxrpc_bundle *bundle;
bundle = kzalloc_obj(*bundle, gfp);
if (bundle) {
bundle->local = call->local;
bundle->peer = rxrpc_get_peer(call->peer, rxrpc_peer_get_bundle);
bundle->key = key_get(call->key);
bundle->security = call->security;
bundle->exclusive = test_bit(RXRPC_CALL_EXCLUSIVE, &call->flags);
bundle->upgrade = test_bit(RXRPC_CALL_UPGRADE, &call->flags);
bundle->service_id = call->dest_srx.srx_service;
bundle->security_level = call->security_level;
bundle->debug_id = atomic_inc_return(&rxrpc_bundle_id);
refcount_set(&bundle->ref, 1);
atomic_set(&bundle->active, 1);
INIT_LIST_HEAD(&bundle->waiting_calls);
trace_rxrpc_bundle(bundle->debug_id, 1, rxrpc_bundle_new);
write_lock(&bundle->local->rxnet->conn_lock);
list_add_tail(&bundle->proc_link, &bundle->local->rxnet->bundle_proc_list);
write_unlock(&bundle->local->rxnet->conn_lock);
}
return bundle;
}
struct rxrpc_bundle *rxrpc_get_bundle(struct rxrpc_bundle *bundle,
enum rxrpc_bundle_trace why)
{
int r;
__refcount_inc(&bundle->ref, &r);
trace_rxrpc_bundle(bundle->debug_id, r + 1, why);
return bundle;
}
static void rxrpc_free_bundle(struct rxrpc_bundle *bundle)
{
trace_rxrpc_bundle(bundle->debug_id, refcount_read(&bundle->ref),
rxrpc_bundle_free);
write_lock(&bundle->local->rxnet->conn_lock);
list_del(&bundle->proc_link);
write_unlock(&bundle->local->rxnet->conn_lock);
rxrpc_put_peer(bundle->peer, rxrpc_peer_put_bundle);
key_put(bundle->key);
kfree(bundle);
}
void rxrpc_put_bundle(struct rxrpc_bundle *bundle, enum rxrpc_bundle_trace why)
{
unsigned int id;
bool dead;
int r;
if (bundle) {
id = bundle->debug_id;
dead = __refcount_dec_and_test(&bundle->ref, &r);
trace_rxrpc_bundle(id, r - 1, why);
if (dead)
rxrpc_free_bundle(bundle);
}
}
/*
* Get rid of outstanding client connection preallocations when a local
* endpoint is destroyed.
*/
void rxrpc_purge_client_connections(struct rxrpc_local *local)
{
rxrpc_destroy_client_conn_ids(local);
}
/*
* Allocate a client connection.
Annotation
- Immediate include surface: `linux/slab.h`, `linux/idr.h`, `linux/timer.h`, `linux/sched/signal.h`, `ar-internal.h`.
- Detected declarations: `function rxrpc_activate_bundle`, `function rxrpc_put_client_connection_id`, `function rxrpc_destroy_client_conn_ids`, `function rxrpc_free_bundle`, `function rxrpc_put_bundle`, `function rxrpc_purge_client_connections`, `function rxrpc_alloc_client_connection`, `function rxrpc_may_reuse_conn`, `function rxrpc_look_up_bundle`, `function rxrpc_add_conn_to_bundle`.
- 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.