net: sched: introduce and use qstats read helpers
Classful qdiscs can't access directly the child qdiscs backlog
length: if such qdisc is NOLOCK, per CPU values should be
accounted instead.
Most qdiscs no not respect the above. As a result, qstats fetching
for most classful qdisc is currently incorrect: if the child qdisc is
NOLOCK, it always reports 0 len backlog.
This change introduces a pair of helpers to safely fetch
both backlog and qlen and use them in stats class dumping
functions, fixing the above issue and cleaning a bit the code.
DRR needs also to access the child qdisc queue length, so it
needs custom handling.
Fixes: c5ad119fb6
("net: sched: pfifo_fast use skb_array")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
0db6f8befc
commit
5dd431b6b9
@@ -1127,10 +1127,9 @@ htb_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d)
|
||||
};
|
||||
__u32 qlen = 0;
|
||||
|
||||
if (!cl->level && cl->leaf.q) {
|
||||
qlen = cl->leaf.q->q.qlen;
|
||||
qs.backlog = cl->leaf.q->qstats.backlog;
|
||||
}
|
||||
if (!cl->level && cl->leaf.q)
|
||||
qdisc_qstats_qlen_backlog(cl->leaf.q, &qlen, &qs.backlog);
|
||||
|
||||
cl->xstats.tokens = clamp_t(s64, PSCHED_NS2TICKS(cl->tokens),
|
||||
INT_MIN, INT_MAX);
|
||||
cl->xstats.ctokens = clamp_t(s64, PSCHED_NS2TICKS(cl->ctokens),
|
||||
|
Reference in New Issue
Block a user