Thread (13 messages) 13 messages, 3 authors, 2007-01-31

Re: [PATCH][NET_SCHED] sch_prio: class statistics printing enabled

From: Patrick McHardy <hidden>
Date: 2007-01-31 13:48:00

Jarek Poplawski wrote:
This patch adds a dump_stats callback to enable
printing of basic statistics of prio classes.
quoted hunk ↗ jump to hunk
diff -Nurp linux-2.6.20-rc6-/net/sched/sch_prio.c linux-2.6.20-rc6/net/sched/sch_prio.c
--- linux-2.6.20-rc6-/net/sched/sch_prio.c	2007-01-08 20:23:58.000000000 +0100
+++ linux-2.6.20-rc6/net/sched/sch_prio.c	2007-01-30 20:26:31.000000000 +0100
@@ -372,6 +372,23 @@ static int prio_dump_class(struct Qdisc 
 	return 0;
 }
 
+static int prio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
+							struct gnet_dump *d)
Please align with struct Qdisc.
+{
+	struct prio_sched_data *q = qdisc_priv(sch);
+	struct Qdisc *cl_q;
+
+	if (cl - 1 > q->bands)
+		return -ENOENT;
This would indicate a bug in prio_walk or prio_get. errno-codes have no
meaning for dump_stats callbacks, either rely on the correctness of
walk/get (as other qdiscs do) or call BUG.
+
+	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;
+}
ACK for the rest.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help