include/net/llc.h
Source file repositories/reference/linux-study-clean/include/net/llc.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/llc.h- Extension
.h- Size
- 4218 bytes
- Lines
- 160
- 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.hlinux/if_ether.hlinux/list.hlinux/spinlock.hlinux/rculist_nulls.hlinux/hash.hlinux/jhash.hlinux/atomic.h
Detected Declarations
struct net_devicestruct packet_typestruct sk_buffstruct llc_addrstruct llc_sapfunction llc_sk_laddr_hashfnfunction llc_sap_holdfunction llc_sap_hold_safefunction llc_sap_put
Annotated Snippet
struct llc_addr {
unsigned char lsap;
unsigned char mac[IFHWADDRLEN];
};
#define LLC_SAP_STATE_INACTIVE 1
#define LLC_SAP_STATE_ACTIVE 2
#define LLC_SK_DEV_HASH_BITS 6
#define LLC_SK_DEV_HASH_ENTRIES (1<<LLC_SK_DEV_HASH_BITS)
#define LLC_SK_LADDR_HASH_BITS 6
#define LLC_SK_LADDR_HASH_ENTRIES (1<<LLC_SK_LADDR_HASH_BITS)
/**
* struct llc_sap - Defines the SAP component
*
* @station - station this sap belongs to
* @state - sap state
* @p_bit - only lowest-order bit used
* @f_bit - only lowest-order bit used
* @laddr - SAP value in this 'lsap'
* @node - entry in station sap_list
* @sk_list - LLC sockets this one manages
*/
struct llc_sap {
unsigned char state;
unsigned char p_bit;
unsigned char f_bit;
refcount_t refcnt;
int (*rcv_func)(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt,
struct net_device *orig_dev);
struct llc_addr laddr;
struct list_head node;
spinlock_t sk_lock;
int sk_count;
struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES];
struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES];
struct rcu_head rcu;
};
static inline
struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex)
{
u32 bucket = hash_32(ifindex, LLC_SK_DEV_HASH_BITS);
return &sap->sk_dev_hash[bucket];
}
static inline
u32 llc_sk_laddr_hashfn(struct llc_sap *sap, const struct llc_addr *laddr)
{
return hash_32(jhash(laddr->mac, sizeof(laddr->mac), 0),
LLC_SK_LADDR_HASH_BITS);
}
static inline
struct hlist_nulls_head *llc_sk_laddr_hash(struct llc_sap *sap,
const struct llc_addr *laddr)
{
return &sap->sk_laddr_hash[llc_sk_laddr_hashfn(sap, laddr)];
}
#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */
#define LLC_DEST_SAP 1 /* Type 1 goes here */
#define LLC_DEST_CONN 2 /* Type 2 goes here */
extern struct list_head llc_sap_list;
int llc_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
struct net_device *orig_dev);
int llc_mac_hdr_init(struct sk_buff *skb, const unsigned char *sa,
const unsigned char *da);
void llc_add_pack(int type,
void (*handler)(struct llc_sap *sap, struct sk_buff *skb));
void llc_remove_pack(int type);
void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
struct llc_sap *llc_sap_open(unsigned char lsap,
int (*rcv)(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt,
struct net_device *orig_dev));
static inline void llc_sap_hold(struct llc_sap *sap)
{
Annotation
- Immediate include surface: `linux/if.h`, `linux/if_ether.h`, `linux/list.h`, `linux/spinlock.h`, `linux/rculist_nulls.h`, `linux/hash.h`, `linux/jhash.h`, `linux/atomic.h`.
- Detected declarations: `struct net_device`, `struct packet_type`, `struct sk_buff`, `struct llc_addr`, `struct llc_sap`, `function llc_sk_laddr_hashfn`, `function llc_sap_hold`, `function llc_sap_hold_safe`, `function llc_sap_put`.
- 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.