]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[NET_SCHED]: turn PSCHED_GET_TIME into inline function
authorPatrick McHardy <kaber@trash.net>
Fri, 23 Mar 2007 18:29:25 +0000 (11:29 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:27:55 +0000 (22:27 -0700)
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/pkt_sched.h
include/net/red.h
net/sched/act_police.c
net/sched/sch_cbq.c
net/sched/sch_hfsc.c
net/sched/sch_htb.c
net/sched/sch_netem.c
net/sched/sch_tbf.c

index e6b1da050d32c10627d704dd50e485b77f317cef..b2cc9a8ed4e7eda826ad4919d9f0f395a5eac296 100644 (file)
@@ -48,11 +48,13 @@ typedef long        psched_tdiff_t;
 #define PSCHED_NS2US(x)                        ((x) >> 10)
 
 #define PSCHED_TICKS_PER_SEC           PSCHED_NS2US(NSEC_PER_SEC)
-#define PSCHED_GET_TIME(stamp) \
-       ((stamp) = PSCHED_NS2US(ktime_to_ns(ktime_get())))
-
 #define PSCHED_PASTPERFECT             0
 
+static inline psched_time_t psched_get_time(void)
+{
+       return PSCHED_NS2US(ktime_to_ns(ktime_get()));
+}
+
 static inline psched_tdiff_t
 psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound)
 {
index 0bc16913fdd72f0bebb28fac10dfb1e99717d3de..3cf31d466a81254e019aac768666458ffbae6009 100644 (file)
@@ -156,7 +156,7 @@ static inline int red_is_idling(struct red_parms *p)
 
 static inline void red_start_of_idle_period(struct red_parms *p)
 {
-       PSCHED_GET_TIME(p->qidlestart);
+       p->qidlestart = psched_get_time();
 }
 
 static inline void red_end_of_idle_period(struct red_parms *p)
@@ -177,7 +177,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
        long us_idle;
        int  shift;
 
-       PSCHED_GET_TIME(now);
+       now = psched_get_time();
        us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max);
 
        /*
index 65d60a3f77618c2a23ab0bc70714249cee75c435..616f465f407e03d33feaffc17f45a937fb3fcd23 100644 (file)
@@ -241,7 +241,7 @@ override:
        if (ret != ACT_P_CREATED)
                return ret;
 
-       PSCHED_GET_TIME(police->tcfp_t_c);
+       police->tcfp_t_c = psched_get_time();
        police->tcf_index = parm->index ? parm->index :
                tcf_hash_new_index(&police_idx_gen, &police_hash_info);
        h = tcf_hash(police->tcf_index, POL_TAB_MASK);
@@ -296,8 +296,7 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
                        return police->tcfp_result;
                }
 
-               PSCHED_GET_TIME(now);
-
+               now = psched_get_time();
                toks = psched_tdiff_bounded(now, police->tcfp_t_c,
                                            police->tcfp_burst);
                if (police->tcfp_P_tab) {
@@ -495,7 +494,7 @@ struct tcf_police *tcf_police_locate(struct rtattr *rta, struct rtattr *est)
        }
        if (police->tcfp_P_tab)
                police->tcfp_ptoks = L2T_P(police, police->tcfp_mtu);
-       PSCHED_GET_TIME(police->tcfp_t_c);
+       police->tcfp_t_c = psched_get_time();
        police->tcf_index = parm->index ? parm->index :
                tcf_police_new_index();
        police->tcf_action = parm->action;
@@ -543,7 +542,7 @@ int tcf_police(struct sk_buff *skb, struct tcf_police *police)
                        return police->tcfp_result;
                }
 
-               PSCHED_GET_TIME(now);
+               now = psched_get_time();
                toks = psched_tdiff_bounded(now, police->tcfp_t_c,
                                            police->tcfp_burst);
                if (police->tcfp_P_tab) {
index f9e8403c5222eefa7be94e5137f8b29d696ebc50..414a97c962f188f9ff82ec232119f28bc9a31ebe 100644 (file)
@@ -385,7 +385,7 @@ cbq_mark_toplevel(struct cbq_sched_data *q, struct cbq_class *cl)
                psched_time_t now;
                psched_tdiff_t incr;
 
-               PSCHED_GET_TIME(now);
+               now = psched_get_time();
                incr = now - q->now_rt;
                now = q->now + incr;
 
@@ -654,7 +654,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer)
        psched_tdiff_t delay = 0;
        unsigned pmask;
 
-       PSCHED_GET_TIME(now);
+       now = psched_get_time();
 
        pmask = q->pmask;
        q->pmask = 0;
@@ -1003,7 +1003,7 @@ cbq_dequeue(struct Qdisc *sch)
        psched_time_t now;
        psched_tdiff_t incr;
 
-       PSCHED_GET_TIME(now);
+       now = psched_get_time();
        incr = now - q->now_rt;
 
        if (q->tx_class) {
@@ -1277,7 +1277,7 @@ cbq_reset(struct Qdisc* sch)
        qdisc_watchdog_cancel(&q->watchdog);
        hrtimer_cancel(&q->delay_timer);
        q->toplevel = TC_CBQ_MAXLEVEL;
-       PSCHED_GET_TIME(q->now);
+       q->now = psched_get_time();
        q->now_rt = q->now;
 
        for (prio = 0; prio <= TC_CBQ_MAXPRIO; prio++)
@@ -1448,7 +1448,7 @@ static int cbq_init(struct Qdisc *sch, struct rtattr *opt)
        hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
        q->delay_timer.function = cbq_undelay;
        q->toplevel = TC_CBQ_MAXLEVEL;
-       PSCHED_GET_TIME(q->now);
+       q->now = psched_get_time();
        q->now_rt = q->now;
 
        cbq_link_class(&q->link);
index 6a762cf781d77c59bf437c079c97f3a91558a7b7..7d51d0d6a70eba301a5a44eb2195c01a2ed0ffdd 100644 (file)
@@ -629,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);
@@ -754,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,
@@ -1038,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)
@@ -1639,7 +1637,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.
index 71e4c92b7e87855db6e4d06787585cfb7492a631..3f528554b0d4514bb0975d8b2c3ce2ba52cd8f31 100644 (file)
@@ -965,7 +965,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
 
        if (!sch->q.qlen)
                goto fin;
-       PSCHED_GET_TIME(q->now);
+       q->now = psched_get_time();
 
        next_event = q->now + 5 * PSCHED_TICKS_PER_SEC;
        q->nwc_hit = 0;
@@ -1274,7 +1274,7 @@ static void htb_parent_to_leaf(struct htb_class *cl, struct Qdisc *new_q)
        parent->un.leaf.prio = parent->prio;
        parent->tokens = parent->buffer;
        parent->ctokens = parent->cbuffer;
-       PSCHED_GET_TIME(parent->t_c);
+       parent->t_c = psched_get_time();
        parent->cmode = HTB_CAN_SEND;
 }
 
@@ -1471,7 +1471,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
                cl->tokens = hopt->buffer;
                cl->ctokens = hopt->cbuffer;
                cl->mbuffer = 60 * PSCHED_TICKS_PER_SEC;        /* 1min */
-               PSCHED_GET_TIME(cl->t_c);
+               cl->t_c = psched_get_time();
                cl->cmode = HTB_CAN_SEND;
 
                /* attach to the hash list and parent's family */
index 1e88301f505c5833a84fad3ebc4520614c4696cd..5d9d8bc9cc3a039b76a7c93127b0a00ed8ca8295 100644 (file)
@@ -217,7 +217,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                delay = tabledist(q->latency, q->jitter,
                                  &q->delay_cor, q->delay_dist);
 
-               PSCHED_GET_TIME(now);
+               now = psched_get_time();
                cb->time_to_send = now + delay;
                ++q->counter;
                ret = q->qdisc->enqueue(skb, q->qdisc);
@@ -226,7 +226,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                 * Do re-ordering by putting one out of N packets at the front
                 * of the queue.
                 */
-               PSCHED_GET_TIME(cb->time_to_send);
+               cb->time_to_send = psched_get_time();
                q->counter = 0;
                ret = q->qdisc->ops->requeue(skb, q->qdisc);
        }
@@ -281,11 +281,9 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)
        if (skb) {
                const struct netem_skb_cb *cb
                        = (const struct netem_skb_cb *)skb->cb;
-               psched_time_t now;
+               psched_time_t now = psched_get_time();
 
                /* if more time remaining? */
-               PSCHED_GET_TIME(now);
-
                if (cb->time_to_send <= now) {
                        pr_debug("netem_dequeue: return skb=%p\n", skb);
                        sch->q.qlen--;
index da9f40e54447a5605d0702e5b53ce4964fdb255d..53862953baafc65735ef969888a39cfb49901fd3 100644 (file)
@@ -199,8 +199,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
                long ptoks = 0;
                unsigned int len = skb->len;
 
-               PSCHED_GET_TIME(now);
-
+               now = psched_get_time();
                toks = psched_tdiff_bounded(now, q->t_c, q->buffer);
 
                if (q->P_tab) {
@@ -254,7 +253,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);
@@ -364,7 +363,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;