[NET_SCHED]: sch_htb: fix event cache time calculation
authorPatrick McHardy <kaber@trash.net>
Thu, 24 May 2007 06:39:54 +0000 (23:39 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 24 May 2007 23:36:56 +0000 (16:36 -0700)
The event cache time must be an absolute value, when no event exists
it is incorrectly set to 1s instead of 1s in the future.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_htb.c

index 99bcec8dd04c1ac6fbba3a8d78492fc7cd5137ba..035788c5b7f8a75c07961c0694df50aeaa9ecef1 100644 (file)
@@ -976,8 +976,9 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
 
                if (q->now >= q->near_ev_cache[level]) {
                        event = htb_do_events(q, level);
-                       q->near_ev_cache[level] = event ? event :
-                                                         PSCHED_TICKS_PER_SEC;
+                       if (!event)
+                               event = q->now + PSCHED_TICKS_PER_SEC;
+                       q->near_ev_cache[level] = event;
                } else
                        event = q->near_ev_cache[level];