Skip to content

Commit 865ec55

Browse files
edumazetdavem330
authored andcommitted
fq_codel: should use qdisc backlog as threshold
codel_should_drop() logic allows a packet being not dropped if queue size is under max packet size. In fq_codel, we have two possible backlogs : The qdisc global one, and the flow local one. The meaningful one for codel_should_drop() should be the global backlog, not the per flow one, so that thin flows can have a non zero drop/mark probability. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Dave Taht <dave.taht@bufferbloat.net> Cc: Kathleen Nichols <nichols@pollere.com> Cc: Van Jacobson <van@pollere.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c27b46e commit 865ec55

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎include/net/codel.h‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static codel_time_t codel_control_law(codel_time_t t,
205205

206206

207207
static bool codel_should_drop(const struct sk_buff *skb,
208-
unsigned int *backlog,
208+
struct Qdisc *sch,
209209
struct codel_vars *vars,
210210
struct codel_params *params,
211211
struct codel_stats *stats,
@@ -219,13 +219,13 @@ static bool codel_should_drop(const struct sk_buff *skb,
219219
}
220220

221221
vars->ldelay = now - codel_get_enqueue_time(skb);
222-
*backlog -= qdisc_pkt_len(skb);
222+
sch->qstats.backlog -= qdisc_pkt_len(skb);
223223

224224
if (unlikely(qdisc_pkt_len(skb) > stats->maxpacket))
225225
stats->maxpacket = qdisc_pkt_len(skb);
226226

227227
if (codel_time_before(vars->ldelay, params->target) ||
228-
*backlog <= stats->maxpacket) {
228+
sch->qstats.backlog <= stats->maxpacket) {
229229
/* went below - stay below for at least interval */
230230
vars->first_above_time = 0;
231231
return false;
@@ -249,8 +249,7 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
249249
struct codel_params *params,
250250
struct codel_vars *vars,
251251
struct codel_stats *stats,
252-
codel_skb_dequeue_t dequeue_func,
253-
u32 *backlog)
252+
codel_skb_dequeue_t dequeue_func)
254253
{
255254
struct sk_buff *skb = dequeue_func(vars, sch);
256255
codel_time_t now;
@@ -261,7 +260,7 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
261260
return skb;
262261
}
263262
now = codel_get_time();
264-
drop = codel_should_drop(skb, backlog, vars, params, stats, now);
263+
drop = codel_should_drop(skb, sch, vars, params, stats, now);
265264
if (vars->dropping) {
266265
if (!drop) {
267266
/* sojourn time below target - leave dropping state */
@@ -292,7 +291,7 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
292291
qdisc_drop(skb, sch);
293292
stats->drop_count++;
294293
skb = dequeue_func(vars, sch);
295-
if (!codel_should_drop(skb, backlog,
294+
if (!codel_should_drop(skb, sch,
296295
vars, params, stats, now)) {
297296
/* leave dropping state */
298297
vars->dropping = false;
@@ -313,7 +312,7 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
313312
stats->drop_count++;
314313

315314
skb = dequeue_func(vars, sch);
316-
drop = codel_should_drop(skb, backlog, vars, params,
315+
drop = codel_should_drop(skb, sch, vars, params,
317316
stats, now);
318317
}
319318
vars->dropping = true;

‎net/sched/sch_codel.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ static struct sk_buff *codel_qdisc_dequeue(struct Qdisc *sch)
7777
struct codel_sched_data *q = qdisc_priv(sch);
7878
struct sk_buff *skb;
7979

80-
skb = codel_dequeue(sch, &q->params, &q->vars, &q->stats,
81-
dequeue, &sch->qstats.backlog);
80+
skb = codel_dequeue(sch, &q->params, &q->vars, &q->stats, dequeue);
81+
8282
/* We cant call qdisc_tree_decrease_qlen() if our qlen is 0,
8383
* or HTB crashes. Defer it for next round.
8484
*/

‎net/sched/sch_fq_codel.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,14 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch)
217217
*/
218218
static struct sk_buff *dequeue(struct codel_vars *vars, struct Qdisc *sch)
219219
{
220+
struct fq_codel_sched_data *q = qdisc_priv(sch);
220221
struct fq_codel_flow *flow;
221222
struct sk_buff *skb = NULL;
222223

223224
flow = container_of(vars, struct fq_codel_flow, cvars);
224225
if (flow->head) {
225226
skb = dequeue_head(flow);
226-
sch->qstats.backlog -= qdisc_pkt_len(skb);
227+
q->backlogs[flow - q->flows] -= qdisc_pkt_len(skb);
227228
sch->q.qlen--;
228229
}
229230
return skb;
@@ -256,7 +257,7 @@ static struct sk_buff *fq_codel_dequeue(struct Qdisc *sch)
256257
prev_ecn_mark = q->cstats.ecn_mark;
257258

258259
skb = codel_dequeue(sch, &q->cparams, &flow->cvars, &q->cstats,
259-
dequeue, &q->backlogs[flow - q->flows]);
260+
dequeue);
260261

261262
flow->dropped += q->cstats.drop_count - prev_drop_count;
262263
flow->dropped += q->cstats.ecn_mark - prev_ecn_mark;

0 commit comments

Comments
 (0)