diff options
| author | Patrick McHardy <kaber@trash.net> | 2007-03-23 14:29:25 -0400 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:27:55 -0400 |
| commit | 3bebcda28077375470dd60545b71bba2f83335fd (patch) | |
| tree | a0d610788ccfe8d3b50d6ebf3df014e98f6387bc | |
| parent | 03cc45c0a5b9b7f74768feb43b9a2525d203bbdb (diff) | |
[NET_SCHED]: turn PSCHED_GET_TIME into inline function
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/net/pkt_sched.h | 8 | ||||
| -rw-r--r-- | include/net/red.h | 4 | ||||
| -rw-r--r-- | net/sched/act_police.c | 9 | ||||
| -rw-r--r-- | net/sched/sch_cbq.c | 10 | ||||
| -rw-r--r-- | net/sched/sch_hfsc.c | 10 | ||||
| -rw-r--r-- | net/sched/sch_htb.c | 6 | ||||
| -rw-r--r-- | net/sched/sch_netem.c | 8 | ||||
| -rw-r--r-- | net/sched/sch_tbf.c | 7 |
8 files changed, 29 insertions, 33 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index e6b1da050d32..b2cc9a8ed4e7 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
| @@ -48,11 +48,13 @@ typedef long psched_tdiff_t; | |||
| 48 | #define PSCHED_NS2US(x) ((x) >> 10) | 48 | #define PSCHED_NS2US(x) ((x) >> 10) |
| 49 | 49 | ||
| 50 | #define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC) | 50 | #define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC) |
| 51 | #define PSCHED_GET_TIME(stamp) \ | ||
| 52 | ((stamp) = PSCHED_NS2US(ktime_to_ns(ktime_get()))) | ||
| 53 | |||
| 54 | #define PSCHED_PASTPERFECT 0 | 51 | #define PSCHED_PASTPERFECT 0 |
| 55 | 52 | ||
| 53 | static inline psched_time_t psched_get_time(void) | ||
| 54 | { | ||
| 55 | return PSCHED_NS2US(ktime_to_ns(ktime_get())); | ||
| 56 | } | ||
| 57 | |||
| 56 | static inline psched_tdiff_t | 58 | static inline psched_tdiff_t |
| 57 | psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound) | 59 | psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound) |
| 58 | { | 60 | { |
diff --git a/include/net/red.h b/include/net/red.h index 0bc16913fdd7..3cf31d466a81 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
| @@ -156,7 +156,7 @@ static inline int red_is_idling(struct red_parms *p) | |||
| 156 | 156 | ||
| 157 | static inline void red_start_of_idle_period(struct red_parms *p) | 157 | static inline void red_start_of_idle_period(struct red_parms *p) |
| 158 | { | 158 | { |
| 159 | PSCHED_GET_TIME(p->qidlestart); | 159 | p->qidlestart = psched_get_time(); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | static inline void red_end_of_idle_period(struct red_parms *p) | 162 | 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) | |||
| 177 | long us_idle; | 177 | long us_idle; |
| 178 | int shift; | 178 | int shift; |
| 179 | 179 | ||
| 180 | PSCHED_GET_TIME(now); | 180 | now = psched_get_time(); |
| 181 | us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max); | 181 | us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max); |
| 182 | 182 | ||
| 183 | /* | 183 | /* |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 65d60a3f7761..616f465f407e 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
| @@ -241,7 +241,7 @@ override: | |||
| 241 | if (ret != ACT_P_CREATED) | 241 | if (ret != ACT_P_CREATED) |
| 242 | return ret; | 242 | return ret; |
| 243 | 243 | ||
| 244 | PSCHED_GET_TIME(police->tcfp_t_c); | 244 | police->tcfp_t_c = psched_get_time(); |
| 245 | police->tcf_index = parm->index ? parm->index : | 245 | police->tcf_index = parm->index ? parm->index : |
| 246 | tcf_hash_new_index(&police_idx_gen, &police_hash_info); | 246 | tcf_hash_new_index(&police_idx_gen, &police_hash_info); |
| 247 | h = tcf_hash(police->tcf_index, POL_TAB_MASK); | 247 | 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, | |||
| 296 | return police->tcfp_result; | 296 | return police->tcfp_result; |
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | PSCHED_GET_TIME(now); | 299 | now = psched_get_time(); |
| 300 | |||
| 301 | toks = psched_tdiff_bounded(now, police->tcfp_t_c, | 300 | toks = psched_tdiff_bounded(now, police->tcfp_t_c, |
| 302 | police->tcfp_burst); | 301 | police->tcfp_burst); |
| 303 | if (police->tcfp_P_tab) { | 302 | if (police->tcfp_P_tab) { |
| @@ -495,7 +494,7 @@ struct tcf_police *tcf_police_locate(struct rtattr *rta, struct rtattr *est) | |||
| 495 | } | 494 | } |
| 496 | if (police->tcfp_P_tab) | 495 | if (police->tcfp_P_tab) |
| 497 | police->tcfp_ptoks = L2T_P(police, police->tcfp_mtu); | 496 | police->tcfp_ptoks = L2T_P(police, police->tcfp_mtu); |
| 498 | PSCHED_GET_TIME(police->tcfp_t_c); | 497 | police->tcfp_t_c = psched_get_time(); |
| 499 | police->tcf_index = parm->index ? parm->index : | 498 | police->tcf_index = parm->index ? parm->index : |
| 500 | tcf_police_new_index(); | 499 | tcf_police_new_index(); |
| 501 | police->tcf_action = parm->action; | 500 | police->tcf_action = parm->action; |
| @@ -543,7 +542,7 @@ int tcf_police(struct sk_buff *skb, struct tcf_police *police) | |||
| 543 | return police->tcfp_result; | 542 | return police->tcfp_result; |
| 544 | } | 543 | } |
| 545 | 544 | ||
| 546 | PSCHED_GET_TIME(now); | 545 | now = psched_get_time(); |
| 547 | toks = psched_tdiff_bounded(now, police->tcfp_t_c, | 546 | toks = psched_tdiff_bounded(now, police->tcfp_t_c, |
| 548 | police->tcfp_burst); | 547 | police->tcfp_burst); |
| 549 | if (police->tcfp_P_tab) { | 548 | if (police->tcfp_P_tab) { |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index f9e8403c5222..414a97c962f1 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
| @@ -385,7 +385,7 @@ cbq_mark_toplevel(struct cbq_sched_data *q, struct cbq_class *cl) | |||
| 385 | psched_time_t now; | 385 | psched_time_t now; |
| 386 | psched_tdiff_t incr; | 386 | psched_tdiff_t incr; |
| 387 | 387 | ||
| 388 | PSCHED_GET_TIME(now); | 388 | now = psched_get_time(); |
| 389 | incr = now - q->now_rt; | 389 | incr = now - q->now_rt; |
| 390 | now = q->now + incr; | 390 | now = q->now + incr; |
| 391 | 391 | ||
| @@ -654,7 +654,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer) | |||
| 654 | psched_tdiff_t delay = 0; | 654 | psched_tdiff_t delay = 0; |
| 655 | unsigned pmask; | 655 | unsigned pmask; |
| 656 | 656 | ||
| 657 | PSCHED_GET_TIME(now); | 657 | now = psched_get_time(); |
| 658 | 658 | ||
| 659 | pmask = q->pmask; | 659 | pmask = q->pmask; |
| 660 | q->pmask = 0; | 660 | q->pmask = 0; |
| @@ -1003,7 +1003,7 @@ cbq_dequeue(struct Qdisc *sch) | |||
| 1003 | psched_time_t now; | 1003 | psched_time_t now; |
| 1004 | psched_tdiff_t incr; | 1004 | psched_tdiff_t incr; |
| 1005 | 1005 | ||
| 1006 | PSCHED_GET_TIME(now); | 1006 | now = psched_get_time(); |
| 1007 | incr = now - q->now_rt; | 1007 | incr = now - q->now_rt; |
| 1008 | 1008 | ||
| 1009 | if (q->tx_class) { | 1009 | if (q->tx_class) { |
| @@ -1277,7 +1277,7 @@ cbq_reset(struct Qdisc* sch) | |||
| 1277 | qdisc_watchdog_cancel(&q->watchdog); | 1277 | qdisc_watchdog_cancel(&q->watchdog); |
| 1278 | hrtimer_cancel(&q->delay_timer); | 1278 | hrtimer_cancel(&q->delay_timer); |
| 1279 | q->toplevel = TC_CBQ_MAXLEVEL; | 1279 | q->toplevel = TC_CBQ_MAXLEVEL; |
| 1280 | PSCHED_GET_TIME(q->now); | 1280 | q->now = psched_get_time(); |
| 1281 | q->now_rt = q->now; | 1281 | q->now_rt = q->now; |
| 1282 | 1282 | ||
| 1283 | for (prio = 0; prio <= TC_CBQ_MAXPRIO; prio++) | 1283 | for (prio = 0; prio <= TC_CBQ_MAXPRIO; prio++) |
| @@ -1448,7 +1448,7 @@ static int cbq_init(struct Qdisc *sch, struct rtattr *opt) | |||
| 1448 | hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); | 1448 | hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); |
| 1449 | q->delay_timer.function = cbq_undelay; | 1449 | q->delay_timer.function = cbq_undelay; |
| 1450 | q->toplevel = TC_CBQ_MAXLEVEL; | 1450 | q->toplevel = TC_CBQ_MAXLEVEL; |
| 1451 | PSCHED_GET_TIME(q->now); | 1451 | q->now = psched_get_time(); |
| 1452 | q->now_rt = q->now; | 1452 | q->now_rt = q->now; |
| 1453 | 1453 | ||
| 1454 | cbq_link_class(&q->link); | 1454 | cbq_link_class(&q->link); |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 6a762cf781d7..7d51d0d6a70e 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
| @@ -629,9 +629,7 @@ rtsc_min(struct runtime_sc *rtsc, struct internal_sc *isc, u64 x, u64 y) | |||
| 629 | static void | 629 | static void |
| 630 | init_ed(struct hfsc_class *cl, unsigned int next_len) | 630 | init_ed(struct hfsc_class *cl, unsigned int next_len) |
| 631 | { | 631 | { |
| 632 | u64 cur_time; | 632 | u64 cur_time = psched_get_time(); |
| 633 | |||
| 634 | PSCHED_GET_TIME(cur_time); | ||
| 635 | 633 | ||
| 636 | /* update the deadline curve */ | 634 | /* update the deadline curve */ |
| 637 | rtsc_min(&cl->cl_deadline, &cl->cl_rsc, cur_time, cl->cl_cumul); | 635 | 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) | |||
| 754 | if (cl->cl_flags & HFSC_USC) { | 752 | if (cl->cl_flags & HFSC_USC) { |
| 755 | /* class has upper limit curve */ | 753 | /* class has upper limit curve */ |
| 756 | if (cur_time == 0) | 754 | if (cur_time == 0) |
| 757 | PSCHED_GET_TIME(cur_time); | 755 | cur_time = psched_get_time(); |
| 758 | 756 | ||
| 759 | /* update the ulimit curve */ | 757 | /* update the ulimit curve */ |
| 760 | rtsc_min(&cl->cl_ulimit, &cl->cl_usc, cur_time, | 758 | rtsc_min(&cl->cl_ulimit, &cl->cl_usc, cur_time, |
| @@ -1038,7 +1036,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
| 1038 | if (cl->cl_parent == NULL && parentid != TC_H_ROOT) | 1036 | if (cl->cl_parent == NULL && parentid != TC_H_ROOT) |
| 1039 | return -EINVAL; | 1037 | return -EINVAL; |
| 1040 | } | 1038 | } |
