include/net/sch_generic.h
Source file repositories/reference/linux-study-clean/include/net/sch_generic.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/sch_generic.h- Extension
.h- Size
- 39598 bytes
- Lines
- 1543
- 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/netdevice.hlinux/types.hlinux/rcupdate.hlinux/pkt_sched.hlinux/pkt_cls.hlinux/percpu.hlinux/dynamic_queue_limits.hlinux/list.hlinux/refcount.hlinux/workqueue.hlinux/mutex.hlinux/rwsem.hlinux/atomic.hlinux/hashtable.hnet/gen_stats.hnet/rtnetlink.hnet/flow_offload.hlinux/xarray.hnet/dropreason-qdisc.h
Detected Declarations
struct Qdisc_opsstruct qdisc_walkerstruct tcf_walkerstruct modulestruct bpf_flow_keysstruct Qdiscstruct netdev_queuestruct qdisc_rate_tablestruct qdisc_size_tablestruct qdisc_skb_headstruct Qdiscstruct Qdisc_class_opsstruct Qdisc_opsstruct tcf_resultstruct tcf_chainstruct tcf_proto_opsstruct tcf_protostruct qdisc_skb_cbstruct tcf_chainstruct tcf_blockstruct Qdisc_class_commonstruct Qdisc_class_hashstruct tc_skb_cbstruct psched_ratecfgstruct psched_pktratestruct mini_Qdiscstruct mini_Qdisc_pairenum qdisc_state_tenum qdisc_class_ops_flagsenum tcf_proto_ops_flagsenum net_xmit_qdisc_tfunction qdisc_refcount_incfunction qdisc_refcount_dec_if_onefunction qdisc_is_runningfunction nolock_qdisc_is_emptyfunction qdisc_is_percpu_statsfunction qdisc_is_emptyfunction qdisc_run_beginfunction qdisc_may_bulkfunction qdisc_avail_bulklimitfunction lockdep_tcf_chain_is_lockedfunction lockdep_tcf_proto_is_lockedfunction qdisc_cb_private_validatefunction qdisc_qlenfunction qdisc_qlen_locklessfunction qdisc_qlen_incfunction qdisc_qlen_decfunction qdisc_qlen_sum
Annotated Snippet
struct qdisc_rate_table {
struct tc_ratespec rate;
u32 data[256];
struct qdisc_rate_table *next;
int refcnt;
};
enum qdisc_state_t {
__QDISC_STATE_SCHED,
__QDISC_STATE_DEACTIVATED,
__QDISC_STATE_MISSED,
__QDISC_STATE_DRAINING,
};
#define QDISC_STATE_MISSED BIT(__QDISC_STATE_MISSED)
#define QDISC_STATE_DRAINING BIT(__QDISC_STATE_DRAINING)
#define QDISC_STATE_NON_EMPTY (QDISC_STATE_MISSED | \
QDISC_STATE_DRAINING)
struct qdisc_size_table {
struct rcu_head rcu;
struct list_head list;
struct tc_sizespec szopts;
int refcnt;
u16 data[];
};
/* similar to sk_buff_head, but skb->prev pointer is undefined. */
struct qdisc_skb_head {
struct sk_buff *head;
struct sk_buff *tail;
__u32 qlen;
spinlock_t lock;
};
struct Qdisc {
int (*enqueue)(struct sk_buff *skb,
struct Qdisc *sch,
struct sk_buff **to_free);
struct sk_buff * (*dequeue)(struct Qdisc *sch);
unsigned int flags;
#define TCQ_F_BUILTIN 1
#define TCQ_F_INGRESS 2
#define TCQ_F_CAN_BYPASS 4
#define TCQ_F_MQROOT 8
#define TCQ_F_ONETXQUEUE 0x10 /* dequeue_skb() can assume all skbs are for
* q->dev_queue : It can test
* netif_xmit_frozen_or_stopped() before
* dequeueing next packet.
* Its true for MQ/MQPRIO slaves, or non
* multiqueue device.
*/
#define TCQ_F_WARN_NONWC (1 << 16)
#define TCQ_F_CPUSTATS 0x20 /* run using percpu statistics */
#define TCQ_F_NOPARENT 0x40 /* root of its hierarchy :
* qdisc_tree_reduce_backlog() should stop.
*/
#define TCQ_F_INVISIBLE 0x80 /* invisible by default in dump */
#define TCQ_F_NOLOCK 0x100 /* qdisc does not require locking */
#define TCQ_F_OFFLOADED 0x200 /* qdisc is offloaded to HW */
#define TCQ_F_DEQUEUE_DROPS 0x400 /* ->dequeue() can drop packets in q->to_free */
u32 limit;
const struct Qdisc_ops *ops;
struct qdisc_size_table __rcu *stab;
struct hlist_node hash;
u32 handle;
u32 parent;
struct netdev_queue *dev_queue;
struct net_rate_estimator __rcu *rate_est;
struct gnet_stats_basic_sync __percpu *cpu_bstats;
struct gnet_stats_queue __percpu *cpu_qstats;
int pad;
refcount_t refcnt;
/* Cache line potentially dirtied in dequeue() or __netif_reschedule(). */
__cacheline_group_begin(Qdisc_read_mostly) ____cacheline_aligned;
struct sk_buff_head gso_skb;
struct Qdisc *next_sched;
struct sk_buff_head skb_bad_txq;
__cacheline_group_end(Qdisc_read_mostly);
/* Fields dirtied in dequeue() fast path. */
__cacheline_group_begin(Qdisc_write) ____cacheline_aligned;
struct qdisc_skb_head q;
unsigned long state;
struct gnet_stats_basic_sync bstats;
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/types.h`, `linux/rcupdate.h`, `linux/pkt_sched.h`, `linux/pkt_cls.h`, `linux/percpu.h`, `linux/dynamic_queue_limits.h`, `linux/list.h`.
- Detected declarations: `struct Qdisc_ops`, `struct qdisc_walker`, `struct tcf_walker`, `struct module`, `struct bpf_flow_keys`, `struct Qdisc`, `struct netdev_queue`, `struct qdisc_rate_table`, `struct qdisc_size_table`, `struct qdisc_skb_head`.
- 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.