[Olsr-dev] Seeking comments: OLSR+ETX v/s DSR+ETX

Henning Rogge (spam-protected)
Fri Dec 21 13:55:26 CET 2007


Am Mittwoch 19 Dezember 2007 15:58:53 schrieb elektra:
> And btw. I don't see any irrational 'voodoo' in LQ/NLQ/ETX - at night I can
> do downloads in our mesh via 18 hops with approx. 12 kByte/sec... Some
> people claimed that a mesh only works up to three hops. So the 'voodoo'
> seems to help a lot ;-)

Maybe it's time for a little "voodoo" banishment... ;)

when I looked through the sources of the LQ extension of olsrd 5.4, I noticed
this formula in the file "src/link_set.c":

entry->loss_link_quality =
    (float)(entry->total_packets - entry->lost_packets) /
    (float)(olsr_cnf->lq_wsize < (2 * 4) ? olsr_cnf->lq_wsize:
    4 * (((float)olsr_cnf->lq_wsize / 4 - 1) * entry->total_packets +
olsr_cnf->lq_wsize) / olsr_cnf->lq_wsize);


This looks like "Voodoo", but if you break it down it is the formula:

lq = (total - lost) / (total + 4 * (cfgwindow - total)/cfgwindow)

So it's just a formula that enlarge the window size a little bit at the
beginning of a link to prevent links start with 100% quality (got 1 of 1
hello packages).

I propose the formula could be changed to a simple weighted average
(I use a constant "a" for tuning the formula):

lq = (total - lost) / (  (total * (a-1) + cfgwindow) / a)

A little bit shifting of constant would result in the code:

// this must be only calculated once at initialization
float c = olsr_cnf->lq_wsize / 4.0f;
float constantOffset = olsr_cnf->lq_wsize / (c - 1.0);
float constantScaling = (c - 1.0) / c;


// this should be used instead of the normal formula
float floatingWindowSize;
if (olsr_cnf->lq_wsize < 8) {
      floatingWindowSize = 8.0f;
}
else  {
      floatingWindowSize = (float) entry->total_packets;

      if (entry->total_packets < olsr_cnf->lq_wsize) {
            floatingWindowSize = (floatingWindowSize + constantOffset)
                   * constantOffset;
      }
}
entry->loss_link_quality =
     (float)(entry->total_packets - entry->lost_packets) / floatingWindowSize;


This will result in the same numbers than before, but use only two floating
point operations for each calculation (could even be done with integer
arithmetic) and doesn't look like voodoo.

What do you think ?

Henning Rogge




More information about the Olsr-dev mailing list