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

Dave Taht dave.taht at gmail.com
Sat May 5 07:40:13 EDT 2012


On Sat, May 5, 2012 at 4:34 AM, Dave Täht <dave.taht at bufferbloat.net> wrote:
> ---
>  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
>

eric correctly pointed out that I'm crazy.

If I run either version of this with htb, it crashes after a brief load.

qdisc del dev eth0 root
qdisc add dev eth0 root handle 1: est 1sec 8sec htb default 1
class add dev eth0 parent 1: classid 1:1 est 1sec 8sec htb rate
2000kibit mtu 1500 quantum 1514
qdisc add dev eth0 parent 1:1 handle 10: est 1sec 4sec codel target
5ms interval 100ms limit 1000

I figure that's due to my still-botched netlink interface to the change routine.

I read some relevant code and the netlink doc and it's becoming more
clear but I'm going to bed.
handing off now.


-- 
Dave Täht
SKYPE: davetaht
US Tel: 1-239-829-5608
http://www.bufferbloat.net



More information about the Codel mailing list