]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Make timing the optimal values.
authorscipio <scipio>
Fri, 15 Aug 2008 21:57:31 +0000 (21:57 +0000)
committerscipio <scipio>
Fri, 15 Aug 2008 21:57:31 +0000 (21:57 +0000)
Include commented out code for trickle reset in routing engine.

tos/lib/net/ctp/CtpForwardingEngine.h
tos/lib/net/ctp/CtpForwardingEngineP.nc
tos/lib/net/ctp/CtpRoutingEngineP.nc

index 92f72fda9f581ea9b434e0fa05bf42e7c708231d..e45d0231198083038b40fffd03f6cd16e3fcc72e 100644 (file)
  */
 
 enum {
-#if PLATFORM_MICAZ || PLATFORM_TELOSA || PLATFORM_TELOSB || PLATFORM_TMOTE || PLATFORM_INTELMOTE2
-  FORWARD_PACKET_TIME = 4,
+#if PLATFORM_MICAZ || PLATFORM_TELOSA || PLATFORM_TELOSB || PLATFORM_TMOTE || PLATFORM_INTELMOTE2 || PLATFORM_SHIMMER || PLATFORM_IRIS
+  FORWARD_PACKET_TIME = 7,
 #else
   FORWARD_PACKET_TIME = 32,
 #endif
 };
 
 enum {
-  SENDDONE_FAIL_OFFSET      =                       512,
-  SENDDONE_NOACK_OFFSET     = FORWARD_PACKET_TIME  << 2,
-  SENDDONE_OK_OFFSET        = FORWARD_PACKET_TIME  << 2,
-  LOOPY_OFFSET              = FORWARD_PACKET_TIME  << 4,
-  SENDDONE_FAIL_WINDOW      = SENDDONE_FAIL_OFFSET  - 1,
-  LOOPY_WINDOW              = LOOPY_OFFSET          - 1,
-  SENDDONE_NOACK_WINDOW     = SENDDONE_NOACK_OFFSET - 1,
-  SENDDONE_OK_WINDOW        = SENDDONE_OK_OFFSET    - 1,
+  SENDDONE_OK_OFFSET        = FORWARD_PACKET_TIME,
+  SENDDONE_OK_WINDOW        = FORWARD_PACKET_TIME,
+  SENDDONE_NOACK_OFFSET     = FORWARD_PACKET_TIME,
+  SENDDONE_NOACK_WINDOW     = FORWARD_PACKET_TIME,
+  SENDDONE_FAIL_OFFSET      = FORWARD_PACKET_TIME  << 2,
+  SENDDONE_FAIL_WINDOW      = SENDDONE_FAIL_OFFSET,
+  LOOPY_OFFSET              = FORWARD_PACKET_TIME  << 2,
+  LOOPY_WINDOW              = LOOPY_OFFSET,
   CONGESTED_WAIT_OFFSET     = FORWARD_PACKET_TIME  << 2,
-  CONGESTED_WAIT_WINDOW     = CONGESTED_WAIT_OFFSET - 1,
+  CONGESTED_WAIT_WINDOW     = CONGESTED_WAIT_OFFSET,
   NO_ROUTE_RETRY            = 10000
 };
 
index 65fe70086fa116590c30055e86caf6bf2c76a346..df59dfbbf355ca2e34774c8ad83fe5808f40118e 100644 (file)
@@ -274,9 +274,9 @@ implementation {
     }
   }
 
-  static void startRetxmitTimer(uint16_t mask, uint16_t offset) {
+  static void startRetxmitTimer(uint16_t window, uint16_t offset) {
     uint16_t r = call Random.rand16();
-    r &= mask;
+    r %= window;
     r += offset;
     call RetxmitTimer.startOneShot(r);
     dbg("Forwarder", "Rexmit timer will fire in %hu ms\n", r);
index 342f2f53d52360a21c53579416adb7a65a0bf6d4..f0ef1f60b6ab3a71ecf4bba28c7afdaf77fe7de7 100644 (file)
@@ -297,8 +297,8 @@ implementation {
             /* Compute this neighbor's path metric */
             linkEtx = evaluateEtx(call LinkEstimator.getLinkQuality(entry->neighbor));
             dbg("TreeRouting", 
-                "routingTable[%d]: neighbor: [id: %d parent: %d etx: %d]\n",  
-                i, entry->neighbor, entry->info.parent, linkEtx);
+                "routingTable[%d]: neighbor: [id: %d parent: %d etx: %d retx: %d]\n",  
+                i, entry->neighbor, entry->info.parent, linkEtx, entry->info.etx);
             pathEtx = linkEtx + entry->info.etx;
             /* Operations specific to the current parent */
             if (entry->neighbor == routeInfo.parent) {
@@ -321,6 +321,7 @@ implementation {
             }
             
             if (pathEtx < minEtx) {
+             dbg("TreeRouting", "   best is %d, setting to %d\n", pathEtx, entry->neighbor);
                 minEtx = pathEtx;
                 best = entry;
             }  
@@ -354,11 +355,17 @@ implementation {
                 call LinkEstimator.unpinNeighbor(routeInfo.parent);
                 call LinkEstimator.pinNeighbor(best->neighbor);
                 call LinkEstimator.clearDLQ(best->neighbor);
-                atomic {
+
+               atomic {
                     routeInfo.parent = best->neighbor;
                     routeInfo.etx = best->info.etx;
                     routeInfo.congested = best->info.congested;
                 }
+               /* If we follow the CTP paper this should be in here.
+               if (currentEtx - minEtx > 20) {
+                 call CtpInfo.triggerRouteUpdate();
+               }
+               */
             }
         }