(Resending as plain text)
Dear Alexey,
The code (see below) for computing the queue average for RED implementation in Linux kernel has a bug. The return line should be "return p->qavg + ((backlog - p->qavg) >> p->Wlog);".
qavg = qavg*(1-W) + backlog*W
= qavg + (backlog-qavg)*W
The current buggy code applies right shift to only the previous qavg, where as it should be applied to (backlog - qavg). Hope you can get this bug corrected.
Thanks,
Praveen Yalagandula
Senior Researcher, HP Labs, Palo Alto, CA
-------------------------------------
static inline unsigned long red_calc_qavg_no_idle_time(struct red_parms *p, unsigned int backlog)
{
/*
* NOTE: p->qavg is fixed point number with point at Wlog.
* The formula below is equvalent to floating point
* version:
*
* qavg = qavg*(1-W) + backlog*W;
*
* --ANK (980924)
*/
return p->qavg + (backlog - (p->qavg >> p->Wlog));
}