include/net/llc_pdu.h
Source file repositories/reference/linux-study-clean/include/net/llc_pdu.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/llc_pdu.h- Extension
.h- Size
- 14504 bytes
- Lines
- 439
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/if_ether.h
Detected Declarations
struct llc_pdu_snstruct llc_pdu_unstruct llc_xid_infostruct llc_frmr_infofunction llc_pdu_header_initfunction addressfunction addressfunction llc_pdu_decode_ssapfunction llc_pdu_decode_dsapfunction llc_pdu_init_as_ui_cmdfunction llc_pdu_init_as_test_cmdfunction llc_pdu_init_as_test_rspfunction llc_pdu_init_as_xid_cmdfunction llc_pdu_init_as_xid_rsp
Annotated Snippet
struct llc_pdu_sn {
u8 dsap;
u8 ssap;
u8 ctrl_1;
u8 ctrl_2;
} __packed;
static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb)
{
return (struct llc_pdu_sn *)skb_network_header(skb);
}
/* Un-numbered PDU format (3 bytes in length) */
struct llc_pdu_un {
u8 dsap;
u8 ssap;
u8 ctrl_1;
} __packed;
static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb)
{
return (struct llc_pdu_un *)skb_network_header(skb);
}
/**
* llc_pdu_header_init - initializes pdu header
* @skb: input skb that header must be set into it.
* @type: type of PDU (U, I or S).
* @ssap: source sap.
* @dsap: destination sap.
* @cr: command/response bit (0 or 1).
*
* This function sets DSAP, SSAP and command/Response bit in LLC header.
*/
static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
u8 ssap, u8 dsap, u8 cr)
{
int hlen = 4; /* default value for I and S types */
struct llc_pdu_un *pdu;
switch (type) {
case LLC_PDU_TYPE_U:
hlen = 3;
break;
case LLC_PDU_TYPE_U_XID:
hlen = 6;
break;
}
skb_push(skb, hlen);
skb_reset_network_header(skb);
pdu = llc_pdu_un_hdr(skb);
pdu->dsap = dsap;
pdu->ssap = ssap;
pdu->ssap |= cr;
}
/**
* llc_pdu_decode_sa - extracts, source address (MAC) of input frame
* @skb: input skb that source address must be extracted from it.
* @sa: pointer to source address (6 byte array).
*
* This function extracts source address(MAC) of input frame.
*/
static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
{
memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN);
}
/**
* llc_pdu_decode_da - extracts dest address of input frame
* @skb: input skb that destination address must be extracted from it
* @da: pointer to destination address (6 byte array).
*
* This function extracts destination address(MAC) of input frame.
*/
static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
{
memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN);
}
/**
* llc_pdu_decode_ssap - extracts source SAP of input frame
* @skb: input skb that source SAP must be extracted from it.
* @ssap: source SAP (output argument).
*
* This function extracts source SAP of input frame. Right bit of SSAP is
* command/response bit.
*/
static inline void llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap)
Annotation
- Immediate include surface: `linux/if_ether.h`.
- Detected declarations: `struct llc_pdu_sn`, `struct llc_pdu_un`, `struct llc_xid_info`, `struct llc_frmr_info`, `function llc_pdu_header_init`, `function address`, `function address`, `function llc_pdu_decode_ssap`, `function llc_pdu_decode_dsap`, `function llc_pdu_init_as_ui_cmd`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
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.