提交 357cc9b4 编写于 作者: W WANG Cong 提交者: David S. Miller

sch_hfsc: always keep backlog updated

hfsc updates backlog lazily, that is only when we
dump the stats. This is problematic after we begin to
update backlog in qdisc_tree_reduce_backlog().
Reported-by: NStas Nichiporovich <stasn77@gmail.com>
Tested-by: NStas Nichiporovich <stasn77@gmail.com>
Fixes: 2ccccf5f ("net_sched: update hierarchical backlog too")
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4116def2
...@@ -1529,6 +1529,7 @@ hfsc_reset_qdisc(struct Qdisc *sch) ...@@ -1529,6 +1529,7 @@ hfsc_reset_qdisc(struct Qdisc *sch)
q->eligible = RB_ROOT; q->eligible = RB_ROOT;
INIT_LIST_HEAD(&q->droplist); INIT_LIST_HEAD(&q->droplist);
qdisc_watchdog_cancel(&q->watchdog); qdisc_watchdog_cancel(&q->watchdog);
sch->qstats.backlog = 0;
sch->q.qlen = 0; sch->q.qlen = 0;
} }
...@@ -1559,14 +1560,6 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) ...@@ -1559,14 +1560,6 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
struct hfsc_sched *q = qdisc_priv(sch); struct hfsc_sched *q = qdisc_priv(sch);
unsigned char *b = skb_tail_pointer(skb); unsigned char *b = skb_tail_pointer(skb);
struct tc_hfsc_qopt qopt; struct tc_hfsc_qopt qopt;
struct hfsc_class *cl;
unsigned int i;
sch->qstats.backlog = 0;
for (i = 0; i < q->clhash.hashsize; i++) {
hlist_for_each_entry(cl, &q->clhash.hash[i], cl_common.hnode)
sch->qstats.backlog += cl->qdisc->qstats.backlog;
}
qopt.defcls = q->defcls; qopt.defcls = q->defcls;
if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt)) if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt))
...@@ -1604,6 +1597,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -1604,6 +1597,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
if (cl->qdisc->q.qlen == 1) if (cl->qdisc->q.qlen == 1)
set_active(cl, qdisc_pkt_len(skb)); set_active(cl, qdisc_pkt_len(skb));
qdisc_qstats_backlog_inc(sch, skb);
sch->q.qlen++; sch->q.qlen++;
return NET_XMIT_SUCCESS; return NET_XMIT_SUCCESS;
...@@ -1672,6 +1666,7 @@ hfsc_dequeue(struct Qdisc *sch) ...@@ -1672,6 +1666,7 @@ hfsc_dequeue(struct Qdisc *sch)
qdisc_unthrottled(sch); qdisc_unthrottled(sch);
qdisc_bstats_update(sch, skb); qdisc_bstats_update(sch, skb);
qdisc_qstats_backlog_dec(sch, skb);
sch->q.qlen--; sch->q.qlen--;
return skb; return skb;
...@@ -1695,6 +1690,7 @@ hfsc_drop(struct Qdisc *sch) ...@@ -1695,6 +1690,7 @@ hfsc_drop(struct Qdisc *sch)
} }
cl->qstats.drops++; cl->qstats.drops++;
qdisc_qstats_drop(sch); qdisc_qstats_drop(sch);
sch->qstats.backlog -= len;
sch->q.qlen--; sch->q.qlen--;
return len; return len;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册