netdev
[Top] [All Lists]

[PATCH 5/16] RED: use dump_stats

To: "David S. Miller" <davem@xxxxxxxxxxxxx>
Subject: [PATCH 5/16] RED: use dump_stats
From: Thomas Graf <tgraf@xxxxxxx>
Date: Thu, 21 Oct 2004 14:38:27 +0200
Cc: netdev@xxxxxxxxxxx, hadi@xxxxxxxxxx
In-reply-to: <20041021123209.GE21977@xxxxxxxxxxxxxx>
References: <20041021123209.GE21977@xxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
Makes RED use dump_stats qdisc op.

Signed-off-by: Thomas Graf <tgraf@xxxxxxx>

--- linux-2.6.9-rc5.orig/net/sched/sch_red.c    2004-10-21 11:07:46.000000000 
+0200
+++ linux-2.6.9-rc5/net/sched/sch_red.c 2004-10-21 12:49:10.000000000 +0200
@@ -396,16 +396,6 @@
        return red_change(sch, opt);
 }
 
-
-int red_copy_xstats(struct sk_buff *skb, struct tc_red_xstats *st)
-{
-        RTA_PUT(skb, TCA_XSTATS, sizeof(*st), st);
-        return 0;
-
-rtattr_failure:
-        return 1;
-}
-
 static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
        struct red_sched_data *q = qdisc_priv(sch);
@@ -425,9 +415,6 @@
        RTA_PUT(skb, TCA_RED_PARMS, sizeof(opt), &opt);
        rta->rta_len = skb->tail - b;
 
-       if (red_copy_xstats(skb, &q->st))
-               goto rtattr_failure;
-
        return skb->len;
 
 rtattr_failure:
@@ -435,6 +422,13 @@
        return -1;
 }
 
+static int red_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
+{
+       struct red_sched_data *q = qdisc_priv(sch);
+
+       return gnet_stats_copy_app(d, &q->st, sizeof(q->st));
+}
+
 static struct Qdisc_ops red_qdisc_ops = {
        .next           =       NULL,
        .cl_ops         =       NULL,
@@ -448,6 +442,7 @@
        .reset          =       red_reset,
        .change         =       red_change,
        .dump           =       red_dump,
+       .dump_stats     =       red_dump_stats,
        .owner          =       THIS_MODULE,
 };
 

<Prev in Thread] Current Thread [Next in Thread>