include/net/netdev_queues.h
Source file repositories/reference/linux-study-clean/include/net/netdev_queues.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/netdev_queues.h- Extension
.h- Size
- 13526 bytes
- Lines
- 394
- 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/netdevice.h
Detected Declarations
struct netdev_configstruct netdev_queue_configstruct netdev_queue_stats_rxstruct netdev_queue_stats_txstruct netdev_stat_opsstruct netdev_queue_mgmt_opsfunction netdev_txq_completed_mbfunction netif_subqueue_sentfunction netif_xmit_timeout_ms
Annotated Snippet
struct netdev_config {
u32 hds_thresh;
u8 hds_config;
};
struct netdev_queue_config {
u32 rx_page_size;
};
/* See the netdev.yaml spec for definition of each statistic */
struct netdev_queue_stats_rx {
u64 bytes;
u64 packets;
u64 alloc_fail;
u64 hw_drops;
u64 hw_drop_overruns;
u64 csum_complete;
u64 csum_unnecessary;
u64 csum_none;
u64 csum_bad;
u64 hw_gro_packets;
u64 hw_gro_bytes;
u64 hw_gro_wire_packets;
u64 hw_gro_wire_bytes;
u64 hw_drop_ratelimits;
};
struct netdev_queue_stats_tx {
u64 bytes;
u64 packets;
u64 hw_drops;
u64 hw_drop_errors;
u64 csum_none;
u64 needs_csum;
u64 hw_gso_packets;
u64 hw_gso_bytes;
u64 hw_gso_wire_packets;
u64 hw_gso_wire_bytes;
u64 hw_drop_ratelimits;
u64 stop;
u64 wake;
};
/**
* struct netdev_stat_ops - netdev ops for fine grained stats
* @get_queue_stats_rx: get stats for a given Rx queue
* @get_queue_stats_tx: get stats for a given Tx queue
* @get_base_stats: get base stats (not belonging to any live instance)
*
* Query stats for a given object. The values of the statistics are undefined
* on entry (specifically they are *not* zero-initialized). Drivers should
* assign values only to the statistics they collect. Statistics which are not
* collected must be left undefined.
*
* Queue objects are not necessarily persistent, and only currently active
* queues are queried by the per-queue callbacks. This means that per-queue
* statistics will not generally add up to the total number of events for
* the device. The @get_base_stats callback allows filling in the delta
* between events for currently live queues and overall device history.
* @get_base_stats can also be used to report any miscellaneous packets
* transferred outside of the main set of queues used by the networking stack.
* When the statistics for the entire device are queried, first @get_base_stats
* is issued to collect the delta, and then a series of per-queue callbacks.
* Only statistics which are set in @get_base_stats will be reported
* at the device level, meaning that unlike in queue callbacks, setting
* a statistic to zero in @get_base_stats is a legitimate thing to do.
* This is because @get_base_stats has a second function of designating which
* statistics are in fact correct for the entire device (e.g. when history
* for some of the events is not maintained, and reliable "total" cannot
* be provided).
*
* Ops are called under the instance lock if netdev_need_ops_lock()
* returns true, otherwise under rtnl_lock.
* Device drivers can assume that when collecting total device stats,
* the @get_base_stats and subsequent per-queue calls are performed
* "atomically" (without releasing the relevant lock).
*
* Device drivers are encouraged to reset the per-queue statistics when
* number of queues change. This is because the primary use case for
* per-queue statistics is currently to detect traffic imbalance.
*/
Annotation
- Immediate include surface: `linux/netdevice.h`.
- Detected declarations: `struct netdev_config`, `struct netdev_queue_config`, `struct netdev_queue_stats_rx`, `struct netdev_queue_stats_tx`, `struct netdev_stat_ops`, `struct netdev_queue_mgmt_ops`, `function netdev_txq_completed_mb`, `function netif_subqueue_sent`, `function netif_xmit_timeout_ms`.
- 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.