[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/collection
CollectionDebugMsg.h, 1.1.2.7, 1.1.2.8 CollectionPacket.nc,
1.1.2.2, 1.1.2.3 ForwardingEngine.h, 1.1.2.7,
1.1.2.8 ForwardingEngineP.nc, 1.1.2.28,
1.1.2.29 LinkEstimator.h, 1.1.2.4, 1.1.2.5 LinkEstimator.nc,
1.1.2.6, 1.1.2.7 LinkEstimatorP.nc, 1.1.2.19,
1.1.2.20 TreeCollection.h, 1.1.2.2, 1.1.2.3 TreeCollectionC.nc,
1.1.2.17, 1.1.2.18 TreeRouting.h, 1.1.2.2,
1.1.2.3 TreeRoutingEngineP.nc, 1.1.2.15,
1.1.2.16 TreeRoutingInspect.nc, 1.1.2.2, 1.1.2.3
Rodrigo Fonseca
rfonseca76 at users.sourceforge.net
Tue Jun 20 14:16:31 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv25156
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
CollectionDebugMsg.h CollectionPacket.nc ForwardingEngine.h
ForwardingEngineP.nc LinkEstimator.h LinkEstimator.nc
LinkEstimatorP.nc TreeCollection.h TreeCollectionC.nc
TreeRouting.h TreeRoutingEngineP.nc TreeRoutingInspect.nc
Log Message:
Reverted head to net2-beta2-test7
Index: CollectionDebugMsg.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/CollectionDebugMsg.h,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** CollectionDebugMsg.h 20 Jun 2006 02:36:54 -0000 1.1.2.7
--- CollectionDebugMsg.h 20 Jun 2006 21:16:28 -0000 1.1.2.8
***************
*** 14,26 ****
NET_C_FE_QENTRY_POOL_EMPTY = 0x16,
NET_C_FE_SUBSEND_SIZE = 0x17,
- NET_C_FE_MESSAGE_POOL_ERR = 0x18,
- NET_C_FE_QE_POOL_ERR = 0x19,
! NET_C_FE_SENT_MSG = 0x20, //:app. send :next hop, local addr, origin
! NET_C_FE_RCV_MSG = 0x21, //:receive msg :last hop, local addr, origin
! NET_C_FE_FWD_MSG = 0x22, //:fwd msg :next hop, local addr, origin
NET_C_FE_SENDDONE_FAIL = 0x24,
NET_C_FE_SENDDONE_WAITACK = 0x25,
NET_C_TREE_NO_ROUTE = 0x30, //: :no args
NET_C_TREE_NEW_PARENT = 0x31, //: :parent_id, hopcount, metric
--- 14,26 ----
NET_C_FE_QENTRY_POOL_EMPTY = 0x16,
NET_C_FE_SUBSEND_SIZE = 0x17,
! NET_C_FE_SENT_MSG = 0x20, //:app. send :msg uid, origin, next_hop
! NET_C_FE_RCV_MSG = 0x21, //:next hop receive:msg uid, origin, last_hop
! NET_C_FE_FWD_MSG = 0x22, //:fwd msg :msg uid, origin, next_hop
! NET_C_FE_DST_MSG = 0x23, //:base app. recv :msg_uid, origin, last_hop
NET_C_FE_SENDDONE_FAIL = 0x24,
NET_C_FE_SENDDONE_WAITACK = 0x25,
+
NET_C_TREE_NO_ROUTE = 0x30, //: :no args
NET_C_TREE_NEW_PARENT = 0x31, //: :parent_id, hopcount, metric
***************
*** 32,42 ****
NET_C_DBG_2 = 0x41, //:any :uint16_t a, b, c
NET_C_DBG_3 = 0x42, //:any :uint16_t a, b, c
-
- //NET_C_FE_DST_MSG = 0x23, //:base app. recv :msg_uid, origin, last_hop
- };
-
- enum {
- NET_C_POOL_BAD_GET = 0xBE,
- NET_C_POOL_BAD_PUT = 0xEF,
};
--- 32,35 ----
Index: CollectionPacket.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/CollectionPacket.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** CollectionPacket.nc 19 Jun 2006 21:22:04 -0000 1.1.2.2
--- CollectionPacket.nc 20 Jun 2006 21:16:28 -0000 1.1.2.3
***************
*** 40,45 ****
command uint8_t getControl(message_t* msg);
command void setControl(message_t* msg, uint8_t control);
-
- command uint8_t getGradient(message_t* msg);
- command void setGradient(message_t* msg, uint8_t control);
}
--- 40,42 ----
Index: ForwardingEngine.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/ForwardingEngine.h,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** ForwardingEngine.h 20 Jun 2006 02:36:54 -0000 1.1.2.7
--- ForwardingEngine.h 20 Jun 2006 21:16:28 -0000 1.1.2.8
***************
*** 8,14 ****
nx_uint8_t control;
nx_am_addr_t origin;
! nx_am_addr_t sender;
! nx_uint8_t collectId;
! nx_uint8_t gradient;
} network_header_t;
--- 8,12 ----
nx_uint8_t control;
nx_am_addr_t origin;
! nx_uint8_t collectid;
} network_header_t;
Index: ForwardingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/ForwardingEngineP.nc,v
retrieving revision 1.1.2.28
retrieving revision 1.1.2.29
diff -C2 -d -r1.1.2.28 -r1.1.2.29
*** ForwardingEngineP.nc 20 Jun 2006 02:36:54 -0000 1.1.2.28
--- ForwardingEngineP.nc 20 Jun 2006 21:16:28 -0000 1.1.2.29
***************
*** 59,64 ****
interface AMPacket;
interface CollectionDebug;
- interface TreeRoutingInspect;
- interface LinkEstimator;
}
}
--- 59,62 ----
***************
*** 82,114 ****
bool sending = FALSE;
! /* Keeps track of how many consecutive unacknowledged transmissions
! we have observed. If unackCount >= (3 * linkETX), then we
! tell the routing engine that the link has a problem. */
! uint8_t unackedCount = 0;
!
! /* Keep track of the last parent address we sent to, so that
! unacked packets to an old parent are not incorrectly attributed
! to a new parent. */
! am_addr_t lastParent;
- /* Per collection send client state: each one gets an
- entry in the send queue. */
enum {
CLIENT_COUNT = uniqueCount(UQ_COLLECTION_CLIENT)
};
!
fe_queue_entry_t clientEntries[CLIENT_COUNT];
fe_queue_entry_t* clientPtrs[CLIENT_COUNT];
- /* The loopback message is used when a root node
- sends a packet to the collection layer. We need to
- signal a receive, but because the send path expects to
- be able to get its packet back, we need to copy the
- packet in a receive buffer and then do the standard
- buffer swapping. */
message_t loopbackMsg;
message_t* loopbackMsgPtr;
-
command error_t Init.init() {
int i;
--- 80,96 ----
bool sending = FALSE;
! /* Keeps track of whether we are currently sending to the UART a
! * debug message. */
enum {
CLIENT_COUNT = uniqueCount(UQ_COLLECTION_CLIENT)
};
!
fe_queue_entry_t clientEntries[CLIENT_COUNT];
fe_queue_entry_t* clientPtrs[CLIENT_COUNT];
message_t loopbackMsg;
message_t* loopbackMsgPtr;
command error_t Init.init() {
int i;
***************
*** 118,123 ****
}
loopbackMsgPtr = &loopbackMsg;
- unackedCount = 0;
- lastParent = call AMPacket.address();
return SUCCESS;
}
--- 100,103 ----
***************
*** 176,181 ****
hdr = getHeader(msg);
hdr->origin = TOS_NODE_ID;
! hdr->collectId = call CollectionId.fetch[client]();
!
if (clientPtrs[client] == NULL) {
dbg("Forwarder", "%s: send failed as client is busy.\n", __FUNCTION__);
--- 156,161 ----
hdr = getHeader(msg);
hdr->origin = TOS_NODE_ID;
! hdr->collectid = call CollectionId.fetch[client]();
!
if (clientPtrs[client] == NULL) {
dbg("Forwarder", "%s: send failed as client is busy.\n", __FUNCTION__);
***************
*** 247,268 ****
uint8_t payloadLen = call SubPacket.payloadLength(qe->msg);
am_addr_t dest = call UnicastNameFreeRouting.nextHop();
- uint16_t gradient;
- /* If our current parent is not the same as the last parent
- we sent do, then reset the count of unacked packets: don't
- penalize a new parent for the failures of a prior one.*/
- if (dest != lastParent) {
- unackedCount = 0;
- lastParent = dest;
- }
-
dbg("Forwarder", "Sending queue entry %p\n", qe);
-
if (call RootControl.isRoot()) {
! collection_id_t collectId = getHeader(qe->msg)->collectId;
memcpy(loopbackMsgPtr, qe->msg, sizeof(message_t));
ackPending = FALSE;
dbg("Forwarder", "%s: I'm a root, so loopback and signal receive.\n", __FUNCTION__);
! loopbackMsgPtr = signal Receive.receive[collectId](loopbackMsgPtr,
call Packet.getPayload(loopbackMsgPtr, NULL),
call Packet.payloadLength(loopbackMsgPtr));
--- 227,238 ----
uint8_t payloadLen = call SubPacket.payloadLength(qe->msg);
am_addr_t dest = call UnicastNameFreeRouting.nextHop();
dbg("Forwarder", "Sending queue entry %p\n", qe);
if (call RootControl.isRoot()) {
! collection_id_t collectid = getHeader(qe->msg)->collectid;
memcpy(loopbackMsgPtr, qe->msg, sizeof(message_t));
ackPending = FALSE;
dbg("Forwarder", "%s: I'm a root, so loopback and signal receive.\n", __FUNCTION__);
! loopbackMsgPtr = signal Receive.receive[collectid](loopbackMsgPtr,
call Packet.getPayload(loopbackMsgPtr, NULL),
call Packet.payloadLength(loopbackMsgPtr));
***************
*** 270,278 ****
return;
}
- call TreeRoutingInspect.getMetric(&gradient);
ackPending = (call PacketAcknowledgements.requestAck(qe->msg) == SUCCESS);
! getHeader(qe->msg)->gradient = gradient & 0xff;
! getHeader(qe->msg)->sender = TOS_NODE_ID;
eval = call SubSend.send(dest, qe->msg, payloadLen);
if (eval == SUCCESS) {
--- 240,246 ----
return;
}
ackPending = (call PacketAcknowledgements.requestAck(qe->msg) == SUCCESS);
!
eval = call SubSend.send(dest, qe->msg, payloadLen);
if (eval == SUCCESS) {
***************
*** 310,316 ****
dbg("Forwarder", "%s: subsend failed from ESIZE: truncate packet.\n", __FUNCTION__);
call Packet.setPayloadLength(qe->msg, call Packet.maxPayloadLength());
! if (!call RetxmitTimer.isRunning()) {
! post sendTask();
! }
call CollectionDebug.logEvent(NET_C_FE_SUBSEND_SIZE);
}
--- 278,282 ----
dbg("Forwarder", "%s: subsend failed from ESIZE: truncate packet.\n", __FUNCTION__);
call Packet.setPayloadLength(qe->msg, call Packet.maxPayloadLength());
! post sendTask();
call CollectionDebug.logEvent(NET_C_FE_SUBSEND_SIZE);
}
***************
*** 350,358 ****
r += 128;
call RetxmitTimer.startOneShot(r);
- unackedCount++;
- if (unackedCount >= ((3 * call LinkEstimator.getLinkQuality(call AMPacket.destination(qe->msg))) / 10)) {
- call TreeRoutingInspect.reportBadRoute(call AMPacket.destination(qe->msg));
- unackedCount = 0;
- }
dbg("Forwarder", "%s: not acked, retry in %hu ms\n", __FUNCTION__, r);
}
--- 316,319 ----
***************
*** 361,366 ****
uint8_t client = qe->client;
dbg("Forwarder", "%s: our packet for client %hhu, remove %p from queue\n", __FUNCTION__, client, qe);
! call CollectionDebug.logEventRoute(NET_C_FE_SENT_MSG, call
! AMPacket.destination(msg), TOS_NODE_ID, getHeader(qe->msg)->origin);
clientPtrs[client] = qe;
hdr = getHeader(qe->msg);
--- 322,326 ----
uint8_t client = qe->client;
dbg("Forwarder", "%s: our packet for client %hhu, remove %p from queue\n", __FUNCTION__, client, qe);
! call CollectionDebug.logEventRoute(NET_C_FE_SENT_MSG, error, TOS_NODE_ID, call AMPacket.destination(msg));
clientPtrs[client] = qe;
hdr = getHeader(qe->msg);
***************
*** 368,403 ****
signal Send.sendDone[client](msg, SUCCESS);
sending = FALSE;
! unackedCount = 0;
! if (!call RetxmitTimer.isRunning()) {
! post sendTask();
! }
}
else if (call MessagePool.size() < call MessagePool.maxSize()) {
// A successfully forwarded packet.
dbg("Forwarder,Route", "%s: successfully forwarded packet (client: %hhu), message pool is %hhu/%hhu.\n", __FUNCTION__, qe->client, call MessagePool.size(), call MessagePool.maxSize());
! call CollectionDebug.logEventRoute(NET_C_FE_FWD_MSG,
! call AMPacket.destination(msg), TOS_NODE_ID,
! getHeader(qe->msg)->origin);
!
call SendQueue.dequeue();
! if (call MessagePool.put(qe->msg) != SUCCESS)
! call CollectionDebug.logEventSimple(NET_C_FE_MESSAGE_POOL_ERR,
! NET_C_POOL_BAD_PUT);
! if (call QEntryPool.put(qe) != SUCCESS)
! call CollectionDebug.logEventSimple(NET_C_FE_QE_POOL_ERR,
! NET_C_POOL_BAD_PUT);
sending = FALSE;
! unackedCount = 0;
! if (!call RetxmitTimer.isRunning()) {
! post sendTask();
! }
}
else {
! // Size of the message pool is maximum. It's a forwarded
! // packet, but there's no room the pool; someone has
! // double-stored a pointer somewhere and we have nowhere to put
! // this, so we have to leak it.
! dbg("Forwarder", "%s: BUG: have a pool entry, but pool is full, client is %hhu.\n", __FUNCTION__, qe->client);
! sendDoneBug();
}
}
--- 328,350 ----
signal Send.sendDone[client](msg, SUCCESS);
sending = FALSE;
! post sendTask();
}
else if (call MessagePool.size() < call MessagePool.maxSize()) {
// A successfully forwarded packet.
dbg("Forwarder,Route", "%s: successfully forwarded packet (client: %hhu), message pool is %hhu/%hhu.\n", __FUNCTION__, qe->client, call MessagePool.size(), call MessagePool.maxSize());
! call CollectionDebug.logEventRoute(NET_C_FE_FWD_MSG, error, TOS_NODE_ID, call AMPacket.destination(msg));
call SendQueue.dequeue();
! call MessagePool.put(qe->msg);
! //qe->msg = NULL;
! //qe->client = 255;
! call QEntryPool.put(qe);
sending = FALSE;
! post sendTask();
}
else {
! dbg("Forwarder", "%s: BUG: we have a pool entry, but the pool is full, client is %hhu.\n", __FUNCTION__, qe->client);
! sendDoneBug(); // It's a forwarded packet, but there's no room the pool;
! // someone has double-stored a pointer somewhere and we have nowhere
! // to put this, so we have to leak it...
}
}
***************
*** 416,466 ****
}
else {
! message_t* newMsg;
! fe_queue_entry_t *qe;
! uint16_t gradient;
! if (call TreeRoutingInspect.getMetric(&gradient) != SUCCESS) {
! return m;
! }
- newMsg = call MessagePool.get();
- if (newMsg == NULL) {
- call CollectionDebug.logEventSimple(NET_C_FE_MESSAGE_POOL_ERR,
- NET_C_POOL_BAD_GET);
- return m;
- }
- qe = call QEntryPool.get();
- if (qe == NULL) {
- call CollectionDebug.logEventSimple(NET_C_FE_QE_POOL_ERR,
- NET_C_POOL_BAD_GET);
- call MessagePool.put(newMsg);
- return m;
- }
- if (call CollectionPacket.getGradient(m) < gradient) {
- uint16_t r = call Random.rand16();
- r &= 0x7f;
- r += 128;
- dbg("Forwarder", "%s: Asked to forward a packet from a node that is shallower in the tree (%hu < %hu). Back off, and send a beacon.\n", __FUNCTION__, call CollectionPacket.getGradient(m), gradient);
- call TreeRoutingInspect.triggerRouteUpdate();
- call RetxmitTimer.startOneShot(r);
- }
-
qe->msg = m;
qe->client = 0xff;
if (call SendQueue.enqueue(qe) == SUCCESS) {
! dbg("Forwarder,Route",
! "%s forwarding packet %p with queue size %hhu\n",
! __FUNCTION__, m, call SendQueue.size());
! if (!call RetxmitTimer.isRunning())
! post sendTask();
! return newMsg;
! } else {
! // SendQueue refused to enqueue; release resources
! if (call MessagePool.put(newMsg) != SUCCESS)
! call CollectionDebug.logEventSimple(NET_C_FE_MESSAGE_POOL_ERR,
! NET_C_POOL_BAD_PUT);
! if (call QEntryPool.put(qe) != SUCCESS)
! call CollectionDebug.logEventSimple(NET_C_FE_QE_POOL_ERR,
! NET_C_POOL_BAD_PUT);
}
}
--- 363,382 ----
}
else {
! message_t* newMsg = call MessagePool.get();
! fe_queue_entry_t *qe = call QEntryPool.get();
qe->msg = m;
qe->client = 0xff;
if (call SendQueue.enqueue(qe) == SUCCESS) {
! dbg("Forwarder,Route", "%s forwarding packet %p with queue size %hhu\n", __FUNCTION__, m, call SendQueue.size());
! if (!call RetxmitTimer.isRunning()) {
! post sendTask();
! }
! return newMsg;
! }
! else {
! call MessagePool.put(newMsg);
! call QEntryPool.put(qe);
}
}
***************
*** 478,485 ****
network_header_t* hdr = getHeader(msg);
uint8_t netlen;
! collection_id_t collectId;
! collectId = hdr->collectId;
! call CollectionDebug.logEventRoute(NET_C_FE_RCV_MSG, hdr->sender,
! TOS_NODE_ID, hdr->origin);
if (len > call SubSend.maxPayloadLength()) {
return msg;
--- 394,400 ----
network_header_t* hdr = getHeader(msg);
uint8_t netlen;
! collection_id_t collectid;
! collectid = hdr->collectid;
! call CollectionDebug.logEvent(NET_C_FE_RCV_MSG);
if (len > call SubSend.maxPayloadLength()) {
return msg;
***************
*** 487,496 ****
// If I'm the root, signal receive.
else if (call RootControl.isRoot())
! return signal Receive.receive[collectId](msg,
call Packet.getPayload(msg, &netlen),
call Packet.payloadLength(msg));
// I'm on the routing path and Intercept indicates that I
// should not forward the packet.
! else if (!signal Intercept.forward[collectId](msg,
call Packet.getPayload(msg, &netlen),
call Packet.payloadLength(msg)))
--- 402,411 ----
// If I'm the root, signal receive.
else if (call RootControl.isRoot())
! return signal Receive.receive[collectid](msg,
call Packet.getPayload(msg, &netlen),
call Packet.payloadLength(msg));
// I'm on the routing path and Intercept indicates that I
// should not forward the packet.
! else if (!signal Intercept.forward[collectid](msg,
call Packet.getPayload(msg, &netlen),
call Packet.payloadLength(msg)))
***************
*** 524,528 ****
SubSnoop.receive(message_t* msg, void *payload, uint8_t len) {
network_header_t* hdr = getHeader(msg);
! return signal Snoop.receive[hdr->collectId] (msg, (void *)(hdr + 1),
len - sizeof(network_header_t));
}
--- 439,443 ----
SubSnoop.receive(message_t* msg, void *payload, uint8_t len) {
network_header_t* hdr = getHeader(msg);
! return signal Snoop.receive[hdr->collectid] (msg, (void *)(hdr + 1),
len - sizeof(network_header_t));
}
***************
*** 566,574 ****
command uint8_t CollectionPacket.getCollectionID(message_t* msg) {
! return getHeader(msg)->collectId;
}
command void CollectionPacket.setCollectionID(message_t* msg, uint8_t id) {
! getHeader(msg)->collectId = id;
}
--- 481,489 ----
command uint8_t CollectionPacket.getCollectionID(message_t* msg) {
! return getHeader(msg)->collectid;
}
command void CollectionPacket.setCollectionID(message_t* msg, uint8_t id) {
! getHeader(msg)->collectid = id;
}
***************
*** 581,593 ****
}
- command uint8_t CollectionPacket.getGradient(message_t* msg) {
- return getHeader(msg)->gradient;
- }
-
- command void CollectionPacket.setGradient(message_t* msg, uint8_t gradient) {
- getHeader(msg)->gradient = gradient;
- }
-
- event void LinkEstimator.evicted(am_addr_t addr) {}
default event void
--- 496,499 ----
***************
*** 596,600 ****
default event bool
! Intercept.forward[collection_id_t collectId](message_t* msg, void* payload,
uint16_t len) {
return TRUE;
--- 502,506 ----
default event bool
! Intercept.forward[collection_id_t collectid](message_t* msg, void* payload,
uint16_t len) {
return TRUE;
***************
*** 602,606 ****
default event message_t *
! Receive.receive[collection_id_t collectId](message_t *msg, void *payload,
uint8_t len) {
return msg;
--- 508,512 ----
default event message_t *
! Receive.receive[collection_id_t collectid](message_t *msg, void *payload,
uint8_t len) {
return msg;
***************
*** 608,612 ****
default event message_t *
! Snoop.receive[collection_id_t collectId](message_t *msg, void *payload,
uint8_t len) {
return msg;
--- 514,518 ----
default event message_t *
! Snoop.receive[collection_id_t collectid](message_t *msg, void *payload,
uint8_t len) {
return msg;
Index: LinkEstimator.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/LinkEstimator.h,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** LinkEstimator.h 20 Jun 2006 17:26:30 -0000 1.1.2.4
--- LinkEstimator.h 20 Jun 2006 21:16:28 -0000 1.1.2.5
***************
*** 25,30 ****
*/
- #ifndef LINK_ESITIMATOR_H
- #define LINK_ESITIMATOR_H
/*
@ author Omprakash Gnawali
--- 25,28 ----
***************
*** 81,90 ****
// Flag to indicate that this link has received the
// first sequence number
! INIT_ENTRY = 0x4,
! // The upper layer has said this link seems bad
! PROBLEM_ENTRY = 0x8,
! // The upper layer has requested that this link be pinned
! // Useful if we don't want to lose the root from the table
! PINNED_ENTRY = 0x10
};
--- 79,83 ----
// Flag to indicate that this link has received the
// first sequence number
! INIT_ENTRY = 0x4
};
***************
*** 104,106 ****
- #endif
--- 97,98 ----
Index: LinkEstimator.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/LinkEstimator.nc,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** LinkEstimator.nc 20 Jun 2006 16:18:08 -0000 1.1.2.6
--- LinkEstimator.nc 20 Jun 2006 21:16:28 -0000 1.1.2.7
***************
*** 47,59 ****
command error_t insertNeighbor(am_addr_t neighbor);
- /* pin a neighbor so that it does not get evicted */
- command error_t pinNeighbor(am_addr_t neighbor);
-
- /* pin a neighbor so that it does not get evicted */
- command error_t unpinNeighbor(am_addr_t neighbor);
-
- /* mark that the upper layer has a problem with this link */
- command error_t reportBadLink(am_addr_t neighbor);
-
/* signal when this neighbor is evicted from the neighbor table */
event void evicted(am_addr_t neighbor);
--- 47,50 ----
Index: LinkEstimatorP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/LinkEstimatorP.nc,v
retrieving revision 1.1.2.19
retrieving revision 1.1.2.20
diff -C2 -d -r1.1.2.19 -r1.1.2.20
*** LinkEstimatorP.nc 20 Jun 2006 17:26:30 -0000 1.1.2.19
--- LinkEstimatorP.nc 20 Jun 2006 21:16:28 -0000 1.1.2.20
***************
*** 223,230 ****
continue;
}
- if (NeighborTable[i].flags & PINNED_ENTRY) {
- dbg("LI", "Pinned entry, so continuing\n");
- continue;
- }
thisQuality = NeighborTable[i].inquality;
if (thisQuality < worstQuality) {
--- 223,226 ----
***************
*** 257,270 ****
uint8_t packetGap;
- // Clear the PROBLEM_ENTRY flag when we receive an
- // update
- NeighborTable[idx].flags &= ~PROBLEM_ENTRY;
-
if (NeighborTable[idx].flags & INIT_ENTRY) {
dbg("LI", "Init entry update\n");
NeighborTable[idx].lastseq = seq;
! NeighborTable[idx].flags &= ~INIT_ENTRY;
}
!
packetGap = seq - NeighborTable[idx].lastseq;
dbg("LI", "updateNeighborEntryIdx: prevseq %d, curseq %d, gap %d\n",
--- 253,262 ----
uint8_t packetGap;
if (NeighborTable[idx].flags & INIT_ENTRY) {
dbg("LI", "Init entry update\n");
NeighborTable[idx].lastseq = seq;
! NeighborTable[idx].flags ^= INIT_ENTRY;
}
!
packetGap = seq - NeighborTable[idx].lastseq;
dbg("LI", "updateNeighborEntryIdx: prevseq %d, curseq %d, gap %d\n",
***************
*** 466,474 ****
if (idx == INVALID_RVAL) {
return INFINITY;
! }
! // else if (NeighborTable[idx].flags & PROBLEM_ENTRY) {
! // return INFINITY;
! // }
! else {
return computeBidirEETX(NeighborTable[idx].inquality,
NeighborTable[idx].outquality);
--- 458,462 ----
if (idx == INVALID_RVAL) {
return INFINITY;
! } else {
return computeBidirEETX(NeighborTable[idx].inquality,
NeighborTable[idx].outquality);
***************
*** 527,561 ****
}
- // pin a neighbor so that it does not get evicted */
- command error_t LinkEstimator.pinNeighbor(am_addr_t neighbor) {
- uint8_t nidx = findIdx(neighbor);
- if (nidx == INVALID_RVAL) {
- return FAIL;
- }
- NeighborTable[nidx].flags |= PINNED_ENTRY;
- return SUCCESS;
- }
-
- // pin a neighbor so that it does not get evicted
- command error_t LinkEstimator.unpinNeighbor(am_addr_t neighbor) {
- uint8_t nidx = findIdx(neighbor);
- if (nidx == INVALID_RVAL) {
- return FAIL;
- }
- NeighborTable[nidx].flags &= ~PINNED_ENTRY;
- return SUCCESS;
- }
-
-
- // upper layer requests to flag a link as a bad link
- command error_t LinkEstimator.reportBadLink(am_addr_t addr) {
- uint8_t nidx = findIdx(addr);
- if (nidx == INVALID_RVAL) {
- return FAIL;
- }
- NeighborTable[nidx].flags |= PROBLEM_ENTRY;
- return SUCCESS;
- }
-
// get the link layer source address for the incoming packet
command am_addr_t LinkSrcPacket.getSrc(message_t* msg) {
--- 515,518 ----
Index: TreeCollection.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/TreeCollection.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** TreeCollection.h 19 Jun 2006 21:22:05 -0000 1.1.2.2
--- TreeCollection.h 20 Jun 2006 21:16:28 -0000 1.1.2.3
***************
*** 1,43 ****
- /*
- * Copyright (c) 2006 Stanford University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- * - Neither the name of the Stanford University nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD
- * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
- /**
- * Include file for collection clients.
- *
- * @author Philip Levis
- *
- */
- #ifndef TREE_COLLECTION_H
- #define TREE_COLLECTION_H
-
#define UQ_COLLECTION_CLIENT "CollectionSenderC.Send"
-
- #endif
--- 1 ----
Index: TreeCollectionC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/TreeCollectionC.nc,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -C2 -d -r1.1.2.17 -r1.1.2.18
*** TreeCollectionC.nc 19 Jun 2006 21:22:05 -0000 1.1.2.17
--- TreeCollectionC.nc 20 Jun 2006 21:16:28 -0000 1.1.2.18
***************
*** 91,97 ****
Forwarder.PacketAcknowledgements -> AMSenderC.Acks;
Forwarder.AMPacket -> AMSenderC;
! Forwarder.TreeRoutingInspect -> Router;
! Forwarder.LinkEstimator -> Estimator;
!
components new AMSenderC(AM_COLLECTION_CONTROL) as SendControl;
components new AMReceiverC(AM_COLLECTION_CONTROL) as ReceiveControl;
--- 91,95 ----
Forwarder.PacketAcknowledgements -> AMSenderC.Acks;
Forwarder.AMPacket -> AMSenderC;
!
components new AMSenderC(AM_COLLECTION_CONTROL) as SendControl;
components new AMReceiverC(AM_COLLECTION_CONTROL) as ReceiveControl;
Index: TreeRouting.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/TreeRouting.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** TreeRouting.h 19 Jun 2006 22:11:18 -0000 1.1.2.2
--- TreeRouting.h 20 Jun 2006 21:16:28 -0000 1.1.2.3
***************
*** 8,12 ****
ETX_THRESHOLD = 50, // link quality=20% -> ETX=5 -> Metric=50
PARENT_SWITCH_THRESHOLD = 15,
! MAX_METRIC = 0xFF,
};
--- 8,12 ----
ETX_THRESHOLD = 50, // link quality=20% -> ETX=5 -> Metric=50
PARENT_SWITCH_THRESHOLD = 15,
! MAX_METRIC = 0xFFFF,
};
Index: TreeRoutingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/TreeRoutingEngineP.nc,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -C2 -d -r1.1.2.15 -r1.1.2.16
*** TreeRoutingEngineP.nc 19 Jun 2006 22:11:18 -0000 1.1.2.15
--- TreeRoutingEngineP.nc 20 Jun 2006 21:16:28 -0000 1.1.2.16
***************
*** 163,170 ****
/* updates the routing information, using the info that has been received
! * from neighbor beacons. Three things can cause this info to change:
! * neighbor beacons, changes in link estimates (including neighbor
! * evictions), and feedback from the forwarding layer that a route is
! * bad (which can change link estimates). */
task void updateRouteTask() {
uint8_t i;
--- 163,168 ----
/* updates the routing information, using the info that has been received
! * from neighbor beacons. Two things can cause this info to change:
! * neighbor beacons, changes in link estimates, including neighbor eviction */
task void updateRouteTask() {
uint8_t i;
***************
*** 221,226 ****
//now choose between current/best
! if (minMetric < MAX_METRIC) {
! if (currentMetric >= MAX_METRIC ||
minMetric + PARENT_SWITCH_THRESHOLD < currentMetric) {
// routeInfo.metric will not store the composed metric.
--- 219,224 ----
//now choose between current/best
! if (minMetric != MAX_METRIC) {
! if (currentMetric == MAX_METRIC ||
minMetric + PARENT_SWITCH_THRESHOLD < currentMetric) {
// routeInfo.metric will not store the composed metric.
***************
*** 238,250 ****
}
}
! else if (currentMetric >= MAX_METRIC) {
! routeInfo.parent = INVALID_ADDR;
! routeInfo.metric = MAX_METRIC;
! routeInfo.hopcount = 0;
! }
//finally, tell people what happened
if (justEvicted && routeInfo.parent == INVALID_ADDR)
signal Routing.noRoute();
! else if (!justEvicted && minMetric <= MAX_METRIC)
signal Routing.routeFound();
justEvicted = FALSE;
--- 236,244 ----
}
}
!
//finally, tell people what happened
if (justEvicted && routeInfo.parent == INVALID_ADDR)
signal Routing.noRoute();
! else if (!justEvicted && minMetric != MAX_METRIC)
signal Routing.routeFound();
justEvicted = FALSE;
***************
*** 536,558 ****
}
- /* Will tell the link estimator to blacklist this neighbor until the next
- * update time */
- command void TreeRoutingInspect.reportBadRoute(am_addr_t neighbor) {
- call LinkEstimator.reportBadLink(neighbor);
- post updateRouteTask();
- }
-
- /* Send a beacon */
- command void TreeRoutingInspect.triggerRouteUpdate() {
- // Random time in interval 64-127ms
- uint16_t time = call Random.rand16();
- time &= 0x3f;
- time += 64;
- if (call BeaconTimer.gett0() + call BeaconTimer.getdt() - call BeaconTimer.getNow() >= time) {
- call BeaconTimer.stop();
- call BeaconTimer.startOneShot(time);
- }
- }
-
/* if this gets expensive, introduce indirection through an array of pointers */
error_t routingTableEvict(am_addr_t neighbor) {
--- 530,533 ----
Index: TreeRoutingInspect.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/TreeRoutingInspect.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** TreeRoutingInspect.nc 19 Jun 2006 20:14:34 -0000 1.1.2.2
--- TreeRoutingInspect.nc 20 Jun 2006 21:16:28 -0000 1.1.2.3
***************
*** 51,63 ****
*/
command error_t getMetric(uint16_t* metric);
-
- /* Inform the routing engine that the route through neighbor is bad.
- * This should mean that the routing engine should do something to avoid
- * this neighbor or fix the route */
- command void reportBadRoute(am_addr_t neighbor);
-
- /* This informs the routing engine to update its routing information,
- * possibly by sending a beacon */
- command void triggerRouteUpdate();
-
}
--- 51,53 ----
More information about the Tinyos-2-commits
mailing list