[NET_SCHED] sch_prio: class statistics printing enabled
authorJarek Poplawski <jarkao2@o2.pl>
Wed, 31 Jan 2007 20:21:24 +0000 (12:21 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 8 Feb 2007 20:38:40 +0000 (12:38 -0800)
This patch adds a dump_stats callback to enable
printing of basic statistics of prio classes.
(With help of Patrick McHardy).

Signed-off-by: Jarek Poplawski <jarkao2@o2.pl>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_prio.c

index 2567b4c96c1e9055c6e3ab4e4ff89a70d36aa741..000e043ebd62df8c7dc00f2c516a7d190f1f7973 100644 (file)
@@ -372,6 +372,20 @@ static int prio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *
        return 0;
 }
 
+static int prio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
+                                struct gnet_dump *d)
+{
+       struct prio_sched_data *q = qdisc_priv(sch);
+       struct Qdisc *cl_q;
+
+       cl_q = q->queues[cl - 1];
+       if (gnet_stats_copy_basic(d, &cl_q->bstats) < 0 ||
+           gnet_stats_copy_queue(d, &cl_q->qstats) < 0)
+               return -1;
+
+       return 0;
+}
+
 static void prio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
 {
        struct prio_sched_data *q = qdisc_priv(sch);
@@ -414,6 +428,7 @@ static struct Qdisc_class_ops prio_class_ops = {
        .bind_tcf       =       prio_bind,
        .unbind_tcf     =       prio_put,
        .dump           =       prio_dump_class,
+       .dump_stats     =       prio_dump_class_stats,
 };
 
 static struct Qdisc_ops prio_qdisc_ops = {