• Sebastian Andrzej Siewior's avatar
    mqprio: Correct stats in mqprio_dump_class_stats(). · 14132690
    Sebastian Andrzej Siewior authored
    Introduction of lockless subqueues broke the class statistics.
    Before the change stats were accumulated in `bstats' and `qstats'
    on the stack which was then copied to struct gnet_dump.
    
    After the change the `bstats' and `qstats' are initialized to 0
    and never updated, yet still fed to gnet_dump. The code updates
    the global qdisc->cpu_bstats and qdisc->cpu_qstats instead,
    clobbering them. Most likely a copy-paste error from the code in
    mqprio_dump().
    
    __gnet_stats_copy_basic() and __gnet_stats_copy_queue() accumulate
    the values for per-CPU case but for global stats they overwrite
    the value, so only stats from the last loop iteration / tc end up
    in sch->[bq]stats.
    
    Use the on-stack [bq]stats variables again and add the stats manually
    in the global case.
    
    Fixes: ce679e8d ("net: sched: add support for TCQ_F_NOLOCK subqueues to sch_mqprio")
    Cc: John Fastabend <john.fastabend@gmail.com>
    Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
    https://lore.kernel.org/all/20211007175000.2334713-2-bigeasy@linutronix.de/Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    14132690
sch_mqprio.c 16.7 KB