[Codel] [PATCH 2/2] Clamp interval to 32 bits

Dave Täht dave.taht at bufferbloat.net
Sat May 5 07:34:31 EDT 2012


---
 net/sched/sch_codel.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/sched/sch_codel.c b/net/sched/sch_codel.c
index 636f505..d26db8c 100644
--- a/net/sched/sch_codel.c
+++ b/net/sched/sch_codel.c
@@ -88,10 +88,10 @@ static unsigned int states;
  * return interval/sqrt(x) with good precision
  */
 
-static u32 calc(u64 interval, unsigned long x)
+static u32 calc(u32 _interval, unsigned long x)
 {
-       /* scale for 16 bits precision */
-       while (x < (1UL << 30)) {
+       u64 interval = _interval;       
+       while (x < (1UL << (BITS_PER_LONG - 2))) {
                x <<= 2;
                interval <<= 1;
        }
-- 
1.7.9.5




More information about the Codel mailing list