aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-04-30 12:40:40 -0400
committerDavid S. Miller <davem@davemloft.net>2015-05-03 22:17:40 -0400
commita5d28090405038ca1f40c13f38d6d4285456efee (patch)
tree0ed77966629db018afd676eaec2e9dee99c79705
parent6c3c1eb3c35e8856d6dcb01b412316a676f58bbe (diff)
codel: fix maxpacket/mtu confusion
Under presence of TSO/GSO/GRO packets, codel at low rates can be quite useless. In following example, not a single packet was ever dropped, while average delay in codel queue is ~100 ms ! qdisc codel 0: parent 1:12 limit 16000p target 5.0ms interval 100.0ms Sent 134376498 bytes 88797 pkt (dropped 0, overlimits 0 requeues 0) backlog 13626b 3p requeues 0 count 0 lastcount 0 ldelay 96.9ms drop_next 0us maxpacket 9084 ecn_mark 0 drop_overlimit 0 This comes from a confusion of what should be the minimal backlog. It is pretty clear it is not 64KB or whatever max GSO packet ever reached the qdisc. codel intent was to use MTU of the device. After the fix, we finally drop some packets, and rtt/cwnd of my single TCP flow are meeting our expectations. qdisc codel 0: parent 1:12 limit 16000p target 5.0ms interval 100.0ms Sent 102798497 bytes 67912 pkt (dropped 1365, overlimits 0 requeues 0) backlog 6056b 3p requeues 0 count 1 lastcount 1 ldelay 36.3ms drop_next 0us maxpacket 10598 ecn_mark 0 drop_overlimit 0 Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Kathleen Nichols <nichols@pollere.com> Cc: Dave Taht <dave.taht@gmail.com> Cc: Van Jacobson <vanj@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/codel.h10
-rw-r--r--net/sched/sch_codel.c2
-rw-r--r--net/sched/sch_fq_codel.c2
3 files changed, 9 insertions, 5 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;
diff --git a/net/sched/sch_codel.c b/net/sched/sch_codel.c
index de28f8e968e8..7a0bdb16ac92 100644
--- a/net/sched/sch_codel.c
+++ b/net/sched/sch_codel.c
@@ -164,7 +164,7 @@ static int codel_init(struct Qdisc *sch, struct nlattr *opt)
164 164
165 sch->limit = DEFAULT_CODEL_LIMIT; 165 sch->limit = DEFAULT_CODEL_LIMIT;
166 166
167 codel_params_init(&q->params); 167 codel_params_init(&q->params, sch);
168 codel_vars_init(&q->vars); 168 codel_vars_init(&q->vars);
169 codel_stats_init(&q->stats); 169 codel_stats_init(&q->stats);
170 170
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 1e52decb7b59..c244c45b78d7 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -391,7 +391,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
391 q->perturbation = prandom_u32(); 391 q->perturbation = prandom_u32();
392 INIT_LIST_HEAD(&q->new_flows); 392 INIT_LIST_HEAD(&q->new_flows);
393 INIT_LIST_HEAD(&q->old_flows); 393 INIT_LIST_HEAD(&q->old_flows);
394 codel_params_init(&q->cparams); 394 codel_params_init(&q->cparams, sch);
395 codel_stats_init(&q->cstats); 395 codel_stats_init(&q->cstats);
396 q->cparams.ecn = true; 396 q->cparams.ecn = true;
397 397