Skip to content

Commit 690a6ca

Browse files
rddunlapJakub Kicinski
authored andcommitted
DIM: fix dim.h kernel-doc and headers
Lots of fixes to kernel-doc in structs, enums, and functions. Also add header files that are being used but not yet #included. Signed-off-by: Randy Dunlap <[email protected]> Cc: Yamin Friedman <[email protected]> Cc: Tal Gilboa <[email protected]> Cc: Saeed Mahameed <[email protected]> Cc: Doug Ledford <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b2d8c27 commit 690a6ca

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

include/linux/dim.h

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,40 @@
44
#ifndef DIM_H
55
#define DIM_H
66

7+
#include <linux/bits.h>
8+
#include <linux/kernel.h>
79
#include <linux/module.h>
10+
#include <linux/types.h>
11+
#include <linux/workqueue.h>
812

9-
/**
13+
/*
1014
* Number of events between DIM iterations.
1115
* Causes a moderation of the algorithm run.
1216
*/
1317
#define DIM_NEVENTS 64
1418

15-
/**
19+
/*
1620
* Is a difference between values justifies taking an action.
1721
* We consider 10% difference as significant.
1822
*/
1923
#define IS_SIGNIFICANT_DIFF(val, ref) \
2024
(((100UL * abs((val) - (ref))) / (ref)) > 10)
2125

22-
/**
26+
/*
2327
* Calculate the gap between two values.
2428
* Take wrap-around and variable size into consideration.
2529
*/
2630
#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) \
2731
& (BIT_ULL(bits) - 1))
2832

2933
/**
30-
* Structure for CQ moderation values.
34+
* struct dim_cq_moder - Structure for CQ moderation values.
3135
* Used for communications between DIM and its consumer.
3236
*
3337
* @usec: CQ timer suggestion (by DIM)
3438
* @pkts: CQ packet counter suggestion (by DIM)
35-
* @cq_period_mode: CQ priod count mode (from CQE/EQE)
39+
* @comps: Completion counter
40+
* @cq_period_mode: CQ period count mode (from CQE/EQE)
3641
*/
3742
struct dim_cq_moder {
3843
u16 usec;
@@ -42,13 +47,14 @@ struct dim_cq_moder {
4247
};
4348

4449
/**
45-
* Structure for DIM sample data.
50+
* struct dim_sample - Structure for DIM sample data.
4651
* Used for communications between DIM and its consumer.
4752
*
4853
* @time: Sample timestamp
4954
* @pkt_ctr: Number of packets
5055
* @byte_ctr: Number of bytes
5156
* @event_ctr: Number of events
57+
* @comp_ctr: Current completion counter
5258
*/
5359
struct dim_sample {
5460
ktime_t time;
@@ -59,12 +65,14 @@ struct dim_sample {
5965
};
6066

6167
/**
62-
* Structure for DIM stats.
68+
* struct dim_stats - Structure for DIM stats.
6369
* Used for holding current measured rates.
6470
*
6571
* @ppms: Packets per msec
6672
* @bpms: Bytes per msec
6773
* @epms: Events per msec
74+
* @cpms: Completions per msec
75+
* @cpe_ratio: Ratio of completions to events
6876
*/
6977
struct dim_stats {
7078
int ppms; /* packets per msec */
@@ -75,12 +83,13 @@ struct dim_stats {
7583
};
7684

7785
/**
78-
* Main structure for dynamic interrupt moderation (DIM).
86+
* struct dim - Main structure for dynamic interrupt moderation (DIM).
7987
* Used for holding all information about a specific DIM instance.
8088
*
8189
* @state: Algorithm state (see below)
8290
* @prev_stats: Measured rates from previous iteration (for comparison)
8391
* @start_sample: Sampled data at start of current iteration
92+
* @measuring_sample: A &dim_sample that is used to update the current events
8493
* @work: Work to perform on action required
8594
* @priv: A pointer to the struct that points to dim
8695
* @profile_ix: Current moderation profile
@@ -106,83 +115,77 @@ struct dim {
106115
};
107116

108117
/**
109-
* enum dim_cq_period_mode
110-
*
111-
* These are the modes for CQ period count.
118+
* enum dim_cq_period_mode - Modes for CQ period count
112119
*
113120
* @DIM_CQ_PERIOD_MODE_START_FROM_EQE: Start counting from EQE
114121
* @DIM_CQ_PERIOD_MODE_START_FROM_CQE: Start counting from CQE (implies timer reset)
115122
* @DIM_CQ_PERIOD_NUM_MODES: Number of modes
116123
*/
117-
enum {
124+
enum dim_cq_period_mode {
118125
DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0x0,
119126
DIM_CQ_PERIOD_MODE_START_FROM_CQE = 0x1,
120127
DIM_CQ_PERIOD_NUM_MODES
121128
};
122129

123130
/**
124-
* enum dim_state
131+
* enum dim_state - DIM algorithm states
125132
*
126-
* These are the DIM algorithm states.
127133
* These will determine if the algorithm is in a valid state to start an iteration.
128134
*
129135
* @DIM_START_MEASURE: This is the first iteration (also after applying a new profile)
130136
* @DIM_MEASURE_IN_PROGRESS: Algorithm is already in progress - check if
131137
* need to perform an action
132138
* @DIM_APPLY_NEW_PROFILE: DIM consumer is currently applying a profile - no need to measure
133139
*/
134-
enum {
140+
enum dim_state {
135141
DIM_START_MEASURE,
136142
DIM_MEASURE_IN_PROGRESS,
137143
DIM_APPLY_NEW_PROFILE,
138144
};
139145

140146
/**
141-
* enum dim_tune_state
147+
* enum dim_tune_state - DIM algorithm tune states
142148
*
143-
* These are the DIM algorithm tune states.
144149
* These will determine which action the algorithm should perform.
145150
*
146151
* @DIM_PARKING_ON_TOP: Algorithm found a local top point - exit on significant difference
147152
* @DIM_PARKING_TIRED: Algorithm found a deep top point - don't exit if tired > 0
148153
* @DIM_GOING_RIGHT: Algorithm is currently trying higher moderation levels
149154
* @DIM_GOING_LEFT: Algorithm is currently trying lower moderation levels
150155
*/
151-
enum {
156+
enum dim_tune_state {
152157
DIM_PARKING_ON_TOP,
153158
DIM_PARKING_TIRED,
154159
DIM_GOING_RIGHT,
155160
DIM_GOING_LEFT,
156161
};
157162

158163
/**
159-
* enum dim_stats_state
164+
* enum dim_stats_state - DIM algorithm statistics states
160165
*
161-
* These are the DIM algorithm statistics states.
162166
* These will determine the verdict of current iteration.
163167
*
164168
* @DIM_STATS_WORSE: Current iteration shows worse performance than before
165-
* @DIM_STATS_WORSE: Current iteration shows same performance than before
166-
* @DIM_STATS_WORSE: Current iteration shows better performance than before
169+
* @DIM_STATS_SAME: Current iteration shows same performance than before
170+
* @DIM_STATS_BETTER: Current iteration shows better performance than before
167171
*/
168-
enum {
172+
enum dim_stats_state {
169173
DIM_STATS_WORSE,
170174
DIM_STATS_SAME,
171175
DIM_STATS_BETTER,
172176
};
173177

174178
/**
175-
* enum dim_step_result
179+
* enum dim_step_result - DIM algorithm step results
176180
*
177-
* These are the DIM algorithm step results.
178181
* These describe the result of a step.
179182
*
180183
* @DIM_STEPPED: Performed a regular step
181184
* @DIM_TOO_TIRED: Same kind of step was done multiple times - should go to
182185
* tired parking
183186
* @DIM_ON_EDGE: Stepped to the most left/right profile
184187
*/
185-
enum {
188+
enum dim_step_result {
186189
DIM_STEPPED,
187190
DIM_TOO_TIRED,
188191
DIM_ON_EDGE,
@@ -199,7 +202,7 @@ enum {
199202
bool dim_on_top(struct dim *dim);
200203

201204
/**
202-
* dim_turn - change profile alterning direction
205+
* dim_turn - change profile altering direction
203206
* @dim: DIM context
204207
*
205208
* Go left if we were going right and vice-versa.
@@ -238,7 +241,7 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
238241
struct dim_stats *curr_stats);
239242

240243
/**
241-
* dim_update_sample - set a sample's fields with give values
244+
* dim_update_sample - set a sample's fields with given values
242245
* @event_ctr: number of events to set
243246
* @packets: number of packets to set
244247
* @bytes: number of bytes to set
@@ -304,8 +307,8 @@ struct dim_cq_moder net_dim_get_def_tx_moderation(u8 cq_period_mode);
304307
* @end_sample: Current data measurement
305308
*
306309
* Called by the consumer.
307-
* This is the main logic of the algorithm, where data is processed in order to decide on next
308-
* required action.
310+
* This is the main logic of the algorithm, where data is processed in order
311+
* to decide on next required action.
309312
*/
310313
void net_dim(struct dim *dim, struct dim_sample end_sample);
311314

0 commit comments

Comments
 (0)