diff options
author | Patrick McHardy <kaber@trash.net> | 2007-03-16 04:18:42 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:26:04 -0400 |
commit | 641b9e0e8b7f96425da6ce98f3361e3af0baee29 (patch) | |
tree | 2315fed3b4fd9df52a52464b9b1ce1561d403a87 /net/sched/sch_hfsc.c | |
parent | ddc7b8e32b22fe8b45d306b7d99472d4b560add6 (diff) |
[NET_SCHED]: Use ktime as clocksource
Get rid of the manual clock source selection mess and use ktime. Also
use a scalar representation, which allows to clean up pkt_sched.h a bit
more and results in less ktime_to_ns() calls in most cases.
The PSCHED_US2JIFFIE/PSCHED_JIFFIE2US macros are implemented quite
inefficient by this patch, following patches will convert all qdiscs
to hrtimers and get rid of them entirely.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_hfsc.c')
-rw-r--r-- | net/sched/sch_hfsc.c | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 407c6fb1ba1..f85cfba647f 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -195,20 +195,6 @@ struct hfsc_sched | |||
195 | struct timer_list wd_timer; /* watchdog timer */ | 195 | struct timer_list wd_timer; /* watchdog timer */ |
196 | }; | 196 | }; |
197 | 197 | ||
198 | /* | ||
199 | * macros | ||
200 | */ | ||
201 | #ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY | ||
202 | #include <linux/time.h> | ||
203 | #undef PSCHED_GET_TIME | ||
204 | #define PSCHED_GET_TIME(stamp) \ | ||
205 | do { \ | ||
206 | struct timeval tv; \ | ||
207 | do_gettimeofday(&tv); \ | ||
208 | (stamp) = 1ULL * USEC_PER_SEC * tv.tv_sec + tv.tv_usec; \ | ||
209 | } while (0) | ||
210 | #endif | ||
211 | |||
212 | #define HT_INFINITY 0xffffffffffffffffULL /* infinite time value */ | 198 | #define HT_INFINITY 0xffffffffffffffffULL /* infinite time value */ |
213 | 199 | ||
214 | 200 | ||
@@ -394,28 +380,17 @@ cftree_update(struct hfsc_class *cl) | |||
394 | * ism: (psched_us/byte) << ISM_SHIFT | 380 | * ism: (psched_us/byte) << ISM_SHIFT |
395 | * dx: psched_us | 381 | * dx: psched_us |
396 | * | 382 | * |
397 | * Clock source resolution (CONFIG_NET_SCH_CLK_*) | 383 | * The clock source resolution with ktime is 1.024us. |
398 | * JIFFIES: for 48<=HZ<=1534 resolution is between 0.63us and 1.27us. | ||
399 | * CPU: resolution is between 0.5us and 1us. | ||
400 | * GETTIMEOFDAY: resolution is exactly 1us. | ||
401 | * | 384 | * |
402 | * sm and ism are scaled in order to keep effective digits. | 385 | * sm and ism are scaled in order to keep effective digits. |
403 | * SM_SHIFT and ISM_SHIFT are selected to keep at least 4 effective | 386 | * SM_SHIFT and ISM_SHIFT are selected to keep at least 4 effective |
404 | * digits in decimal using the following table. | 387 | * digits in decimal using the following table. |
405 | * | 388 | * |
406 | * Note: We can afford the additional accuracy (altq hfsc keeps at most | ||
407 | * 3 effective digits) thanks to the fact that linux clock is bounded | ||
408 | * much more tightly. | ||
409 | * | ||
410 | * bits/sec 100Kbps 1Mbps 10Mbps 100Mbps 1Gbps | 389 | * bits/sec 100Kbps 1Mbps 10Mbps 100Mbps 1Gbps |
411 | * ------------+------------------------------------------------------- | 390 | * ------------+------------------------------------------------------- |
412 | * bytes/0.5us 6.25e-3 62.5e-3 625e-3 6250e-e 62500e-3 | 391 | * bytes/1.024us 12.8e-3 128e-3 1280e-3 12800e-3 128000e-3 |
413 | * bytes/us 12.5e-3 125e-3 1250e-3 12500e-3 125000e-3 | ||
414 | * bytes/1.27us 15.875e-3 158.75e-3 1587.5e-3 15875e-3 158750e-3 | ||
415 | * | 392 | * |
416 | * 0.5us/byte 160 16 1.6 0.16 0.016 | 393 | * 1.024us/byte 78.125 7.8125 0.78125 0.078125 0.0078125 |
417 | * us/byte 80 8 0.8 0.08 0.008 | ||
418 | * 1.27us/byte 63 6.3 0.63 0.063 0.0063 | ||
419 | */ | 394 | */ |
420 | #define SM_SHIFT 20 | 395 | #define SM_SHIFT 20 |
421 | #define ISM_SHIFT 18 | 396 | #define ISM_SHIFT 18 |