Commit ba1bf474 authored by David Ward's avatar David Ward Committed by David S. Miller

net_sched: gred: actually perform idling in WRED mode

gred_dequeue() and gred_drop() do not seem to get called when the
queue is empty, meaning that we never start idling while in WRED
mode. And since qidlestart is not stored by gred_store_wred_set(),
we would never stop idling while in WRED mode if we ever started.
This messes up the average queue size calculation that influences
packet marking/dropping behavior.

Now, we start WRED mode idling as we are removing the last packet
from the queue. Also we now actually stop WRED mode idling when we
are enqueuing a packet.

Cc: Bruce Osler <brosler@cisco.com>
Signed-off-by: default avatarDavid Ward <david.ward@ll.mit.edu>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1fe37b10
...@@ -136,6 +136,7 @@ static inline void gred_store_wred_set(struct gred_sched *table, ...@@ -136,6 +136,7 @@ static inline void gred_store_wred_set(struct gred_sched *table,
struct gred_sched_data *q) struct gred_sched_data *q)
{ {
table->wred_set.qavg = q->vars.qavg; table->wred_set.qavg = q->vars.qavg;
table->wred_set.qidlestart = q->vars.qidlestart;
} }
static inline int gred_use_ecn(struct gred_sched *t) static inline int gred_use_ecn(struct gred_sched *t)
...@@ -259,16 +260,18 @@ static struct sk_buff *gred_dequeue(struct Qdisc *sch) ...@@ -259,16 +260,18 @@ static struct sk_buff *gred_dequeue(struct Qdisc *sch)
} else { } else {
q->backlog -= qdisc_pkt_len(skb); q->backlog -= qdisc_pkt_len(skb);
if (!q->backlog && !gred_wred_mode(t)) if (gred_wred_mode(t)) {
red_start_of_idle_period(&q->vars); if (!sch->qstats.backlog)
red_start_of_idle_period(&t->wred_set);
} else {
if (!q->backlog)
red_start_of_idle_period(&q->vars);
}
} }
return skb; return skb;
} }
if (gred_wred_mode(t) && !red_is_idling(&t->wred_set))
red_start_of_idle_period(&t->wred_set);
return NULL; return NULL;
} }
...@@ -290,19 +293,20 @@ static unsigned int gred_drop(struct Qdisc *sch) ...@@ -290,19 +293,20 @@ static unsigned int gred_drop(struct Qdisc *sch)
q->backlog -= len; q->backlog -= len;
q->stats.other++; q->stats.other++;
if (!q->backlog && !gred_wred_mode(t)) if (gred_wred_mode(t)) {
red_start_of_idle_period(&q->vars); if (!sch->qstats.backlog)
red_start_of_idle_period(&t->wred_set);
} else {
if (!q->backlog)
red_start_of_idle_period(&q->vars);
}
} }
qdisc_drop(skb, sch); qdisc_drop(skb, sch);
return len; return len;
} }
if (gred_wred_mode(t) && !red_is_idling(&t->wred_set))
red_start_of_idle_period(&t->wred_set);
return 0; return 0;
} }
static void gred_reset(struct Qdisc *sch) static void gred_reset(struct Qdisc *sch)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment