2010/3/8 Islam Hegazy <[email protected]>:
> I have a question about the cases that can happen when the LE receives a
> beacon. In processReceivedMessage function in the LinkEstimatorP.nc, LE can
> update the neighbour's entry if it exists (CASE 1). It will create a
> neighbour entry if it hears this neighbour for the first time (CASE 2).
> However, if the table it full, LE will find the worst neighbour and init the
> corresponding entry (CASE 3). If there is no worst neighbour, the LE will
> check with the router if it shall insert the neighbour, then chooses a
> random neighbour to evict (CASE 4).
>
>             nidx = findIdx(ll_addr);
>
>             if (nidx != INVALID_RVAL)
>
>                   updateNeighborEntryIdx(nidx,
> hdr->seq);                         //CASE 1
>
>             else
>
>             {
>
>                   nidx = findEmptyNeighborIdx();
>
>                   if (nidx != INVALID_RVAL)
>
>                   {
>
>                         initNeighborIdx(nidx, ll_addr);
>
>                         updateNeighborEntryIdx(nidx,
> hdr->seq);                    //CASE 2
>
>                   }
>
>                   else
>
>                   {
>
>                         nidx = findWorstNeighborIdx(EVICT_ETX_THRESHOLD);
>
>                         if (nidx != INVALID_RVAL)
>
>                         {
>
>                               signal
> LinkEstimator.evicted(NeighborTable[nidx].ll_addr);
>
>                               initNeighborIdx(nidx,
> ll_addr);                      //CASE 3
>
>                         }
>
>                         else
>
>                         {
>
>                               //if the white bit is set, lets ask the router
> if the path through this link is better than at least one known path - if so
> lets insert this link into the table.
>
>                               if (call
> LinkPacketMetadata.highChannelQuality(msg))
>
>                               {
>
>                                     if (signal
> CompareBit.shouldInsert(msg,   call Packet.getPayload(msg, call
> Packet.payloadLength(msg)), call Packet.payloadLength(msg)))
>
>                                     {
>
>                                           nidx = findRandomNeighborIdx();
>
>                                           if (nidx != INVALID_RVAL)
>
>                                           {
>
>                                                 signal
> LinkEstimator.evicted(NeighborTable[nidx].ll_addr);
>
>                                                 initNeighborIdx(nidx,
> ll_addr);    //CASE 4
>
>                                           }
>
>                                     }
>
>                               }
>
>                         }
>
>                   }
>
>             }
>
>
>
> My question is, why in the last two cases the LE init the entry and does not
> update it with the new info? Isn't it logical to update the neighbour info
> once I have a valid entry for it in the table?

initNeighborIdx() sets the link layer address and the INIT_ENTRY flag
to the entry. In addition, it might be a good idea to increment
rcvcount and lastseq but you don't want to call
updateNeighborEntryIdx() because that will also reset the INIT_ENTRY
flag. You can create a new update function that does not reset the
INIT_ENTRY flag, call that function after initNeighborIdx() call, and
do some experiments with it. If there is some difference, we can
update the code.

- om_p

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to