diff options
author | David S. Miller <davem@davemloft.net> | 2009-08-21 19:51:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-23 21:52:38 -0400 |
commit | 38acce2d7983632100a9ff3fd20295f6e34074a8 (patch) | |
tree | 9207518005cc12ae5e4642b8220471a0168f8c89 /net/sched | |
parent | ee5f9757ea17759e1ce5503bdae2b07e48e32af9 (diff) |
pkt_sched: Convert CBQ to tasklet_hrtimer.
This code expects to run in softirq context, and bare hrtimers
run in hw IRQ context.
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/sch_cbq.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index d5798e17a832..81652d6ccd36 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -163,7 +163,7 @@ struct cbq_sched_data | |||
163 | psched_time_t now_rt; /* Cached real time */ | 163 | psched_time_t now_rt; /* Cached real time */ |
164 | unsigned pmask; | 164 | unsigned pmask; |
165 | 165 | ||
166 | struct hrtimer delay_timer; | 166 | struct tasklet_hrtimer delay_timer; |
167 | struct qdisc_watchdog watchdog; /* Watchdog timer, | 167 | struct qdisc_watchdog watchdog; /* Watchdog timer, |
168 | started when CBQ has | 168 | started when CBQ has |
169 | backlog, but cannot | 169 | backlog, but cannot |
@@ -503,6 +503,8 @@ static void cbq_ovl_delay(struct cbq_class *cl) | |||
503 | cl->undertime = q->now + delay; | 503 | cl->undertime = q->now + delay; |
504 | 504 | ||
505 | if (delay > 0) { | 505 | if (delay > 0) { |
506 | struct hrtimer *ht; | ||
507 | |||
506 | sched += delay + cl->penalty; | 508 | sched += delay + cl->penalty; |
507 | cl->penalized = sched; | 509 | cl->penalized = sched; |
508 | cl->cpriority = TC_CBQ_MAXPRIO; | 510 | cl->cpriority = TC_CBQ_MAXPRIO; |
@@ -510,12 +512,12 @@ static void cbq_ovl_delay(struct cbq_class *cl) | |||
510 | 512 | ||
511 | expires = ktime_set(0, 0); | 513 | expires = ktime_set(0, 0); |
512 | expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched)); | 514 | expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched)); |
513 | if (hrtimer_try_to_cancel(&q->delay_timer) && | 515 | ht = &q->delay_timer.timer; |
514 | ktime_to_ns(ktime_sub( | 516 | if (hrtimer_try_to_cancel(ht) && |
515 | hrtimer_get_expires(&q->delay_timer), | 517 | ktime_to_ns(ktime_sub(hrtimer_get_expires(ht), |
516 | expires)) > 0) | 518 | expires)) > 0) |
517 | hrtimer_set_expires(&q->delay_timer, expires); | 519 | hrtimer_set_expires(ht, expires); |
518 | hrtimer_restart(&q->delay_timer); | 520 | hrtimer_restart(ht); |
519 | cl->delayed = 1; | 521 | cl->delayed = 1; |
520 | cl->xstats.overactions++; | 522 | cl->xstats.overactions++; |
521 | return; | 523 | return; |
@@ -621,7 +623,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer) | |||
621 | 623 | ||
622 | time = ktime_set(0, 0); | 624 | time = ktime_set(0, 0); |
623 | time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay)); | 625 | time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay)); |
624 | hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS); | 626 | tasklet_hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS); |
625 | } | 627 | } |
626 | 628 | ||
627 | sch->flags &= ~TCQ_F_THROTTLED; | 629 | sch->flags &= ~TCQ_F_THROTTLED; |
@@ -1214,7 +1216,7 @@ cbq_reset(struct Qdisc* sch) | |||
1214 | q->tx_class = NULL; | 1216 | q->tx_class = NULL; |
1215 | q->tx_borrowed = NULL; | 1217 | q->tx_borrowed = NULL; |
1216 | qdisc_watchdog_cancel(&q->watchdog); | 1218 | qdisc_watchdog_cancel(&q->watchdog); |
1217 | hrtimer_cancel(&q->delay_timer); | 1219 | tasklet_hrtimer_cancel(&q->delay_timer); |
1218 | q->toplevel = TC_CBQ_MAXLEVEL; | 1220 | q->toplevel = TC_CBQ_MAXLEVEL; |
1219 | q->now = psched_get_time(); | 1221 | q->now = psched_get_time(); |
1220 | q->now_rt = q->now; | 1222 | q->now_rt = q->now; |
@@ -1397,7 +1399,8 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt) | |||
1397 | q->link.minidle = -0x7FFFFFFF; | 1399 | q->link.minidle = -0x7FFFFFFF; |
1398 | 1400 | ||
1399 | qdisc_watchdog_init(&q->watchdog, sch); | 1401 | qdisc_watchdog_init(&q->watchdog, sch); |
1400 | hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); | 1402 | tasklet_hrtimer_init(&q->delay_timer, cbq_undelay, |
1403 | CLOCK_MONOTONIC, HRTIMER_MODE_ABS); | ||
1401 | q->delay_timer.function = cbq_undelay; | 1404 | q->delay_timer.function = cbq_undelay; |
1402 | q->toplevel = TC_CBQ_MAXLEVEL; | 1405 | q->toplevel = TC_CBQ_MAXLEVEL; |
1403 | q->now = psched_get_time(); | 1406 | q->now = psched_get_time(); |