[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/ctp CtpForwardingEngineP.nc, 1.11, 1.12 CtpP.nc, 1.7, 1.8 CtpRoutingEngineP.nc, 1.13, 1.14

Omprakash Gnawali gnawali at users.sourceforge.net
Sun Apr 27 21:28:39 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23122

Modified Files:
	CtpForwardingEngineP.nc CtpP.nc CtpRoutingEngineP.nc 
Log Message:
properly use Trickle to control beacon rates

Index: CtpForwardingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** CtpForwardingEngineP.nc	9 Feb 2008 05:45:10 -0000	1.11
--- CtpForwardingEngineP.nc	28 Apr 2008 04:28:36 -0000	1.12
***************
*** 717,723 ****
  
      // NB: at this point, we have a resource acquistion problem.
!     // Trigger an immediate route update, log the event, and drop the
      // packet on the floor.
!     call CtpInfo.triggerImmediateRouteUpdate();
      call CollectionDebug.logEvent(NET_C_FE_SEND_QUEUE_FULL);
      return m;
--- 717,723 ----
  
      // NB: at this point, we have a resource acquistion problem.
!     // Log the event, and drop the
      // packet on the floor.
! 
      call CollectionDebug.logEvent(NET_C_FE_SEND_QUEUE_FULL);
      return m;
***************
*** 802,807 ****
      // Check for the pull bit (P) [TEP123] and act accordingly.  This
      // check is made for all packets, not just ones addressed to us.
!     if (call CtpPacket.option(msg, CTP_OPT_PULL))
        call CtpInfo.triggerRouteUpdate();
  
      call CtpInfo.setNeighborCongested(proximalSrc, call CtpPacket.option(msg, CTP_OPT_ECN));
--- 802,808 ----
      // Check for the pull bit (P) [TEP123] and act accordingly.  This
      // check is made for all packets, not just ones addressed to us.
!     if (call CtpPacket.option(msg, CTP_OPT_PULL)) {
        call CtpInfo.triggerRouteUpdate();
+     }
  
      call CtpInfo.setNeighborCongested(proximalSrc, call CtpPacket.option(msg, CTP_OPT_ECN));

Index: CtpP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/CtpP.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** CtpP.nc	25 Sep 2007 19:08:58 -0000	1.7
--- CtpP.nc	28 Apr 2008 04:28:36 -0000	1.8
***************
*** 132,136 ****
    components new AMSnooperC(AM_CTP_DATA);
  
!   components new CtpRoutingEngineP(TREE_ROUTING_TABLE_SIZE, 10, 1024) as Router;
    StdControl = Router;
    StdControl = Estimator;
--- 132,137 ----
    components new AMSnooperC(AM_CTP_DATA);
  
!   components new CtpRoutingEngineP(TREE_ROUTING_TABLE_SIZE, 128, 512000) as Router;
! 
    StdControl = Router;
    StdControl = Estimator;

Index: CtpRoutingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** CtpRoutingEngineP.nc	5 Dec 2007 22:41:25 -0000	1.13
--- CtpRoutingEngineP.nc	28 Apr 2008 04:28:36 -0000	1.14
***************
*** 94,98 ****
   */
  
! generic module CtpRoutingEngineP(uint8_t routingTableSize, uint16_t minInterval, uint16_t maxInterval) {
      provides {
          interface UnicastNameFreeRouting as Routing;
--- 94,98 ----
   */
  
! generic module CtpRoutingEngineP(uint8_t routingTableSize, uint32_t minInterval, uint32_t maxInterval) {
      provides {
          interface UnicastNameFreeRouting as Routing;
***************
*** 165,169 ****
      error_t routingTableEvict(am_addr_t neighbor);
  
!     uint16_t currentInterval = minInterval;
      uint32_t t; 
      bool tHasPassed;
--- 165,169 ----
      error_t routingTableEvict(am_addr_t neighbor);
  
!     uint32_t currentInterval = minInterval;
      uint32_t t; 
      bool tHasPassed;
***************
*** 171,175 ****
      void chooseAdvertiseTime() {
         t = currentInterval;
!        t *= 512; // * 1024 / 2
         t += call Random.rand32() % t;
         tHasPassed = FALSE;
--- 171,175 ----
      void chooseAdvertiseTime() {
         t = currentInterval;
!        t /= 2;
         t += call Random.rand32() % t;
         tHasPassed = FALSE;
***************
*** 184,193 ****
  
      void decayInterval() {
-       if (!state_is_root) {
          currentInterval *= 2;
          if (currentInterval > maxInterval) {
            currentInterval = maxInterval;
          }
-       }
        chooseAdvertiseTime();
      }
--- 184,191 ----
***************
*** 195,202 ****
      void remainingInterval() {
         uint32_t remaining = currentInterval;
-        remaining *= 1024;
         remaining -= t;
         tHasPassed = TRUE;
!        call BeaconTimer.startPeriodic(t);
      }
  
--- 193,199 ----
      void remainingInterval() {
         uint32_t remaining = currentInterval;
         remaining -= t;
         tHasPassed = TRUE;
!        call BeaconTimer.startOneShot(remaining);
      }
  
***************
*** 352,358 ****
                  //            ii. when choosing a next hop
                  parentChanges++;
!                 resetInterval();
                  dbg("TreeRouting","Changed parent. from %d to %d\n", routeInfo.parent, best->neighbor);
!                 call CollectionDebug.logEventRoute(NET_C_TREE_NEW_PARENT, best->neighbor, 0, best->info.etx); 
                  call LinkEstimator.unpinNeighbor(routeInfo.parent);
                  call LinkEstimator.pinNeighbor(best->neighbor);
--- 349,355 ----
                  //            ii. when choosing a next hop
                  parentChanges++;
! 
                  dbg("TreeRouting","Changed parent. from %d to %d\n", routeInfo.parent, best->neighbor);
!                 call CollectionDebug.logEventDbg(NET_C_TREE_NEW_PARENT, best->neighbor, best->info.etx, minEtx);
                  call LinkEstimator.unpinNeighbor(routeInfo.parent);
                  call LinkEstimator.pinNeighbor(best->neighbor);
***************
*** 508,512 ****
                resetInterval();
          }
-         //post updateRouteTask();
          return msg;
      }
--- 505,508 ----
***************
*** 563,584 ****
  
      command void CtpInfo.triggerRouteUpdate() {
!       // Random time in interval 64-127ms
!       uint16_t beaconDelay = call Random.rand16();
!       beaconDelay &= 0x3f; 
!       beaconDelay += 64;
!       if (call BeaconTimer.gett0() + call BeaconTimer.getdt() -
!                                      call BeaconTimer.getNow() >= beaconDelay) {
!          call BeaconTimer.stop();
!          call BeaconTimer.startOneShot(beaconDelay);
!         }
       }
  
      command void CtpInfo.triggerImmediateRouteUpdate() {
!       // Random time in interval 4-11ms
!       uint16_t beaconDelay = call Random.rand16();
!       beaconDelay &= 0x7; 
!       beaconDelay += 4;
!       call BeaconTimer.stop();
!       call BeaconTimer.startOneShot(beaconDelay);
      }
  
--- 559,567 ----
  
      command void CtpInfo.triggerRouteUpdate() {
!       resetInterval();
       }
  
      command void CtpInfo.triggerImmediateRouteUpdate() {
!       resetInterval();
      }
  



More information about the Tinyos-2-commits mailing list