Message ID | 1438390419-30414-1-git-send-email-xiyou.wangcong@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Cong Wang <xiyou.wangcong@gmail.com> Date: Fri, 31 Jul 2015 17:53:39 -0700 > From: Eric Dumazet <eric.dumazet@gmail.com> > > Alex reported the following crash when using fq_codel > with htb: ... > As Jamal pointed out, there is actually no need to call dequeue > to purge the queued skb's in reset, data structures can be just > reset explicitly. Therefore, we reset everything except config's > and stats, so that we would have a fresh start after device flipping. > > Fixes: 4b549a2ef4be ("fq_codel: Fair Queue Codel AQM") > Reported-by: Alex Gartrell <agartrell@fb.com> > Cc: Alex Gartrell <agartrell@fb.com> > Cc: Jamal Hadi Salim <jhs@mojatatu.com> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> > [xiyou.wangcong@gmail.com: added codel_vars_init() and qdisc_qstats_backlog_dec()] > Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index 21ca33c..a9ba030 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c @@ -288,10 +288,26 @@ static struct sk_buff *fq_codel_dequeue(struct Qdisc *sch) static void fq_codel_reset(struct Qdisc *sch) { - struct sk_buff *skb; + struct fq_codel_sched_data *q = qdisc_priv(sch); + int i; - while ((skb = fq_codel_dequeue(sch)) != NULL) - kfree_skb(skb); + INIT_LIST_HEAD(&q->new_flows); + INIT_LIST_HEAD(&q->old_flows); + for (i = 0; i < q->flows_cnt; i++) { + struct fq_codel_flow *flow = q->flows + i; + + while (flow->head) { + struct sk_buff *skb = dequeue_head(flow); + + qdisc_qstats_backlog_dec(sch, skb); + kfree_skb(skb); + } + + INIT_LIST_HEAD(&flow->flowchain); + codel_vars_init(&flow->cvars); + } + memset(q->backlogs, 0, q->flows_cnt * sizeof(u32)); + sch->q.qlen = 0; } static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {