# Re: \[PATCH net 1/4\] mqprio: Correct stats in mqprio\_dump\_class\_stats().

- From: Jakub Kicinski \<kuba@kernel.org\>
- Date: 2021-10-08 23:33:44 
- List: netdev
- Page: https://ratatoskr.run/netdev/2021/10/11213014
- Thread: https://ratatoskr.run/netdev/2021/10/11212910/t.md

```text
On Thu,  7 Oct 2021 19:49:57 +0200 Sebastian Andrzej Siewior wrote:
> It looks like with the introduction of subqueus the statics broke.
> Before the change `bstats' and `qstats' on stack was fed and later this
> was copied over to struct gnet_dump.
> 
> After the change the `bstats' and `qstats' are only set to 0 and no
> longer updated and that is then fed to gnet_dump. Additionally
> qdisc->cpu_bstats and qdisc->cpu_qstats is destroeyd for global
> stats. For per-CPU stats both __gnet_stats_copy_basic() and
> __gnet_stats_copy_queue() add the values but for global stats the value
> set and so the previous value is lost and only the last value from the
> loop ends up in sch->[bq]stats.
> 
> Use the on-stack [bq]stats variables again and add the stats manually in
> the global case.
> 
> Fixes: ce679e8df7ed2 ("net: sched: add support for TCQ_F_NOLOCK subqueues to sch_mqprio")
> Cc: John Fastabend <john.fastabend@gmail.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Applied after significant massaging of the commit message.

Please repost the cleanup in a week (once net gets merged 
into net-next).

Thanks!
```
