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.

Dependency Surface

Detected Declarations

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

Implementation Notes