net/llc/llc_conn.c
Source file repositories/reference/linux-study-clean/net/llc/llc_conn.c
File Facts
- System
- Linux kernel
- Corpus path
net/llc/llc_conn.c- Extension
.c- Size
- 28308 bytes
- Lines
- 1027
- 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/slab.hnet/llc.hnet/llc_c_ac.hnet/llc_c_ev.hnet/llc_c_st.hnet/llc_conn.hnet/llc_pdu.hnet/llc_sap.hnet/sock.hnet/tcp_states.h
Detected Declarations
function llc_conn_state_processfunction llc_conn_send_pdufunction layerfunction zerofunction zerofunction queuefunction llc_conn_send_pdusfunction llc_conn_servicefunction llc_exec_conn_trans_actionsfunction llc_estab_matchfunction llc_listener_matchfunction llc_data_accept_statefunction llc_find_next_offsetfunction llc_build_offset_tablefunction llc_find_offsetfunction llc_sap_add_socketfunction llc_sap_remove_socketfunction llc_conn_rcvfunction llc_conn_handlerfunction variablesfunction pdufunction llc_sk_initfunction llc_sk_stop_all_timersfunction llc_sk_freefunction llc_sk_reset
Annotated Snippet
if (unlikely(sock_queue_rcv_skb(sk, skb))) {
/*
* shouldn't happen
*/
printk(KERN_ERR "%s: sock_queue_rcv_skb failed!\n",
__func__);
kfree_skb(skb);
}
break;
case LLC_CONN_PRIM:
/*
* Can't be sock_queue_rcv_skb, because we have to leave the
* skb->sk pointing to the newly created struct sock in
* llc_conn_handler. -acme
*/
skb_get(skb);
skb_queue_tail(&sk->sk_receive_queue, skb);
sk->sk_state_change(sk);
break;
case LLC_DISC_PRIM:
sock_hold(sk);
if (sk->sk_type == SOCK_STREAM &&
sk->sk_state == TCP_ESTABLISHED) {
sk->sk_shutdown = SHUTDOWN_MASK;
sk->sk_socket->state = SS_UNCONNECTED;
sk->sk_state = TCP_CLOSE;
if (!sock_flag(sk, SOCK_DEAD)) {
sock_set_flag(sk, SOCK_DEAD);
sk->sk_state_change(sk);
}
}
sock_put(sk);
break;
case LLC_RESET_PRIM:
/*
* FIXME:
* RESET is not being notified to upper layers for now
*/
printk(KERN_INFO "%s: received a reset ind!\n", __func__);
break;
default:
if (ev->ind_prim)
printk(KERN_INFO "%s: received unknown %d prim!\n",
__func__, ev->ind_prim);
/* No indication */
break;
}
switch (ev->cfm_prim) {
case LLC_DATA_PRIM:
if (!llc_data_accept_state(llc->state))
sk->sk_write_space(sk);
else
rc = llc->failed_data_req = 1;
break;
case LLC_CONN_PRIM:
if (sk->sk_type == SOCK_STREAM &&
sk->sk_state == TCP_SYN_SENT) {
if (ev->status) {
sk->sk_socket->state = SS_UNCONNECTED;
sk->sk_state = TCP_CLOSE;
} else {
sk->sk_socket->state = SS_CONNECTED;
sk->sk_state = TCP_ESTABLISHED;
}
sk->sk_state_change(sk);
}
break;
case LLC_DISC_PRIM:
sock_hold(sk);
if (sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_CLOSING) {
sk->sk_socket->state = SS_UNCONNECTED;
sk->sk_state = TCP_CLOSE;
sk->sk_state_change(sk);
}
sock_put(sk);
break;
case LLC_RESET_PRIM:
/*
* FIXME:
* RESET is not being notified to upper layers for now
*/
printk(KERN_INFO "%s: received a reset conf!\n", __func__);
break;
default:
if (ev->cfm_prim)
printk(KERN_INFO "%s: received unknown %d prim!\n",
__func__, ev->cfm_prim);
/* No confirmation */
break;
Annotation
- Immediate include surface: `linux/init.h`, `linux/slab.h`, `net/llc.h`, `net/llc_c_ac.h`, `net/llc_c_ev.h`, `net/llc_c_st.h`, `net/llc_conn.h`, `net/llc_pdu.h`.
- Detected declarations: `function llc_conn_state_process`, `function llc_conn_send_pdu`, `function layer`, `function zero`, `function zero`, `function queue`, `function llc_conn_send_pdus`, `function llc_conn_service`, `function llc_exec_conn_trans_actions`, `function llc_estab_match`.
- 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.