]> err.no Git - linux-2.6/blobdiff - net/sched/sch_tbf.c
Pull cpuidle into release branch
[linux-2.6] / net / sched / sch_tbf.c
index 231895562c66056e4c3f2b72fe2ae5300a045e2a..b0d81098b0eee58acff75961491975ad45d2bb65 100644 (file)
  */
 
 #include <linux/module.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/jiffies.h>
 #include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/socket.h>
-#include <linux/sockios.h>
-#include <linux/in.h>
 #include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <linux/if_ether.h>
-#include <linux/inet.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/notifier.h>
-#include <net/ip.h>
-#include <net/route.h>
 #include <linux/skbuff.h>
-#include <net/sock.h>
+#include <net/netlink.h>
 #include <net/pkt_sched.h>
 
 
@@ -131,8 +115,8 @@ struct tbf_sched_data
        struct qdisc_watchdog watchdog; /* Watchdog timer */
 };
 
-#define L2T(q,L)   ((q)->R_tab->data[(L)>>(q)->R_tab->rate.cell_log])
-#define L2T_P(q,L) ((q)->P_tab->data[(L)>>(q)->P_tab->rate.cell_log])
+#define L2T(q,L)   qdisc_l2t((q)->R_tab,L)
+#define L2T_P(q,L) qdisc_l2t((q)->P_tab,L)
 
 static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 {
@@ -141,7 +125,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 
        if (skb->len > q->max_size) {
                sch->qstats.drops++;
-#ifdef CONFIG_NET_CLS_POLICE
+#ifdef CONFIG_NET_CLS_ACT
                if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch))
 #endif
                        kfree_skb(skb);
@@ -198,9 +182,8 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
                long ptoks = 0;
                unsigned int len = skb->len;
 
-               PSCHED_GET_TIME(now);
-
-               toks = PSCHED_TDIFF_SAFE(now, q->t_c, q->buffer);
+               now = psched_get_time();
+               toks = psched_tdiff_bounded(now, q->t_c, q->buffer);
 
                if (q->P_tab) {
                        ptoks = toks + q->ptokens;
@@ -253,7 +236,7 @@ static void tbf_reset(struct Qdisc* sch)
 
        qdisc_reset(q->qdisc);
        sch->q.qlen = 0;
-       PSCHED_GET_TIME(q->t_c);
+       q->t_c = psched_get_time();
        q->tokens = q->buffer;
        q->ptokens = q->mtu;
        qdisc_watchdog_cancel(&q->watchdog);
@@ -363,7 +346,7 @@ static int tbf_init(struct Qdisc* sch, struct rtattr *opt)
        if (opt == NULL)
                return -EINVAL;
 
-       PSCHED_GET_TIME(q->t_c);
+       q->t_c = psched_get_time();
        qdisc_watchdog_init(&q->watchdog, sch);
        q->qdisc = &noop_qdisc;
 
@@ -408,7 +391,7 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
        return skb->len;
 
 rtattr_failure:
-       skb_trim(skb, b - skb->data);
+       nlmsg_trim(skb, b);
        return -1;
 }