net/rxrpc/af_rxrpc.c
Source file repositories/reference/linux-study-clean/net/rxrpc/af_rxrpc.c
File Facts
- System
- Linux kernel
- Corpus path
net/rxrpc/af_rxrpc.c- Extension
.c- Size
- 27582 bytes
- Lines
- 1147
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/module.hlinux/kernel.hlinux/net.hlinux/slab.hlinux/skbuff.hlinux/random.hlinux/poll.hlinux/proc_fs.hlinux/key-type.hlinux/uio.hnet/net_namespace.hnet/sock.hnet/af_rxrpc.har-internal.h
Detected Declarations
function rxrpc_writablefunction rxrpc_write_spacefunction rxrpc_validate_addressfunction rxrpc_bindfunction rxrpc_listenfunction recordfunction rxrpc_kernel_put_peerfunction recvmsgfunction rxrpc_kernel_put_callfunction rxrpc_kernel_check_lifefunction rxrpc_kernel_set_notificationsfunction rxrpc_connectfunction rxrpc_sendmsgfunction rxrpc_sock_set_min_security_levelfunction rxrpc_setsockoptfunction rxrpc_getsockoptfunction rxrpc_pollfunction rxrpc_createfunction rxrpc_shutdownfunction rxrpc_purge_oob_queuefunction rxrpc_sock_destructorfunction rxrpc_release_sockfunction closefunction af_rxrpc_initfunction af_rxrpc_exitmodule init af_rxrpc_initexport rxrpc_debug_idexport rxrpc_kernel_lookup_peerexport rxrpc_kernel_get_peerexport rxrpc_kernel_put_peerexport rxrpc_kernel_begin_callexport rxrpc_kernel_shutdown_callexport rxrpc_kernel_put_callexport rxrpc_kernel_check_lifeexport rxrpc_kernel_set_notificationsexport rxrpc_sock_set_min_security_level
Annotated Snippet
static const struct proto_ops rxrpc_rpc_ops;
/* current debugging ID */
atomic_t rxrpc_debug_id;
EXPORT_SYMBOL(rxrpc_debug_id);
/* count of skbs currently in use */
atomic_t rxrpc_n_rx_skbs;
struct workqueue_struct *rxrpc_workqueue;
static void rxrpc_sock_destructor(struct sock *);
/*
* see if an RxRPC socket is currently writable
*/
static inline int rxrpc_writable(struct sock *sk)
{
return refcount_read(&sk->sk_wmem_alloc) < (size_t) sk->sk_sndbuf;
}
/*
* wait for write bufferage to become available
*/
static void rxrpc_write_space(struct sock *sk)
{
_enter("%p", sk);
rcu_read_lock();
if (rxrpc_writable(sk)) {
struct socket_wq *wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
wake_up_interruptible(&wq->wait);
sk_wake_async_rcu(sk, SOCK_WAKE_SPACE, POLL_OUT);
}
rcu_read_unlock();
}
/*
* validate an RxRPC address
*/
static int rxrpc_validate_address(struct rxrpc_sock *rx,
struct sockaddr_rxrpc *srx,
int len)
{
unsigned int tail;
if (len < sizeof(struct sockaddr_rxrpc))
return -EINVAL;
if (srx->srx_family != AF_RXRPC)
return -EAFNOSUPPORT;
if (srx->transport_type != SOCK_DGRAM)
return -ESOCKTNOSUPPORT;
len -= offsetof(struct sockaddr_rxrpc, transport);
if (srx->transport_len < sizeof(sa_family_t) ||
srx->transport_len > len)
return -EINVAL;
switch (srx->transport.family) {
case AF_INET:
if (rx->family != AF_INET &&
rx->family != AF_INET6)
return -EAFNOSUPPORT;
if (srx->transport_len < sizeof(struct sockaddr_in))
return -EINVAL;
tail = offsetof(struct sockaddr_rxrpc, transport.sin.__pad);
break;
#ifdef CONFIG_AF_RXRPC_IPV6
case AF_INET6:
if (rx->family != AF_INET6)
return -EAFNOSUPPORT;
if (srx->transport_len < sizeof(struct sockaddr_in6))
return -EINVAL;
tail = offsetof(struct sockaddr_rxrpc, transport) +
sizeof(struct sockaddr_in6);
break;
#endif
default:
return -EAFNOSUPPORT;
}
if (tail < len)
memset((void *)srx + tail, 0, len - tail);
_debug("INET: %pISp", &srx->transport);
return 0;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/net.h`, `linux/slab.h`, `linux/skbuff.h`, `linux/random.h`, `linux/poll.h`, `linux/proc_fs.h`.
- Detected declarations: `function rxrpc_writable`, `function rxrpc_write_space`, `function rxrpc_validate_address`, `function rxrpc_bind`, `function rxrpc_listen`, `function record`, `function rxrpc_kernel_put_peer`, `function recvmsg`, `function rxrpc_kernel_put_call`, `function rxrpc_kernel_check_life`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: pattern 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.