net/rxrpc/oob.c
Source file repositories/reference/linux-study-clean/net/rxrpc/oob.c
File Facts
- System
- Linux kernel
- Corpus path
net/rxrpc/oob.c- Extension
.c- Size
- 9321 bytes
- Lines
- 380
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/net.hlinux/gfp.hlinux/skbuff.hlinux/export.hlinux/sched/signal.hnet/sock.hnet/af_rxrpc.har-internal.h
Detected Declarations
struct rxrpc_oob_paramsenum rxrpc_oob_commandfunction rxrpc_notify_socket_oobfunction rxrpc_add_pending_oobfunction sendmsgfunction for_each_cmsghdrfunction sendmsgfunction rxrpc_sendmsg_oobfunction rxrpc_kernel_query_oobfunction rxrpc_kernel_free_oobfunction rxrpc_kernel_query_challengefunction rxrpc_kernel_reject_challengeexport rxrpc_kernel_query_oobexport rxrpc_kernel_dequeue_oobexport rxrpc_kernel_free_oobexport rxrpc_kernel_query_challengeexport rxrpc_kernel_reject_challenge
Annotated Snippet
struct rxrpc_oob_params {
u64 oob_id; /* ID number of message if reply */
s32 abort_code;
enum rxrpc_oob_command command;
bool have_oob_id:1;
};
/*
* Post an out-of-band message for attention by the socket or kernel service
* associated with a reference call.
*/
void rxrpc_notify_socket_oob(struct rxrpc_call *call, struct sk_buff *skb)
{
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
struct rxrpc_sock *rx;
struct sock *sk;
rcu_read_lock();
rx = rcu_dereference(call->socket);
if (rx) {
sk = &rx->sk;
spin_lock_irq(&rx->recvmsg_lock);
if (sk->sk_state < RXRPC_CLOSE) {
skb->skb_mstamp_ns = rx->oob_id_counter++;
rxrpc_get_skb(skb, rxrpc_skb_get_post_oob);
skb_queue_tail(&rx->recvmsg_oobq, skb);
trace_rxrpc_notify_socket(call->debug_id, sp->hdr.serial);
if (rx->app_ops)
rx->app_ops->notify_oob(sk, skb);
}
spin_unlock_irq(&rx->recvmsg_lock);
if (!rx->app_ops && !sock_flag(sk, SOCK_DEAD))
sk->sk_data_ready(sk);
}
rcu_read_unlock();
}
/*
* Locate the OOB message to respond to by its ID.
*/
static struct sk_buff *rxrpc_find_pending_oob(struct rxrpc_sock *rx, u64 oob_id)
{
struct rb_node *p;
struct sk_buff *skb;
p = rx->pending_oobq.rb_node;
while (p) {
skb = rb_entry(p, struct sk_buff, rbnode);
if (oob_id < skb->skb_mstamp_ns)
p = p->rb_left;
else if (oob_id > skb->skb_mstamp_ns)
p = p->rb_right;
else
return skb;
}
return NULL;
}
/*
* Add an OOB message into the pending-response set. We always assign the next
* value from a 64-bit counter to the oob_id, so just assume we're always going
* to be on the right-hand edge of the tree and that the counter won't wrap.
* The tree is also given a ref to the message.
*/
void rxrpc_add_pending_oob(struct rxrpc_sock *rx, struct sk_buff *skb)
{
struct rb_node **pp = &rx->pending_oobq.rb_node, *p = NULL;
while (*pp) {
p = *pp;
pp = &(*pp)->rb_right;
}
rb_link_node(&skb->rbnode, p, pp);
rb_insert_color(&skb->rbnode, &rx->pending_oobq);
}
/*
* Extract control messages from the sendmsg() control buffer.
*/
static int rxrpc_sendmsg_oob_cmsg(struct msghdr *msg, struct rxrpc_oob_params *p)
{
struct cmsghdr *cmsg;
Annotation
- Immediate include surface: `linux/net.h`, `linux/gfp.h`, `linux/skbuff.h`, `linux/export.h`, `linux/sched/signal.h`, `net/sock.h`, `net/af_rxrpc.h`, `ar-internal.h`.
- Detected declarations: `struct rxrpc_oob_params`, `enum rxrpc_oob_command`, `function rxrpc_notify_socket_oob`, `function rxrpc_add_pending_oob`, `function sendmsg`, `function for_each_cmsghdr`, `function sendmsg`, `function rxrpc_sendmsg_oob`, `function rxrpc_kernel_query_oob`, `function rxrpc_kernel_free_oob`.
- 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.