[Olsr-dev] Bug in LQ-Calculation (with patch)
Andreas Jacobs
(spam-protected)
Thu Sep 6 11:39:30 CEST 2007
Hello,
I think I've found a bug in the calculation of the link quality, which is
done the following way:
1) entry->loss_link_quality =
2) (float)(entry->total_packets - entry->lost_packets) /
3) (float)(entry->loss_window_size < (2 * 4) ? entry->loss_window_size:
4) 4 * ((entry->loss_window_size / 4 - 1) * entry->total_packets +
entry->loss_window_size) / entry->loss_window_size);
Please assume a perfect link for now that does not loose any packets. It
should have a link quality of 1.
If we set loss_window_size to 10 (the default) and wait for a while, then
total_packets will become 10, too, and lost_packets will be 0. So the
numerator (line 2) will equal 10 and so should the denominator, but the
denominator gives only 8, giving a link quality value of 1.25!
The reason might be, that "entry->loss_window_size / 4" is an integer
division, which gives 10 / 4 = 2 and not 2.5!
Proposed solution:
Convert that integer division to a floating point division. However, I'm
not quite sure, if this is correct, because I haven't fully understood the
formula
Thank you
Andreas Jacobs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: link_quality_float.patch
Type: text/x-patch
Size: 816 bytes
Desc: link_quality_float.patch
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20070906/939b2c95/attachment.bin>
More information about the Olsr-dev
mailing list