Skip to content

Commit 3c75f6e

Browse files
Eric Dumazetdavem330
authored andcommitted
net_sched: sch_htb: add per class overlimits counter
HTB qdisc overlimits counter is properly increased, but we have no per class counter, meaning it is difficult to diagnose HTB problems. This patch adds this counter, visible in "tc -s class show dev eth0", with current iproute2. Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Denys Fedoryshchenko <nuclearcat@nuclearcat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7e5dd53 commit 3c75f6e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/sched/sch_htb.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ struct htb_class {
142142
struct rb_node node[TC_HTB_NUMPRIO]; /* node for self or feed tree */
143143

144144
unsigned int drops ____cacheline_aligned_in_smp;
145+
unsigned int overlimits;
145146
};
146147

147148
struct htb_level {
@@ -533,6 +534,9 @@ htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, s64 *diff)
533534
if (new_mode == cl->cmode)
534535
return;
535536

537+
if (new_mode == HTB_CANT_SEND)
538+
cl->overlimits++;
539+
536540
if (cl->prio_activity) { /* not necessary: speed optimization */
537541
if (cl->cmode != HTB_CANT_SEND)
538542
htb_deactivate_prios(q, cl);
@@ -1143,6 +1147,7 @@ htb_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d)
11431147
struct htb_class *cl = (struct htb_class *)arg;
11441148
struct gnet_stats_queue qs = {
11451149
.drops = cl->drops,
1150+
.overlimits = cl->overlimits,
11461151
};
11471152
__u32 qlen = 0;
11481153

0 commit comments

Comments
 (0)