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>
This commit is contained in:
committed by
David S. Miller
parent
4996b9098d
commit
2c8c8e6f9d
@@ -737,9 +737,11 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
|
|||||||
const struct Qdisc_class_ops *cops;
|
const struct Qdisc_class_ops *cops;
|
||||||
unsigned long cl;
|
unsigned long cl;
|
||||||
u32 parentid;
|
u32 parentid;
|
||||||
|
int drops;
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
drops = max_t(int, n, 0);
|
||||||
while ((parentid = sch->parent)) {
|
while ((parentid = sch->parent)) {
|
||||||
if (TC_H_MAJ(parentid) == TC_H_MAJ(TC_H_INGRESS))
|
if (TC_H_MAJ(parentid) == TC_H_MAJ(TC_H_INGRESS))
|
||||||
return;
|
return;
|
||||||
@@ -756,6 +758,7 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
|
|||||||
cops->put(sch, cl);
|
cops->put(sch, cl);
|
||||||
}
|
}
|
||||||
sch->q.qlen -= n;
|
sch->q.qlen -= n;
|
||||||
|
sch->qstats.drops += drops;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(qdisc_tree_decrease_qlen);
|
EXPORT_SYMBOL(qdisc_tree_decrease_qlen);
|
||||||
|
Reference in New Issue
Block a user