include/linux/dim.h
Source file repositories/reference/linux-study-clean/include/linux/dim.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/dim.h- Extension
.h- Size
- 12996 bytes
- Lines
- 452
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bits.hlinux/kernel.hlinux/module.hlinux/types.hlinux/workqueue.h
Detected Declarations
struct net_devicestruct dim_cq_moderstruct dim_irq_moderstruct dim_samplestruct dim_statsstruct dimenum dim_cq_period_modeenum dim_stateenum dim_tune_stateenum dim_stats_stateenum dim_step_resultfunction dim_update_samplefunction dim_update_sample_with_comps
Annotated Snippet
struct dim_cq_moder {
u16 usec;
u16 pkts;
u16 comps;
u8 cq_period_mode;
struct rcu_head rcu;
};
#define DIM_PROFILE_RX BIT(0) /* support rx profile modification */
#define DIM_PROFILE_TX BIT(1) /* support tx profile modification */
#define DIM_COALESCE_USEC BIT(0) /* support usec field modification */
#define DIM_COALESCE_PKTS BIT(1) /* support pkts field modification */
#define DIM_COALESCE_COMPS BIT(2) /* support comps field modification */
/**
* struct dim_irq_moder - Structure for irq moderation information.
* Used to collect irq moderation related information.
*
* @profile_flags: DIM_PROFILE_*
* @coal_flags: DIM_COALESCE_* for Rx and Tx
* @dim_rx_mode: Rx DIM period count mode: CQE or EQE
* @dim_tx_mode: Tx DIM period count mode: CQE or EQE
* @rx_profile: DIM profile list for Rx
* @tx_profile: DIM profile list for Tx
* @rx_dim_work: Rx DIM worker scheduled by net_dim()
* @tx_dim_work: Tx DIM worker scheduled by net_dim()
*/
struct dim_irq_moder {
u8 profile_flags;
u8 coal_flags;
u8 dim_rx_mode;
u8 dim_tx_mode;
struct dim_cq_moder __rcu *rx_profile;
struct dim_cq_moder __rcu *tx_profile;
void (*rx_dim_work)(struct work_struct *work);
void (*tx_dim_work)(struct work_struct *work);
};
/**
* struct dim_sample - Structure for DIM sample data.
* Used for communications between DIM and its consumer.
*
* @time: Sample timestamp
* @pkt_ctr: Number of packets
* @byte_ctr: Number of bytes
* @event_ctr: Number of events
* @comp_ctr: Current completion counter
*/
struct dim_sample {
ktime_t time;
u32 pkt_ctr;
u32 byte_ctr;
u16 event_ctr;
u32 comp_ctr;
};
/**
* struct dim_stats - Structure for DIM stats.
* Used for holding current measured rates.
*
* @ppms: Packets per msec
* @bpms: Bytes per msec
* @epms: Events per msec
* @cpms: Completions per msec
* @cpe_ratio: Ratio of completions to events
*/
struct dim_stats {
int ppms; /* packets per msec */
int bpms; /* bytes per msec */
int epms; /* events per msec */
int cpms; /* completions per msec */
int cpe_ratio; /* ratio of completions to events */
};
/**
* struct dim - Main structure for dynamic interrupt moderation (DIM).
* Used for holding all information about a specific DIM instance.
*
* @state: Algorithm state (see below)
* @prev_stats: Measured rates from previous iteration (for comparison)
* @start_sample: Sampled data at start of current iteration
* @measuring_sample: A &dim_sample that is used to update the current events
* @work: Work to perform on action required
* @priv: A pointer to the struct that points to dim
* @profile_ix: Current moderation profile
* @mode: CQ period count mode
* @tune_state: Algorithm tuning state (see below)
* @steps_right: Number of steps taken towards higher moderation
* @steps_left: Number of steps taken towards lower moderation
Annotation
- Immediate include surface: `linux/bits.h`, `linux/kernel.h`, `linux/module.h`, `linux/types.h`, `linux/workqueue.h`.
- Detected declarations: `struct net_device`, `struct dim_cq_moder`, `struct dim_irq_moder`, `struct dim_sample`, `struct dim_stats`, `struct dim`, `enum dim_cq_period_mode`, `enum dim_state`, `enum dim_tune_state`, `enum dim_stats_state`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.