From: WANG Cong Date: Tue, 21 Jul 2015 23:52:43 +0000 (-0700) Subject: sch_choke: drop all packets in queue during reset X-Git-Tag: v4.2-rc5~9^2~38 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=77e62da6e60c7772971f813f588d372a7f1a4167;hp=fe6bea7f1f3a09fc06d835446d34d3b3b6a543fb;p=karo-tx-linux.git sch_choke: drop all packets in queue during reset Signed-off-by: Cong Wang Signed-off-by: David S. Miller --- diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index 93d5742dc7e0..6a783afe4960 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c @@ -385,6 +385,19 @@ static void choke_reset(struct Qdisc *sch) { struct choke_sched_data *q = qdisc_priv(sch); + while (q->head != q->tail) { + struct sk_buff *skb = q->tab[q->head]; + + q->head = (q->head + 1) & q->tab_mask; + if (!skb) + continue; + qdisc_qstats_backlog_dec(sch, skb); + --sch->q.qlen; + qdisc_drop(skb, sch); + } + + memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *)); + q->head = q->tail = 0; red_restart(&q->vars); }