Skip to content

Commit b42a3d7

Browse files
mohittahilianidavem330
authored andcommitted
pie: improve comments and commenting style
Improve the comments along with the commenting style used to describe the members of the structures and their initial values in the init functions. Signed-off-by: Mohit P. Tahiliani <[email protected]> Signed-off-by: Leslie Monis <[email protected]> Signed-off-by: Gautam Ramakrishnan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2dfb195 commit b42a3d7

File tree

1 file changed

+58
-27
lines changed

1 file changed

+58
-27
lines changed

include/net/pie.h

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,74 @@
1414
#define DQCOUNT_INVALID -1
1515
#define PIE_SCALE 8
1616

17-
/* parameters used */
17+
/**
18+
* struct pie_params - contains pie parameters
19+
* @target: target delay in pschedtime
20+
* @tudpate: interval at which drop probability is calculated
21+
* @limit: total number of packets that can be in the queue
22+
* @alpha: parameter to control drop probability
23+
* @beta: parameter to control drop probability
24+
* @ecn: is ECN marking of packets enabled
25+
* @bytemode: is drop probability scaled based on pkt size
26+
* @dq_rate_estimator: is Little's law used for qdelay calculation
27+
*/
1828
struct pie_params {
19-
psched_time_t target; /* user specified target delay in pschedtime */
20-
u32 tupdate; /* timer frequency (in jiffies) */
21-
u32 limit; /* number of packets that can be enqueued */
22-
u32 alpha; /* alpha and beta are between 0 and 32 */
23-
u32 beta; /* and are used for shift relative to 1 */
24-
u8 ecn; /* true if ecn is enabled */
25-
u8 bytemode; /* to scale drop early prob based on pkt size */
26-
u8 dq_rate_estimator; /* to calculate delay using Little's law */
29+
psched_time_t target;
30+
u32 tupdate;
31+
u32 limit;
32+
u32 alpha;
33+
u32 beta;
34+
u8 ecn;
35+
u8 bytemode;
36+
u8 dq_rate_estimator;
2737
};
2838

29-
/* variables used */
39+
/**
40+
* struct pie_vars - contains pie variables
41+
* @qdelay: current queue delay
42+
* @qdelay_old: queue delay in previous qdelay calculation
43+
* @burst_time: burst time allowance
44+
* @dq_tstamp: timestamp at which dq rate was last calculated
45+
* @prob: drop probability
46+
* @accu_prob: accumulated drop probability
47+
* @dq_count: number of bytes dequeued in a measurement cycle
48+
* @avg_dq_rate: calculated average dq rate
49+
* @qlen_old: queue length during previous qdelay calculation
50+
* @accu_prob_overflows: number of times accu_prob overflows
51+
*/
3052
struct pie_vars {
3153
psched_time_t qdelay;
3254
psched_time_t qdelay_old;
3355
psched_time_t burst_time;
34-
psched_time_t dq_tstamp; /* drain rate */
35-
u64 prob; /* probability but scaled by u64 limit. */
36-
u64 accu_prob; /* accumulated drop probability */
37-
u64 dq_count; /* measured in bytes */
38-
u32 avg_dq_rate; /* bytes per pschedtime tick,scaled */
39-
u32 qlen_old; /* in bytes */
40-
u8 accu_prob_overflows; /* overflows of accu_prob */
56+
psched_time_t dq_tstamp;
57+
u64 prob;
58+
u64 accu_prob;
59+
u64 dq_count;
60+
u32 avg_dq_rate;
61+
u32 qlen_old;
62+
u8 accu_prob_overflows;
4163
};
4264

43-
/* statistics gathering */
65+
/**
66+
* struct pie_stats - contains pie stats
67+
* @packets_in: total number of packets enqueued
68+
* @dropped: packets dropped due to pie action
69+
* @overlimit: packets dropped due to lack of space in queue
70+
* @ecn_mark: packets marked with ECN
71+
* @maxq: maximum queue size
72+
*/
4473
struct pie_stats {
45-
u32 packets_in; /* total number of packets enqueued */
46-
u32 dropped; /* packets dropped due to pie_action */
47-
u32 overlimit; /* dropped due to lack of space in queue */
48-
u32 ecn_mark; /* packets marked with ECN */
49-
u32 maxq; /* maximum queue size */
74+
u32 packets_in;
75+
u32 dropped;
76+
u32 overlimit;
77+
u32 ecn_mark;
78+
u32 maxq;
5079
};
5180

52-
/* private skb vars */
81+
/**
82+
* struct pie_skb_cb - contains private skb vars
83+
* @enqueue_time: timestamp when the packet is enqueued
84+
*/
5385
struct pie_skb_cb {
5486
psched_time_t enqueue_time;
5587
};
@@ -58,7 +90,7 @@ static inline void pie_params_init(struct pie_params *params)
5890
{
5991
params->target = PSCHED_NS2TICKS(15 * NSEC_PER_MSEC); /* 15 ms */
6092
params->tupdate = usecs_to_jiffies(15 * USEC_PER_MSEC); /* 15 ms */
61-
params->limit = 1000; /* default of 1000 packets */
93+
params->limit = 1000;
6294
params->alpha = 2;
6395
params->beta = 20;
6496
params->ecn = false;
@@ -68,8 +100,7 @@ static inline void pie_params_init(struct pie_params *params)
68100

69101
static inline void pie_vars_init(struct pie_vars *vars)
70102
{
71-
/* default of 150 ms in pschedtime */
72-
vars->burst_time = PSCHED_NS2TICKS(150 * NSEC_PER_MSEC);
103+
vars->burst_time = PSCHED_NS2TICKS(150 * NSEC_PER_MSEC); /* 150 ms */
73104
vars->dq_tstamp = DTIME_INVALID;
74105
vars->accu_prob = 0;
75106
vars->dq_count = DQCOUNT_INVALID;

0 commit comments

Comments
 (0)