diff options
author | Eric Dumazet <edumazet@google.com> | 2013-10-07 11:32:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-08 16:27:33 -0400 |
commit | 2c8c8e6f9d534a77f97df4d7148561cb902c0f83 (patch) | |
tree | 4b48a1db1f650dde62573063ae2ab83f1855e3d5 | |
parent | 4996b9098d5522f9d3233af6a7efd1fac5d43f00 (diff) |
net_sched: increment drop counters in qdisc_tree_decrease_qlen()
qdisc_tree_decrease_qlen() is called when some packets are dropped
on a qdisc, and we want to notify parents of qlen changes.
We also can increment parents qdisc qstats drop counters.
This permits more accurate drop counters up to root qdisc.
For example a graft operation typically resets a qdisc
(drops all packets) and call qdisc_tree_decrease_qlen()
Note that callers are responsible for their drop counters.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/sched/sch_api.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 2adda7fa2d39..cd81505662b8 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -737,9 +737,11 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n) | |||
737 | const struct Qdisc_class_ops *cops; | 737 | const struct Qdisc_class_ops *cops; |
738 | unsigned long cl; | 738 | unsigned long cl; |
739 | u32 parentid; | 739 | u32 parentid; |
740 | int drops; | ||
740 | 741 | ||
741 | if (n == 0) | 742 | if (n == 0) |
742 | return; | 743 | return; |
744 | drops = max_t(int, n, 0); | ||
743 | while ((parentid = sch->parent)) { | 745 | while ((parentid = sch->parent)) { |
744 | if (TC_H_MAJ(parentid) == TC_H_MAJ(TC_H_INGRESS)) | 746 | if (TC_H_MAJ(parentid) == TC_H_MAJ(TC_H_INGRESS)) |
745 | return; | 747 | return; |
@@ -756,6 +758,7 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n) | |||
756 | cops->put(sch, cl); | 758 | cops->put(sch, cl); |
757 | } | 759 | } |
758 | sch->q.qlen -= n; | 760 | sch->q.qlen -= n; |
761 | sch->qstats.drops += drops; | ||
759 | } | 762 | } |
760 | } | 763 | } |
761 | EXPORT_SYMBOL(qdisc_tree_decrease_qlen); | 764 | EXPORT_SYMBOL(qdisc_tree_decrease_qlen); |