Skip to content

Commit

Permalink
net_sched: sch_htb: add per class overlimits counter
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Sep 19, 2017
1 parent 7e5dd53 commit 3c75f6e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ struct htb_class {
struct rb_node node[TC_HTB_NUMPRIO]; /* node for self or feed tree */

unsigned int drops ____cacheline_aligned_in_smp;
unsigned int overlimits;
};

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

if (new_mode == HTB_CANT_SEND)
cl->overlimits++;

if (cl->prio_activity) { /* not necessary: speed optimization */
if (cl->cmode != HTB_CANT_SEND)
htb_deactivate_prios(q, cl);
Expand Down Expand Up @@ -1143,6 +1147,7 @@ htb_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d)
struct htb_class *cl = (struct htb_class *)arg;
struct gnet_stats_queue qs = {
.drops = cl->drops,
.overlimits = cl->overlimits,
};
__u32 qlen = 0;

Expand Down

0 comments on commit 3c75f6e

Please sign in to comment.