net/llc/llc_proc.c
Source file repositories/reference/linux-study-clean/net/llc/llc_proc.c
File Facts
- System
- Linux kernel
- Corpus path
net/llc/llc_proc.c- Extension
.c- Size
- 5876 bytes
- Lines
- 246
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/kernel.hlinux/proc_fs.hlinux/errno.hlinux/seq_file.hlinux/export.hnet/net_namespace.hnet/sock.hnet/llc.hnet/llc_c_ac.hnet/llc_c_ev.hnet/llc_c_st.hnet/llc_conn.h
Detected Declarations
function Copyrightfunction list_for_each_entry_rcufunction sk_nulls_for_eachfunction llc_seq_stopfunction llc_seq_socket_showfunction llc_seq_core_showfunction llc_proc_initfunction llc_proc_exit
Annotated Snippet
sk_nulls_for_each(sk, node, head) {
if (!pos)
goto found; /* keep the lock */
--pos;
}
}
spin_unlock_bh(&sap->sk_lock);
}
sk = NULL;
found:
return sk;
}
static void *llc_seq_start(struct seq_file *seq, loff_t *pos) __acquires(RCU)
{
loff_t l = *pos;
rcu_read_lock_bh();
return l ? llc_get_sk_idx(--l) : SEQ_START_TOKEN;
}
static struct sock *laddr_hash_next(struct llc_sap *sap, int bucket)
{
struct hlist_nulls_node *node;
struct sock *sk = NULL;
while (++bucket < LLC_SK_LADDR_HASH_ENTRIES)
sk_nulls_for_each(sk, node, &sap->sk_laddr_hash[bucket])
goto out;
out:
return sk;
}
static void *llc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct sock* sk, *next;
struct llc_sock *llc;
struct llc_sap *sap;
++*pos;
if (v == SEQ_START_TOKEN) {
sk = llc_get_sk_idx(0);
goto out;
}
sk = v;
next = sk_nulls_next(sk);
if (next) {
sk = next;
goto out;
}
llc = llc_sk(sk);
sap = llc->sap;
sk = laddr_hash_next(sap, llc_sk_laddr_hashfn(sap, &llc->laddr));
if (sk)
goto out;
spin_unlock_bh(&sap->sk_lock);
list_for_each_entry_continue_rcu(sap, &llc_sap_list, node) {
spin_lock_bh(&sap->sk_lock);
sk = laddr_hash_next(sap, -1);
if (sk)
break; /* keep the lock */
spin_unlock_bh(&sap->sk_lock);
}
out:
return sk;
}
static void llc_seq_stop(struct seq_file *seq, void *v)
{
if (v && v != SEQ_START_TOKEN) {
struct sock *sk = v;
struct llc_sock *llc = llc_sk(sk);
struct llc_sap *sap = llc->sap;
spin_unlock_bh(&sap->sk_lock);
}
rcu_read_unlock_bh();
}
static int llc_seq_socket_show(struct seq_file *seq, void *v)
{
struct sock* sk;
struct llc_sock *llc;
if (v == SEQ_START_TOKEN) {
seq_puts(seq, "SKt Mc local_mac_sap remote_mac_sap "
" tx_queue rx_queue st uid link\n");
goto out;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/proc_fs.h`, `linux/errno.h`, `linux/seq_file.h`, `linux/export.h`, `net/net_namespace.h`, `net/sock.h`.
- Detected declarations: `function Copyright`, `function list_for_each_entry_rcu`, `function sk_nulls_for_each`, `function llc_seq_stop`, `function llc_seq_socket_show`, `function llc_seq_core_show`, `function llc_proc_init`, `function llc_proc_exit`.
- 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.