aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/pkt_sched.h
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-01-09 01:12:03 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-09 17:16:05 -0500
commit538e43a4bd36ae49873ef7097a16a207f5d9912b (patch)
tree11a7a9ea4594993c559a247d6ff373dc00b77e1c /include/net/pkt_sched.h
parent2941a4863154982918d39a639632c76eeacfa884 (diff)
[PKT_SCHED]: Use USEC_PER_SEC
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/pkt_sched.h')
-rw-r--r--include/net/pkt_sched.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 6492e7363d84..b94d1ad92c4d 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -1,6 +1,7 @@
1#ifndef __NET_PKT_SCHED_H 1#ifndef __NET_PKT_SCHED_H
2#define __NET_PKT_SCHED_H 2#define __NET_PKT_SCHED_H
3 3
4#include <linux/jiffies.h>
4#include <net/sch_generic.h> 5#include <net/sch_generic.h>
5 6
6struct qdisc_walker 7struct qdisc_walker
@@ -59,8 +60,8 @@ typedef struct timeval psched_time_t;
59typedef long psched_tdiff_t; 60typedef long psched_tdiff_t;
60 61
61#define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp)) 62#define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp))
62#define PSCHED_US2JIFFIE(usecs) (((usecs)+(1000000/HZ-1))/(1000000/HZ)) 63#define PSCHED_US2JIFFIE(usecs) usecs_to_jiffies(usecs)
63#define PSCHED_JIFFIE2US(delay) ((delay)*(1000000/HZ)) 64#define PSCHED_JIFFIE2US(delay) jiffies_to_usecs(delay)
64 65
65#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ 66#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
66 67
@@ -123,9 +124,9 @@ do { \
123 default: \ 124 default: \
124 __delta = 0; \ 125 __delta = 0; \
125 case 2: \ 126 case 2: \
126 __delta += 1000000; \ 127 __delta += USEC_PER_SEC; \
127 case 1: \ 128 case 1: \
128 __delta += 1000000; \ 129 __delta += USEC_PER_SEC; \
129 } \ 130 } \
130 } \ 131 } \
131 __delta; \ 132 __delta; \
@@ -136,9 +137,9 @@ psched_tod_diff(int delta_sec, int bound)
136{ 137{
137 int delta; 138 int delta;
138 139
139 if (bound <= 1000000 || delta_sec > (0x7FFFFFFF/1000000)-1) 140 if (bound <= USEC_PER_SEC || delta_sec > (0x7FFFFFFF/USEC_PER_SEC)-1)
140 return bound; 141 return bound;
141 delta = delta_sec * 1000000; 142 delta = delta_sec * USEC_PER_SEC;
142 if (delta > bound || delta < 0) 143 if (delta > bound || delta < 0)
143 delta = bound; 144 delta = bound;
144 return delta; 145 return delta;
@@ -152,9 +153,9 @@ psched_tod_diff(int delta_sec, int bound)
152 default: \ 153 default: \
153 __delta = psched_tod_diff(__delta_sec, bound); break; \ 154 __delta = psched_tod_diff(__delta_sec, bound); break; \
154 case 2: \ 155 case 2: \
155 __delta += 1000000; \ 156 __delta += USEC_PER_SEC; \
156 case 1: \ 157 case 1: \
157 __delta += 1000000; \ 158 __delta += USEC_PER_SEC; \
158 case 0: \ 159 case 0: \
159 if (__delta > bound || __delta < 0) \ 160 if (__delta > bound || __delta < 0) \
160 __delta = bound; \ 161 __delta = bound; \
@@ -170,15 +171,15 @@ psched_tod_diff(int delta_sec, int bound)
170({ \ 171({ \
171 int __delta = (tv).tv_usec + (delta); \ 172 int __delta = (tv).tv_usec + (delta); \
172 (tv_res).tv_sec = (tv).tv_sec; \ 173 (tv_res).tv_sec = (tv).tv_sec; \
173 if (__delta > 1000000) { (tv_res).tv_sec++; __delta -= 1000000; } \ 174 if (__delta > USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \
174 (tv_res).tv_usec = __delta; \ 175 (tv_res).tv_usec = __delta; \
175}) 176})
176 177
177#define PSCHED_TADD(tv, delta) \ 178#define PSCHED_TADD(tv, delta) \
178({ \ 179({ \
179 (tv).tv_usec += (delta); \ 180 (tv).tv_usec += (delta); \
180 if ((tv).tv_usec > 1000000) { (tv).tv_sec++; \ 181 if ((tv).tv_usec > USEC_PER_SEC) { (tv).tv_sec++; \
181 (tv).tv_usec -= 1000000; } \ 182 (tv).tv_usec -= USEC_PER_SEC; } \
182}) 183})
183 184
184/* Set/check that time is in the "past perfect"; 185/* Set/check that time is in the "past perfect";