net/atm/common.c
Source file repositories/reference/linux-study-clean/net/atm/common.c
File Facts
- System
- Linux kernel
- Corpus path
net/atm/common.c- Extension
.c- Size
- 20305 bytes
- Lines
- 854
- 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/kmod.hlinux/net.hlinux/atm.hlinux/atmdev.hlinux/socket.hlinux/errno.hlinux/capability.hlinux/mm.hlinux/sched/signal.hlinux/time64.hlinux/skbuff.hlinux/bitops.hlinux/init.hlinux/slab.hnet/sock.hlinux/uaccess.hlinux/poll.hlinux/uio.hlinux/atomic.hresources.hcommon.hprotocols.h
Detected Declarations
function __vcc_insert_socketfunction vcc_insert_socketfunction vcc_remove_socketfunction vcc_tx_readyfunction vcc_sock_destructfunction vcc_def_wakeupfunction vcc_writablefunction vcc_write_spacefunction vcc_release_cbfunction vcc_createfunction vcc_destroy_socketfunction vcc_releasefunction vcc_release_asyncfunction vcc_process_recv_queuefunction skb_queue_walk_safefunction atm_dev_signal_changefunction atm_dev_release_vccsfunction sk_for_each_safefunction adjust_tpfunction check_cifunction sk_for_eachfunction find_cifunction __vcc_connectfunction vcc_connectfunction vcc_recvmsgfunction vcc_sendmsgfunction vcc_pollfunction check_tpfunction check_qosfunction vcc_setsockoptfunction vcc_getsockoptfunction register_atmdevice_notifierfunction unregister_atmdevice_notifierfunction atm_initfunction atm_exitmodule init atm_initexport vcc_hashexport vcc_sklist_lockexport vcc_insert_socketexport vcc_release_asyncexport vcc_process_recv_queueexport atm_dev_signal_changeexport atm_dev_release_vccsexport register_atmdevice_notifierexport unregister_atmdevice_notifier
Annotated Snippet
#include <linux/net.h> /* struct socket, struct proto_ops */
#include <linux/atm.h> /* ATM stuff */
#include <linux/atmdev.h>
#include <linux/socket.h> /* SOL_SOCKET */
#include <linux/errno.h> /* error codes */
#include <linux/capability.h>
#include <linux/mm.h>
#include <linux/sched/signal.h>
#include <linux/time64.h> /* 64-bit time for seconds */
#include <linux/skbuff.h>
#include <linux/bitops.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <net/sock.h> /* struct sock */
#include <linux/uaccess.h>
#include <linux/poll.h>
#include <linux/uio.h>
#include <linux/atomic.h>
#include "resources.h" /* atm_find_dev */
#include "common.h" /* prototypes */
#include "protocols.h" /* atm_init_<transport> */
struct hlist_head vcc_hash[VCC_HTABLE_SIZE];
EXPORT_SYMBOL(vcc_hash);
DEFINE_RWLOCK(vcc_sklist_lock);
EXPORT_SYMBOL(vcc_sklist_lock);
static ATOMIC_NOTIFIER_HEAD(atm_dev_notify_chain);
static void __vcc_insert_socket(struct sock *sk)
{
struct atm_vcc *vcc = atm_sk(sk);
struct hlist_head *head = &vcc_hash[vcc->vci & (VCC_HTABLE_SIZE - 1)];
sk->sk_hash = vcc->vci & (VCC_HTABLE_SIZE - 1);
sk_add_node(sk, head);
}
void vcc_insert_socket(struct sock *sk)
{
write_lock_irq(&vcc_sklist_lock);
__vcc_insert_socket(sk);
write_unlock_irq(&vcc_sklist_lock);
}
EXPORT_SYMBOL(vcc_insert_socket);
static void vcc_remove_socket(struct sock *sk)
{
write_lock_irq(&vcc_sklist_lock);
sk_del_node_init(sk);
write_unlock_irq(&vcc_sklist_lock);
}
static bool vcc_tx_ready(struct atm_vcc *vcc, unsigned int size)
{
struct sock *sk = sk_atm(vcc);
if (sk_wmem_alloc_get(sk) && !atm_may_send(vcc, size)) {
pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n",
sk_wmem_alloc_get(sk), size, sk->sk_sndbuf);
return false;
}
return true;
}
static void vcc_sock_destruct(struct sock *sk)
{
if (atomic_read(&sk->sk_rmem_alloc))
printk(KERN_DEBUG "%s: rmem leakage (%d bytes) detected.\n",
__func__, atomic_read(&sk->sk_rmem_alloc));
if (refcount_read(&sk->sk_wmem_alloc))
printk(KERN_DEBUG "%s: wmem leakage (%d bytes) detected.\n",
__func__, refcount_read(&sk->sk_wmem_alloc));
}
static void vcc_def_wakeup(struct sock *sk)
{
struct socket_wq *wq;
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
wake_up(&wq->wait);
rcu_read_unlock();
}
static inline int vcc_writable(struct sock *sk)
Annotation
- Immediate include surface: `linux/module.h`, `linux/kmod.h`, `linux/net.h`, `linux/atm.h`, `linux/atmdev.h`, `linux/socket.h`, `linux/errno.h`, `linux/capability.h`.
- Detected declarations: `function __vcc_insert_socket`, `function vcc_insert_socket`, `function vcc_remove_socket`, `function vcc_tx_ready`, `function vcc_sock_destruct`, `function vcc_def_wakeup`, `function vcc_writable`, `function vcc_write_space`, `function vcc_release_cb`, `function vcc_create`.
- 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.