Skip to content

Commit 357cc9b

Browse files
congwangdavem330
authored andcommitted
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: Stas Nichiporovich <[email protected]> Tested-by: Stas Nichiporovich <[email protected]> Fixes: 2ccccf5 ("net_sched: update hierarchical backlog too") Cc: Jamal Hadi Salim <[email protected]> Signed-off-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4116def commit 357cc9b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

net/sched/sch_hfsc.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,7 @@ hfsc_reset_qdisc(struct Qdisc *sch)
15291529
q->eligible = RB_ROOT;
15301530
INIT_LIST_HEAD(&q->droplist);
15311531
qdisc_watchdog_cancel(&q->watchdog);
1532+
sch->qstats.backlog = 0;
15321533
sch->q.qlen = 0;
15331534
}
15341535

@@ -1559,14 +1560,6 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
15591560
struct hfsc_sched *q = qdisc_priv(sch);
15601561
unsigned char *b = skb_tail_pointer(skb);
15611562
struct tc_hfsc_qopt qopt;
1562-
struct hfsc_class *cl;
1563-
unsigned int i;
1564-
1565-
sch->qstats.backlog = 0;
1566-
for (i = 0; i < q->clhash.hashsize; i++) {
1567-
hlist_for_each_entry(cl, &q->clhash.hash[i], cl_common.hnode)
1568-
sch->qstats.backlog += cl->qdisc->qstats.backlog;
1569-
}
15701563

15711564
qopt.defcls = q->defcls;
15721565
if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt))
@@ -1604,6 +1597,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
16041597
if (cl->qdisc->q.qlen == 1)
16051598
set_active(cl, qdisc_pkt_len(skb));
16061599

1600+
qdisc_qstats_backlog_inc(sch, skb);
16071601
sch->q.qlen++;
16081602

16091603
return NET_XMIT_SUCCESS;
@@ -1672,6 +1666,7 @@ hfsc_dequeue(struct Qdisc *sch)
16721666

16731667
qdisc_unthrottled(sch);
16741668
qdisc_bstats_update(sch, skb);
1669+
qdisc_qstats_backlog_dec(sch, skb);
16751670
sch->q.qlen--;
16761671

16771672
return skb;
@@ -1695,6 +1690,7 @@ hfsc_drop(struct Qdisc *sch)
16951690
}
16961691
cl->qstats.drops++;
16971692
qdisc_qstats_drop(sch);
1693+
sch->qstats.backlog -= len;
16981694
sch->q.qlen--;
16991695
return len;
17001696
}

0 commit comments

Comments
 (0)