include/net/pkt_cls.h
Source file repositories/reference/linux-study-clean/include/net/pkt_cls.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/pkt_cls.h- Extension
.h- Size
- 26705 bytes
- Lines
- 1087
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pkt_cls.hlinux/workqueue.hnet/sch_generic.hnet/act_api.hnet/net_namespace.h
Detected Declarations
struct tcf_walkerstruct tcf_block_ext_infostruct tcf_qeventstruct tcf_block_cbstruct tcf_extsstruct tcf_pkt_infostruct tcf_ematch_opsstruct tcf_ematchstruct tcf_ematch_treestruct tcf_ematch_opsstruct tcf_ematch_treestruct tc_cls_u32_knodestruct tc_cls_u32_hnodestruct tc_cls_u32_offloadstruct tc_cls_matchall_offloadstruct tc_cls_bpf_offloadstruct tc_cookiestruct tc_qopt_offload_statsstruct tc_mq_opt_offload_graft_paramsstruct tc_mq_qopt_offloadstruct tc_htb_qopt_offloadstruct tc_red_qopt_offload_paramsstruct tc_red_qopt_offloadstruct tc_gred_vq_qopt_offload_paramsstruct tc_gred_qopt_offload_paramsstruct tc_gred_qopt_offload_statsstruct tc_gred_qopt_offloadstruct tc_prio_qopt_offload_paramsstruct tc_prio_qopt_offload_graft_paramsstruct tc_prio_qopt_offloadstruct tc_root_qopt_offloadstruct tc_ets_qopt_offload_replace_paramsstruct tc_ets_qopt_offload_graft_paramsstruct tc_ets_qopt_offloadstruct tc_tbf_qopt_offload_replace_paramsstruct tc_tbf_qopt_offloadstruct tc_fifo_qopt_offloadenum tc_clsu32_commandenum tc_matchall_commandenum tc_clsbpf_commandenum tc_mq_commandenum tc_htb_commandenum tc_red_commandenum tc_gred_commandenum tc_prio_commandenum tc_root_commandenum tc_ets_commandenum tc_tbf_command
Annotated Snippet
struct tcf_walker {
int stop;
int skip;
int count;
bool nonempty;
unsigned long cookie;
int (*fn)(struct tcf_proto *, void *node, struct tcf_walker *);
};
int register_tcf_proto_ops(struct tcf_proto_ops *ops);
void unregister_tcf_proto_ops(struct tcf_proto_ops *ops);
#define NET_CLS_ALIAS_PREFIX "net-cls-"
#define MODULE_ALIAS_NET_CLS(kind) MODULE_ALIAS(NET_CLS_ALIAS_PREFIX kind)
struct tcf_block_ext_info {
enum flow_block_binder_type binder_type;
tcf_chain_head_change_t *chain_head_change;
void *chain_head_change_priv;
u32 block_index;
};
struct tcf_qevent {
struct tcf_block *block;
struct tcf_block_ext_info info;
struct tcf_proto __rcu *filter_chain;
};
struct tcf_block_cb;
bool tcf_queue_work(struct rcu_work *rwork, work_func_t func);
#ifdef CONFIG_NET_CLS
struct tcf_chain *tcf_chain_get_by_act(struct tcf_block *block,
u32 chain_index);
void tcf_chain_put_by_act(struct tcf_chain *chain);
struct tcf_chain *tcf_get_next_chain(struct tcf_block *block,
struct tcf_chain *chain);
struct tcf_proto *tcf_get_next_proto(struct tcf_chain *chain,
struct tcf_proto *tp);
void tcf_block_netif_keep_dst(struct tcf_block *block);
int tcf_block_get(struct tcf_block **p_block,
struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q,
struct netlink_ext_ack *extack);
int tcf_block_get_ext(struct tcf_block **p_block, struct Qdisc *q,
struct tcf_block_ext_info *ei,
struct netlink_ext_ack *extack);
void tcf_block_put(struct tcf_block *block);
void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q,
struct tcf_block_ext_info *ei);
int tcf_exts_init_ex(struct tcf_exts *exts, struct net *net, int action,
int police, struct tcf_proto *tp, u32 handle, bool used_action_miss);
static inline bool tcf_block_shared(struct tcf_block *block)
{
return block->index;
}
static inline bool tcf_block_non_null_shared(struct tcf_block *block)
{
return block && block->index;
}
#ifdef CONFIG_NET_CLS_ACT
DECLARE_STATIC_KEY_FALSE(tcf_sw_enabled_key);
static inline bool tcf_block_bypass_sw(struct tcf_block *block)
{
return block && !atomic_read(&block->useswcnt);
}
#endif
static inline struct Qdisc *tcf_block_q(struct tcf_block *block)
{
WARN_ON(tcf_block_shared(block));
return block->q;
}
int tcf_classify(struct sk_buff *skb,
const struct tcf_block *block,
const struct tcf_proto *tp, struct tcf_result *res,
bool compat_mode);
static inline bool tc_cls_stats_dump(struct tcf_proto *tp,
struct tcf_walker *arg,
void *filter)
{
if (arg->count >= arg->skip && arg->fn(tp, filter, arg) < 0) {
arg->stop = 1;
return false;
}
Annotation
- Immediate include surface: `linux/pkt_cls.h`, `linux/workqueue.h`, `net/sch_generic.h`, `net/act_api.h`, `net/net_namespace.h`.
- Detected declarations: `struct tcf_walker`, `struct tcf_block_ext_info`, `struct tcf_qevent`, `struct tcf_block_cb`, `struct tcf_exts`, `struct tcf_pkt_info`, `struct tcf_ematch_ops`, `struct tcf_ematch`, `struct tcf_ematch_tree`, `struct tcf_ematch_ops`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.