and changed files
[powerpc.git] / net / sched / sch_hfsc.c
index 3cc2714..9d124c4 100644 (file)
@@ -65,6 +65,7 @@
 #include <linux/netdevice.h>
 #include <linux/rtnetlink.h>
 #include <linux/pkt_sched.h>
+#include <net/netlink.h>
 #include <net/pkt_sched.h>
 #include <net/pkt_cls.h>
 #include <asm/system.h>
@@ -434,8 +435,8 @@ m2sm(u32 m)
        u64 sm;
 
        sm = ((u64)m << SM_SHIFT);
-       sm += PSCHED_JIFFIE2US(HZ) - 1;
-       do_div(sm, PSCHED_JIFFIE2US(HZ));
+       sm += PSCHED_TICKS_PER_SEC - 1;
+       do_div(sm, PSCHED_TICKS_PER_SEC);
        return sm;
 }
 
@@ -448,7 +449,7 @@ m2ism(u32 m)
        if (m == 0)
                ism = HT_INFINITY;
        else {
-               ism = ((u64)PSCHED_JIFFIE2US(HZ) << ISM_SHIFT);
+               ism = ((u64)PSCHED_TICKS_PER_SEC << ISM_SHIFT);
                ism += m - 1;
                do_div(ism, m);
        }
@@ -461,7 +462,7 @@ d2dx(u32 d)
 {
        u64 dx;
 
-       dx = ((u64)d * PSCHED_JIFFIE2US(HZ));
+       dx = ((u64)d * PSCHED_TICKS_PER_SEC);
        dx += USEC_PER_SEC - 1;
        do_div(dx, USEC_PER_SEC);
        return dx;
@@ -473,7 +474,7 @@ sm2m(u64 sm)
 {
        u64 m;
 
-       m = (sm * PSCHED_JIFFIE2US(HZ)) >> SM_SHIFT;
+       m = (sm * PSCHED_TICKS_PER_SEC) >> SM_SHIFT;
        return (u32)m;
 }
 
@@ -484,7 +485,7 @@ dx2d(u64 dx)
        u64 d;
 
        d = dx * USEC_PER_SEC;
-       do_div(d, PSCHED_JIFFIE2US(HZ));
+       do_div(d, PSCHED_TICKS_PER_SEC);
        return (u32)d;
 }
 
@@ -628,9 +629,7 @@ rtsc_min(struct runtime_sc *rtsc, struct internal_sc *isc, u64 x, u64 y)
 static void
 init_ed(struct hfsc_class *cl, unsigned int next_len)
 {
-       u64 cur_time;
-
-       PSCHED_GET_TIME(cur_time);
+       u64 cur_time = psched_get_time();
 
        /* update the deadline curve */
        rtsc_min(&cl->cl_deadline, &cl->cl_rsc, cur_time, cl->cl_cumul);
@@ -753,7 +752,7 @@ init_vf(struct hfsc_class *cl, unsigned int len)
                        if (cl->cl_flags & HFSC_USC) {
                                /* class has upper limit curve */
                                if (cur_time == 0)
-                                       PSCHED_GET_TIME(cur_time);
+                                       cur_time = psched_get_time();
 
                                /* update the ulimit curve */
                                rtsc_min(&cl->cl_ulimit, &cl->cl_usc, cur_time,
@@ -1037,7 +1036,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
                        if (cl->cl_parent == NULL && parentid != TC_H_ROOT)
                                return -EINVAL;
                }
-               PSCHED_GET_TIME(cur_time);
+               cur_time = psched_get_time();
 
                sch_tree_lock(sch);
                if (rsc != NULL)
@@ -1122,23 +1121,12 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
        return 0;
 }
 
-static void
-hfsc_destroy_filters(struct tcf_proto **fl)
-{
-       struct tcf_proto *tp;
-
-       while ((tp = *fl) != NULL) {
-               *fl = tp->next;
-               tcf_destroy(tp);
-       }
-}
-
 static void
 hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl)
 {
        struct hfsc_sched *q = qdisc_priv(sch);
 
-       hfsc_destroy_filters(&cl->filter_list);
+       tcf_destroy_chain(cl->filter_list);
        qdisc_destroy(cl->qdisc);
 #ifdef CONFIG_NET_ESTIMATOR
        gen_kill_estimator(&cl->bstats, &cl->rate_est);
@@ -1363,7 +1351,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
                struct tcmsg *tcm)
 {
        struct hfsc_class *cl = (struct hfsc_class *)arg;
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct rtattr *rta = (struct rtattr *)b;
 
        tcm->tcm_parent = cl->cl_parent ? cl->cl_parent->classid : TC_H_ROOT;
@@ -1374,11 +1362,11 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
        RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
        if (hfsc_dump_curves(skb, cl) < 0)
                goto rtattr_failure;
-       rta->rta_len = skb->tail - b;
+       rta->rta_len = skb_tail_pointer(skb) - b;
        return skb->len;
 
  rtattr_failure:
-       skb_trim(skb, b - skb->data);
+       nlmsg_trim(skb, b);
        return -1;
 }
 
@@ -1576,7 +1564,7 @@ static int
 hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
 {
        struct hfsc_sched *q = qdisc_priv(sch);
-       unsigned char *b = skb->tail;
+       unsigned char *b = skb_tail_pointer(skb);
        struct tc_hfsc_qopt qopt;
 
        qopt.defcls = q->defcls;
@@ -1584,7 +1572,7 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
        return skb->len;
 
  rtattr_failure:
-       skb_trim(skb, b - skb->data);
+       nlmsg_trim(skb, b);
        return -1;
 }
 
@@ -1638,7 +1626,7 @@ hfsc_dequeue(struct Qdisc *sch)
        if ((skb = __skb_dequeue(&q->requeue)))
                goto out;
 
-       PSCHED_GET_TIME(cur_time);
+       cur_time = psched_get_time();
 
        /*
         * if there are eligible classes, use real-time criteria.