diff options
author | Patrick McHardy <kaber@trash.net> | 2007-03-23 14:29:11 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:27:54 -0400 |
commit | 03cc45c0a5b9b7f74768feb43b9a2525d203bbdb (patch) | |
tree | acb5b1d692c9fdf526863f641547744b0a2d38a0 /include/net | |
parent | 8edc0c31d6b7849b0fb50db86824830769241939 (diff) |
[NET_SCHED]: turn PSCHED_TDIFF_SAFE into inline function
Also rename to psched_tdiff_bounded.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/pkt_sched.h | 8 | ||||
-rw-r--r-- | include/net/red.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 163973740207..e6b1da050d32 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -51,10 +51,14 @@ typedef long psched_tdiff_t; | |||
51 | #define PSCHED_GET_TIME(stamp) \ | 51 | #define PSCHED_GET_TIME(stamp) \ |
52 | ((stamp) = PSCHED_NS2US(ktime_to_ns(ktime_get()))) | 52 | ((stamp) = PSCHED_NS2US(ktime_to_ns(ktime_get()))) |
53 | 53 | ||
54 | #define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \ | ||
55 | min_t(long long, (tv1) - (tv2), bound) | ||
56 | #define PSCHED_PASTPERFECT 0 | 54 | #define PSCHED_PASTPERFECT 0 |
57 | 55 | ||
56 | static inline psched_tdiff_t | ||
57 | psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound) | ||
58 | { | ||
59 | return min(tv1 - tv2, bound); | ||
60 | } | ||
61 | |||
58 | struct qdisc_watchdog { | 62 | struct qdisc_watchdog { |
59 | struct hrtimer timer; | 63 | struct hrtimer timer; |
60 | struct Qdisc *qdisc; | 64 | struct Qdisc *qdisc; |
diff --git a/include/net/red.h b/include/net/red.h index d9e1149a2bca..0bc16913fdd7 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
@@ -178,7 +178,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) | |||
178 | int shift; | 178 | int shift; |
179 | 179 | ||
180 | PSCHED_GET_TIME(now); | 180 | PSCHED_GET_TIME(now); |
181 | us_idle = PSCHED_TDIFF_SAFE(now, p->qidlestart, p->Scell_max); | 181 | us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max); |
182 | 182 | ||
183 | /* | 183 | /* |
184 | * The problem: ideally, average length queue recalcultion should | 184 | * The problem: ideally, average length queue recalcultion should |