[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/ctp CtpDebugMsg.h,
1.2, 1.3 CtpForwardingEngineP.nc, 1.5, 1.6 CtpP.nc, 1.2,
1.3 CtpRoutingEngineP.nc, 1.4, 1.5
Omprakash Gnawali
gnawali at users.sourceforge.net
Mon Jan 15 20:39:22 PST 2007
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv8892
Modified Files:
CtpDebugMsg.h CtpForwardingEngineP.nc CtpP.nc
CtpRoutingEngineP.nc
Log Message:
checking in Rodrigos changes
Index: CtpDebugMsg.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/CtpDebugMsg.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CtpDebugMsg.h 6 Nov 2006 11:57:16 -0000 1.2
--- CtpDebugMsg.h 16 Jan 2007 04:39:20 -0000 1.3
***************
*** 24,27 ****
--- 24,28 ----
NET_C_FE_GET_MSGPOOL_ERR = 0x53,
NET_C_FE_GET_QEPOOL_ERR = 0x54,
+ NET_C_FE_QUEUE_SIZE=0x55,
NET_C_FE_SENT_MSG = 0x20, //:app. send :msg uid, origin, next_hop
***************
*** 42,45 ****
--- 43,48 ----
// ECN cleared.
// arg=0 => timeout.
+ NET_C_FE_CONGESTED = 0x2E,
+
NET_C_TREE_NO_ROUTE = 0x30, //: :no args
NET_C_TREE_NEW_PARENT = 0x31, //: :parent_id, hopcount, metric
Index: CtpForwardingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/CtpForwardingEngineP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CtpForwardingEngineP.nc 13 Dec 2006 01:56:41 -0000 1.5
--- CtpForwardingEngineP.nc 16 Jan 2007 04:39:20 -0000 1.6
***************
*** 182,185 ****
--- 182,188 ----
bool parentCongested = FALSE;
+ /* Threshold for congestion */
+ uint8_t congestionThreshold;
+
/* Keeps track of whether the routing layer is running; if not,
* it will not send packets. */
***************
*** 235,238 ****
--- 238,242 ----
dbg("Forwarder", "clientPtrs[%hhu] = %p\n", i, clientPtrs[i]);
}
+ congestionThreshold = (call SendQueue.maxSize()) >> 1;
loopbackMsgPtr = &loopbackMsg;
lastParent = call AMPacket.address();
***************
*** 836,840 ****
// A simple predicate for now to determine congestion state of
// this node.
! bool congested = (call SendQueue.size() + 2 >= call SendQueue.maxSize()) ?
TRUE : FALSE;
return ((congested || clientCongested)?TRUE:FALSE);
--- 840,844 ----
// A simple predicate for now to determine congestion state of
// this node.
! bool congested = (call SendQueue.size() > congestionThreshold) ?
TRUE : FALSE;
return ((congested || clientCongested)?TRUE:FALSE);
Index: CtpP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/CtpP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CtpP.nc 6 Nov 2006 11:57:17 -0000 1.2
--- CtpP.nc 16 Jan 2007 04:39:20 -0000 1.3
***************
*** 91,95 ****
enum {
CLIENT_COUNT = uniqueCount(UQ_CTP_CLIENT),
! FORWARD_COUNT = 5,
TREE_ROUTING_TABLE_SIZE = 10,
QUEUE_SIZE = CLIENT_COUNT + FORWARD_COUNT,
--- 91,95 ----
enum {
CLIENT_COUNT = uniqueCount(UQ_CTP_CLIENT),
! FORWARD_COUNT = 12,
TREE_ROUTING_TABLE_SIZE = 10,
QUEUE_SIZE = CLIENT_COUNT + FORWARD_COUNT,
Index: CtpRoutingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/CtpRoutingEngineP.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CtpRoutingEngineP.nc 12 Dec 2006 18:23:29 -0000 1.4
--- CtpRoutingEngineP.nc 16 Jan 2007 04:39:20 -0000 1.5
***************
*** 201,205 ****
command error_t Init.init() {
uint8_t maxLength;
! routeUpdateTimerCount = 0;
radioOn = FALSE;
running = FALSE;
--- 201,205 ----
command error_t Init.init() {
uint8_t maxLength;
! routeUpdateTimerCount = 0;
radioOn = FALSE;
running = FALSE;
***************
*** 266,270 ****
* from neighbor beacons. Two things can cause this info to change:
* neighbor beacons, changes in link estimates, including neighbor eviction */
- /* TODO: take into account congested state to select parents */
task void updateRouteTask() {
uint8_t i;
--- 266,269 ----
***************
*** 314,317 ****
--- 313,319 ----
continue;
}
+ /* Ignore links that are congested */
+ if (entry->info.congested)
+ continue;
/* Ignore links that are bad */
if (!passLinkEtxThreshold(linkEtx)) {
***************
*** 329,334 ****
--- 331,347 ----
/* Now choose between the current parent and the best neighbor */
+ /* Requires that:
+ 1. at least another neighbor was found with ok quality and not congested
+ 2. the current parent is congested and the other best route is at least as good
+ 3. or the current parent is not congested and the neighbor quality is better by
+ the PARENT_SWITCH_THRESHOLD.
+ Note: if our parent is congested, in order to avoid forming loops, we try to select
+ a node which is not a descendent of our parent. routeInfo.ext is our parent's
+ etx. Any descendent will be at least that + 10 (1 hop), so we restrict the
+ selection to be less than that.
+ */
if (minEtx != MAX_METRIC) {
if (currentEtx == MAX_METRIC ||
+ (routeInfo.congested && (minEtx < (routeInfo.etx + 10))) ||
minEtx + PARENT_SWITCH_THRESHOLD < currentEtx) {
// routeInfo.metric will not store the composed metric.
***************
*** 467,470 ****
--- 480,484 ----
from = call LinkSrcPacket.getSrc(msg);
rcvBeacon = (ctp_routing_header_t*)payload;
+
congested = call CtpRoutingPacket.getOption(msg, CTP_OPT_ECN);
***************
*** 564,579 ****
command void CtpInfo.setNeighborCongested(am_addr_t n, bool congested) {
uint8_t idx;
idx = routingTableFind(n);
if (idx < routingTableActive) {
routingTable[idx].info.congested = congested;
}
! /* TODO: (this only makes sense if routeUpdateTask takes congestion into
! * account for selecting routes.)
! * if (routeInfo.congested && !congested)
! * post routeUpdateTask()
! * else if (routeInfo.parent == n && congested) {
! * post routeUpdateTask()
! *
! */
}
--- 578,591 ----
command void CtpInfo.setNeighborCongested(am_addr_t n, bool congested) {
uint8_t idx;
+ if (ECNOff)
+ return;
idx = routingTableFind(n);
if (idx < routingTableActive) {
routingTable[idx].info.congested = congested;
}
! if (routeInfo.congested && !congested)
! post updateRouteTask();
! else if (routeInfo.parent == n && congested)
! post updateRouteTask();
}
***************
*** 680,684 ****
routingTable[idx].info.parent = parent;
routingTable[idx].info.etx = etx;
! routingTable[idx].info.haveHeard = 1;
routingTableActive++;
}
--- 692,697 ----
routingTable[idx].info.parent = parent;
routingTable[idx].info.etx = etx;
! routingTable[idx].info.haveHeard = 1;
! routingTable[idx].info.congested = FALSE;
routingTableActive++;
}
***************
*** 693,697 ****
routingTable[idx].info.parent = parent;
routingTable[idx].info.etx = etx;
! routingTable[idx].info.haveHeard = 1;
}
dbg("TreeRouting", "%s OK, updated entry\n", __FUNCTION__);
--- 706,710 ----
routingTable[idx].info.parent = parent;
routingTable[idx].info.etx = etx;
! routingTable[idx].info.haveHeard = 1;
}
dbg("TreeRouting", "%s OK, updated entry\n", __FUNCTION__);
More information about the Tinyos-2-commits
mailing list