This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / net / sched / police.c
index 96da96b..12bd440 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
-#include <linux/bitops.h>
+#include <asm/bitops.h>
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
@@ -31,7 +31,7 @@
 #include <linux/rtnetlink.h>
 #include <linux/init.h>
 #include <net/sock.h>
-#include <net/act_api.h>
+#include <net/pkt_sched.h>
 
 #define L2T(p,L)   ((p)->R_tab->data[(L)>>(p)->R_tab->rate.cell_log])
 #define L2T_P(p,L) ((p)->P_tab->data[(L)>>(p)->P_tab->rate.cell_log])
@@ -149,7 +149,7 @@ void tcf_police_destroy(struct tcf_police *p)
                        *p1p = p->next;
                        write_unlock_bh(&police_lock);
 #ifdef CONFIG_NET_ESTIMATOR
-                       gen_kill_estimator(&p->bstats, &p->rate_est);
+                       qdisc_kill_estimator(&p->stats);
 #endif
                        if (p->R_tab)
                                qdisc_put_rtab(p->R_tab);
@@ -245,7 +245,7 @@ override:
        p->index = parm->index ? : tcf_police_new_index();
 #ifdef CONFIG_NET_ESTIMATOR
        if (est)
-               gen_new_estimator(&p->bstats, &p->rate_est, p->stats_lock, est);
+               qdisc_new_estimator(&p->stats, p->stats_lock, est);
 #endif
        h = tcf_police_hash(p->index);
        write_lock_bh(&police_lock);
@@ -275,6 +275,16 @@ int tcf_act_police_cleanup(struct tc_action *a, int bind)
        return 0;
 }
 
+int tcf_act_police_stats(struct sk_buff *skb, struct tc_action *a)
+{
+       struct tcf_police *p;
+       p = PRIV(a);
+       if (NULL != p) 
+               return qdisc_copy_stats(skb, &p->stats, p->stats_lock);
+
+       return 1;
+}
+
 int tcf_act_police(struct sk_buff **pskb, struct tc_action *a)
 {
        psched_time_t now;
@@ -292,12 +302,12 @@ int tcf_act_police(struct sk_buff **pskb, struct tc_action *a)
 
        spin_lock(&p->lock);
 
-       p->bstats.bytes += skb->len;
-       p->bstats.packets++;
+       p->stats.bytes += skb->len;
+       p->stats.packets++;
 
 #ifdef CONFIG_NET_ESTIMATOR
-       if (p->ewma_rate && p->rate_est.bps >= p->ewma_rate) {
-               p->qstats.overlimits++;
+       if (p->ewma_rate && p->stats.bps >= p->ewma_rate) {
+               p->stats.overlimits++;
                spin_unlock(&p->lock);
                return p->action;
        }
@@ -333,7 +343,7 @@ int tcf_act_police(struct sk_buff **pskb, struct tc_action *a)
                }
        }
 
-       p->qstats.overlimits++;
+       p->stats.overlimits++;
        spin_unlock(&p->lock);
        return p->action;
 }
@@ -390,6 +400,7 @@ static struct tc_action_ops act_police_ops = {
        .capab          =       TCA_CAP_NONE, 
        .owner          =       THIS_MODULE,
        .act            =       tcf_act_police,
+       .get_stats      =       tcf_act_police_stats,
        .dump           =       tcf_act_police_dump,
        .cleanup        =       tcf_act_police_cleanup,
        .lookup         =       tcf_hash_search,
@@ -469,7 +480,7 @@ struct tcf_police * tcf_police_locate(struct rtattr *rta, struct rtattr *est)
        p->action = parm->action;
 #ifdef CONFIG_NET_ESTIMATOR
        if (est)
-               gen_new_estimator(&p->bstats, &p->rate_est, p->stats_lock, est);
+               qdisc_new_estimator(&p->stats, p->stats_lock, est);
 #endif
        h = tcf_police_hash(p->index);
        write_lock_bh(&police_lock);
@@ -493,12 +504,12 @@ int tcf_police(struct sk_buff *skb, struct tcf_police *p)
 
        spin_lock(&p->lock);
 
-       p->bstats.bytes += skb->len;
-       p->bstats.packets++;
+       p->stats.bytes += skb->len;
+       p->stats.packets++;
 
 #ifdef CONFIG_NET_ESTIMATOR
-       if (p->ewma_rate && p->rate_est.bps >= p->ewma_rate) {
-               p->qstats.overlimits++;
+       if (p->ewma_rate && p->stats.bps >= p->ewma_rate) {
+               p->stats.overlimits++;
                spin_unlock(&p->lock);
                return p->action;
        }
@@ -534,7 +545,7 @@ int tcf_police(struct sk_buff *skb, struct tcf_police *p)
                }
        }
 
-       p->qstats.overlimits++;
+       p->stats.overlimits++;
        spin_unlock(&p->lock);
        return p->action;
 }
@@ -570,35 +581,9 @@ rtattr_failure:
        return -1;
 }
 
-int tcf_police_dump_stats(struct sk_buff *skb, struct tcf_police *p)
-{
-       struct gnet_dump d;
-       
-       if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS,
-                       TCA_XSTATS, p->stats_lock, &d) < 0)
-               goto errout;
-       
-       if (gnet_stats_copy_basic(&d, &p->bstats) < 0 ||
-#ifdef CONFIG_NET_ESTIMATOR
-           gnet_stats_copy_rate_est(&d, &p->rate_est) < 0 ||
-#endif
-           gnet_stats_copy_queue(&d, &p->qstats) < 0)
-               goto errout;
-
-       if (gnet_stats_finish_copy(&d) < 0)
-               goto errout;
-
-       return 0;
-
-errout:
-       return -1;
-}
-
-
 EXPORT_SYMBOL(tcf_police);
 EXPORT_SYMBOL(tcf_police_destroy);
 EXPORT_SYMBOL(tcf_police_dump);
-EXPORT_SYMBOL(tcf_police_dump_stats);
 EXPORT_SYMBOL(tcf_police_hash);
 EXPORT_SYMBOL(tcf_police_ht);
 EXPORT_SYMBOL(tcf_police_locate);