From: gnawali Date: Tue, 22 Jan 2008 18:04:30 +0000 (+0000) Subject: rename INFINITY, only send mature links on the footer, make getlinkquality* calls... X-Git-Tag: release_tinyos_2_1_0_0~586 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=0ec745a939896b4d14901c1a14c5f2a644713e21 rename INFINITY, only send mature links on the footer, make getlinkquality* calls return VERY_LARGE_EETX if a link is not mature, set alpha=9 --- diff --git a/tos/lib/net/le/LinkEstimatorP.nc b/tos/lib/net/le/LinkEstimatorP.nc index d0e8a865..2f7c991e 100644 --- a/tos/lib/net/le/LinkEstimatorP.nc +++ b/tos/lib/net/le/LinkEstimatorP.nc @@ -67,10 +67,12 @@ implementation { BEST_EETX = 0, INVALID_RVAL = 0xff, INVALID_NEIGHBOR_ADDR = 0xff, - INFINITY = 0xff, + // if we don't know the link quality, we need to return a value so + // large that it will not be used to form paths + VERY_LARGE_EETX_VALUE = 0xff, // decay the link estimate using this alpha // we use a denominator of 10, so this corresponds to 0.2 - ALPHA = 2, + ALPHA = 9, // number of packets to wait before computing a new // DLQ (Data-driven Link Quality) DLQ_PKT_WINDOW = 5, @@ -130,7 +132,8 @@ implementation { newPrevSentIdx = 0; for (i = 0; i < NEIGHBOR_TABLE_SIZE && j < maxEntries; i++) { k = (prevSentIdx + i + 1) % NEIGHBOR_TABLE_SIZE; - if (NeighborTable[k].flags & VALID_ENTRY) { + if ((NeighborTable[k].flags & VALID_ENTRY) && + (NeighborTable[k].flags & MATURE_ENTRY)) { footer->neighborList[j].ll_addr = NeighborTable[k].ll_addr; footer->neighborList[j].inquality = NeighborTable[k].inquality; newPrevSentIdx = k; @@ -270,11 +273,11 @@ implementation { if (q1 > 0) { q = 2550 / q1 - 10; if (q > 255) { - q = INFINITY; + q = VERY_LARGE_EETX_VALUE; } return (uint8_t)q; } else { - return INFINITY; + return VERY_LARGE_EETX_VALUE; } } @@ -437,10 +440,14 @@ implementation { uint8_t idx; idx = findIdx(neighbor); if (idx == INVALID_RVAL) { - return INFINITY; + return VERY_LARGE_EETX_VALUE; } else { - return NeighborTable[idx].eetx; - }; + if (NeighborTable[idx].flags & MATURE_ENTRY) { + return NeighborTable[idx].eetx; + } else { + return VERY_LARGE_EETX_VALUE; + } + } } // return the quality of the link: neighor->self @@ -448,10 +455,14 @@ implementation { uint8_t idx; idx = findIdx(neighbor); if (idx == INVALID_RVAL) { - return INFINITY; + return VERY_LARGE_EETX_VALUE; } else { - return computeEETX(NeighborTable[idx].inquality); - }; + if (NeighborTable[idx].flags & MATURE_ENTRY) { + return computeEETX(NeighborTable[idx].inquality); + } else { + return VERY_LARGE_EETX_VALUE; + } + } } // return the quality of the link: self->neighbor @@ -459,10 +470,14 @@ implementation { uint8_t idx; idx = findIdx(neighbor); if (idx == INVALID_RVAL) { - return INFINITY; + return VERY_LARGE_EETX_VALUE; } else { - return computeEETX(NeighborTable[idx].outquality); - }; + if (NeighborTable[idx].flags & MATURE_ENTRY) { + return computeEETX(NeighborTable[idx].outquality); + } else { + return VERY_LARGE_EETX_VALUE; + } + } } // insert the neighbor at any cost (if there is a room for it)