Skip to content

Commit 14e54ab

Browse files
Dust Lidavem330
authored andcommitted
net: sched: fix tc -s class show no bstats on class with nolock subqueues
When a classful qdisc's child qdisc has set the flag TCQ_F_CPUSTATS (pfifo_fast for example), the child qdisc's cpu_bstats should be passed to gnet_stats_copy_basic(), but many classful qdisc didn't do that. As a result, `tc -s class show dev DEV` always return 0 for bytes and packets in this case. Pass the child qdisc's cpu_bstats to gnet_stats_copy_basic() to fix this issue. The qstats also has this problem, but it has been fixed in 5dd431b ("net: sched: introduce and use qstats read...") and bstats still remains buggy. Fixes: 22e0f8b ("net: sched: make bstats per cpu and estimator RCU safe") Signed-off-by: Dust Li <[email protected]> Signed-off-by: Tony Lu <[email protected]> Acked-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 395eba7 commit 14e54ab

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

net/sched/sch_mq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ static int mq_dump_class_stats(struct Qdisc *sch, unsigned long cl,
245245
struct netdev_queue *dev_queue = mq_queue_get(sch, cl);
246246

247247
sch = dev_queue->qdisc_sleeping;
248-
if (gnet_stats_copy_basic(&sch->running, d, NULL, &sch->bstats) < 0 ||
248+
if (gnet_stats_copy_basic(&sch->running, d, sch->cpu_bstats,
249+
&sch->bstats) < 0 ||
249250
qdisc_qstats_copy(d, sch) < 0)
250251
return -1;
251252
return 0;

net/sched/sch_mqprio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
557557
struct netdev_queue *dev_queue = mqprio_queue_get(sch, cl);
558558

559559
sch = dev_queue->qdisc_sleeping;
560-
if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch),
561-
d, NULL, &sch->bstats) < 0 ||
560+
if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), d,
561+
sch->cpu_bstats, &sch->bstats) < 0 ||
562562
qdisc_qstats_copy(d, sch) < 0)
563563
return -1;
564564
}

net/sched/sch_multiq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static int multiq_dump_class_stats(struct Qdisc *sch, unsigned long cl,
339339

340340
cl_q = q->queues[cl - 1];
341341
if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch),
342-
d, NULL, &cl_q->bstats) < 0 ||
342+
d, cl_q->cpu_bstats, &cl_q->bstats) < 0 ||
343343
qdisc_qstats_copy(d, cl_q) < 0)
344344
return -1;
345345

net/sched/sch_prio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ static int prio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
356356

357357
cl_q = q->queues[cl - 1];
358358
if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch),
359-
d, NULL, &cl_q->bstats) < 0 ||
359+
d, cl_q->cpu_bstats, &cl_q->bstats) < 0 ||
360360
qdisc_qstats_copy(d, cl_q) < 0)
361361
return -1;
362362

0 commit comments

Comments
 (0)