]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
updates to the compare bit interface/use of white bit
authorgnawali <gnawali>
Sat, 27 Sep 2008 17:00:54 +0000 (17:00 +0000)
committergnawali <gnawali>
Sat, 27 Sep 2008 17:00:54 +0000 (17:00 +0000)
tos/lib/net/4bitle/LinkEstimatorP.nc
tos/lib/net/ctp/CompareBit.nc
tos/lib/net/ctp/CtpRoutingEngineP.nc

index 7e5c9dacc8264d4b1f5994de2599e63b69ffd557..d0f307561959d68849379c391768b9a68b6287c1 100644 (file)
@@ -644,14 +644,20 @@ implementation {
            initNeighborIdx(nidx, ll_addr);
          } else {
            dbg("LI", "No room in the table\n");
-           if (signal CompareBit.shouldInsert(msg, 
-                                              call Packet.getPayload(msg, call Packet.payloadLength(msg)),
-                                              call Packet.payloadLength(msg),
-                                              call LinkPacketMetadata.highChannelQuality(msg))) {
-             nidx = findRandomNeighborIdx();
-             if (nidx != INVALID_RVAL) {
-               signal LinkEstimator.evicted(NeighborTable[nidx].ll_addr);
-               initNeighborIdx(nidx, ll_addr);
+
+           /* 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);
+               }
              }
            }
          }
index 3f9528d794685c4e86d5f5484527c0c6726d85ae..ddebdac648b9c17f3a51a0814eac96445c72e21b 100644 (file)
@@ -25,8 +25,9 @@
  */
 
 /** Link estimator asks the routing engine if this entry
- * should be inserted into the neighbor table given the
- * white bit. The return value is the "pin bit" - if true
+ * should be inserted into the neighbor table if the
+ * white bit on a link is set but there is no room for the link
+ * on the link table. The return value is the "pin bit" - if true
  * insert into the neighbor table. In the reference implementation
  * the router will return true if the path through the source
  * will be better than a path through at least one current neighbor.
@@ -38,5 +39,6 @@
 interface CompareBit {
 
   /* should the source of this message be inserted into the neighbor table? */
-   event bool shouldInsert(message_t * ONE msg, void* COUNT_NOK(len) payload, uint8_t len, bool white_bit);
+  /* expect to be called only for links with the white bit set */
+   event bool shouldInsert(message_t * ONE msg, void* COUNT_NOK(len) payload, uint8_t len);
 }
index 352938035f3999a048507887ac81a4e00eaca311..bd213db9fe1dba01fe2aef27b81e5a1e65ec23c9 100644 (file)
@@ -636,26 +636,20 @@ implementation {
     }
 
 
-  /* This should see if the node should be inserted in the table.
-   * If the white_bit is set, this means the LL believes this is a good
-   * first hop link. 
-   * The link will be recommended for insertion if it is better* than some
+  /* The link will be recommended for insertion if it is better* than some
    * link in the routing table that is not our parent.
    * We are comparing the path quality up to the node, and ignoring the link
    * quality from us to the node. This is because of a couple of things:
-   *   1. because of the white bit, we assume that the 1-hop to the candidate
-   *      link is good (say, etx=1)
+   *   1. we expect this call only for links with white bit set
    *   2. we are being optimistic to the nodes in the table, by ignoring the
    *      1-hop quality to them (which means we are assuming it's 1 as well)
    *      This actually sets the bar a little higher for replacement
    *   3. this is faster
-   *   4. it doesn't require the link estimator to have stabilized on a link
    */
-    event bool CompareBit.shouldInsert(message_t *msg, void* payload, uint8_t len, bool white_bit) {
+    event bool CompareBit.shouldInsert(message_t *msg, void* payload, uint8_t len) {
         
         bool found = FALSE;
         uint16_t pathEtx;
-        //uint16_t linkEtx = evaluateEtx(0);
         uint16_t neighEtx;
         int i;
         routing_table_entry* entry;