aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/codel.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/codel.h')
-rw-r--r--include/net/codel.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/net/codel.h b/include/net/codel.h
index aeee28081245..1e18005f7f65 100644
--- a/include/net/codel.h
+++ b/include/net/codel.h
@@ -120,11 +120,13 @@ static inline u32 codel_time_to_us(codel_time_t val)
120 * struct codel_params - contains codel parameters 120 * struct codel_params - contains codel parameters
121 * @target: target queue size (in time units) 121 * @target: target queue size (in time units)
122 * @interval: width of moving time window 122 * @interval: width of moving time window
123 * @mtu: device mtu, or minimal queue backlog in bytes.
123 * @ecn: is Explicit Congestion Notification enabled 124 * @ecn: is Explicit Congestion Notification enabled
124 */ 125 */
125struct codel_params { 126struct codel_params {
126 codel_time_t target; 127 codel_time_t target;
127 codel_time_t interval; 128 codel_time_t interval;
129 u32 mtu;
128 bool ecn; 130 bool ecn;
129}; 131};
130 132
@@ -166,10 +168,12 @@ struct codel_stats {
166 u32 ecn_mark; 168 u32 ecn_mark;
167}; 169};
168 170
169static void codel_params_init(struct codel_params *params) 171static void codel_params_init(struct codel_params *params,
172 const struct Qdisc *sch)
170{ 173{
171 params->interval = MS2TIME(100); 174 params->interval = MS2TIME(100);
172 params->target = MS2TIME(5); 175 params->target = MS2TIME(5);
176 params->mtu = psched_mtu(qdisc_dev(sch));
173 params->ecn = false; 177 params->ecn = false;
174} 178}
175 179
@@ -180,7 +184,7 @@ static void codel_vars_init(struct codel_vars *vars)
180 184
181static void codel_stats_init(struct codel_stats *stats) 185static void codel_stats_init(struct codel_stats *stats)
182{ 186{
183 stats->maxpacket = 256; 187 stats->maxpacket = 0;
184} 188}
185 189
186/* 190/*
@@ -234,7 +238,7 @@ static bool codel_should_drop(const struct sk_buff *skb,
234 stats->maxpacket = qdisc_pkt_len(skb); 238 stats->maxpacket = qdisc_pkt_len(skb);
235 239
236 if (codel_time_before(vars->ldelay, params->target) || 240 if (codel_time_before(vars->ldelay, params->target) ||
237 sch->qstats.backlog <= stats->maxpacket) { 241 sch->qstats.backlog <= params->mtu) {
238 /* went below - stay below for at least interval */ 242 /* went below - stay below for at least interval */
239 vars->first_above_time = 0; 243 vars->first_above_time = 0;
240 return false; 244 return false;