[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/collection
CollectionDebugMsg.h, 1.1.2.8, 1.1.2.9 ForwardingEngine.h,
1.1.2.9, 1.1.2.10 ForwardingEngineP.nc, 1.1.2.30, 1.1.2.31
Rodrigo Fonseca
rfonseca76 at users.sourceforge.net
Tue Jun 20 19:16:56 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29209
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
CollectionDebugMsg.h ForwardingEngine.h ForwardingEngineP.nc
Log Message:
Added max number of retransmissions to ForwardingEngine.
Index: CollectionDebugMsg.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/CollectionDebugMsg.h,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** CollectionDebugMsg.h 20 Jun 2006 21:16:28 -0000 1.1.2.8
--- CollectionDebugMsg.h 21 Jun 2006 02:16:53 -0000 1.1.2.9
***************
*** 21,24 ****
--- 21,26 ----
NET_C_FE_SENDDONE_FAIL = 0x24,
NET_C_FE_SENDDONE_WAITACK = 0x25,
+ NET_C_FE_SENDDONE_FAIL_ACK_SEND = 0x26,
+ NET_C_FE_SENDDONE_FAIL_ACK_FWD = 0x27,
Index: ForwardingEngine.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/ForwardingEngine.h,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -C2 -d -r1.1.2.9 -r1.1.2.10
*** ForwardingEngine.h 21 Jun 2006 00:15:15 -0000 1.1.2.9
--- ForwardingEngine.h 21 Jun 2006 02:16:53 -0000 1.1.2.10
***************
*** 51,54 ****
--- 51,58 ----
#endif
+ enum {
+ MAX_RETRIES = 4
+ };
+
typedef nx_struct {
nx_uint8_t control;
***************
*** 60,63 ****
--- 64,68 ----
message_t *msg;
uint8_t client;
+ uint8_t retries;
} fe_queue_entry_t;
Index: ForwardingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/ForwardingEngineP.nc,v
retrieving revision 1.1.2.30
retrieving revision 1.1.2.31
diff -C2 -d -r1.1.2.30 -r1.1.2.31
*** ForwardingEngineP.nc 21 Jun 2006 00:15:15 -0000 1.1.2.30
--- ForwardingEngineP.nc 21 Jun 2006 02:16:53 -0000 1.1.2.31
***************
*** 85,90 ****
bool sending = FALSE;
! /* Keeps track of whether we are currently sending to the UART a
! * debug message. */
enum {
--- 85,92 ----
bool sending = FALSE;
! /* 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;
enum {
***************
*** 105,108 ****
--- 107,111 ----
}
loopbackMsgPtr = &loopbackMsg;
+ lastParent = call AMPacket.address();
return SUCCESS;
}
***************
*** 171,174 ****
--- 174,178 ----
qe->msg = msg;
qe->client = client;
+ qe->retries = MAX_RETRIES;
dbg("Forwarder", "%s: queue entry for %hhu is %hhu deep\n", __FUNCTION__, client, call SendQueue.size());
if (call SendQueue.enqueue(qe) == SUCCESS) {
***************
*** 232,247 ****
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));
! signal SubSend.sendDone(qe->msg, SUCCESS);
! return;
}
--- 236,259 ----
uint8_t payloadLen = call SubPacket.payloadLength(qe->msg);
am_addr_t dest = call UnicastNameFreeRouting.nextHop();
+ /* 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) {
+ qe->retries = MAX_RETRIES;
+ 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));
! signal SubSend.sendDone(qe->msg, SUCCESS);
! return;
}
***************
*** 250,262 ****
subsendResult = call SubSend.send(dest, qe->msg, payloadLen);
if (subsendResult == SUCCESS) {
! // Successfully submitted to the data-link layer.
! sending = TRUE;
! dbg("Forwarder", "%s: subsend succeeded with %p.\n", __FUNCTION__, qe->msg);
! if (qe->client < CLIENT_COUNT) {
! dbg("Forwarder", "%s: client packet.\n", __FUNCTION__);
! }
! else {
! dbg("Forwarder", "%s: forwarded packet.\n", __FUNCTION__);
! }
return;
}
--- 262,274 ----
subsendResult = call SubSend.send(dest, qe->msg, payloadLen);
if (subsendResult == SUCCESS) {
! // Successfully submitted to the data-link layer.
! sending = TRUE;
! dbg("Forwarder", "%s: subsend succeeded with %p.\n", __FUNCTION__, qe->msg);
! if (qe->client < CLIENT_COUNT) {
! dbg("Forwarder", "%s: client packet.\n", __FUNCTION__);
! }
! else {
! dbg("Forwarder", "%s: forwarded packet.\n", __FUNCTION__);
! }
return;
}
***************
*** 311,318 ****
else if (ackPending && !call PacketAcknowledgements.wasAcked(msg)) {
// AckPending is for case when DL cannot support acks.
! dbg("Forwarder", "%s: not acked\n", __FUNCTION__);
! call CollectionDebug.logEventRoute(NET_C_FE_SENDDONE_WAITACK, error, TOS_NODE_ID,
call AMPacket.destination(msg));
! startRetxmitTimer(SENDDONE_NOACK_WINDOW, SENDDONE_NOACK_OFFSET);
}
else if (qe->client < CLIENT_COUNT) {
--- 323,350 ----
else if (ackPending && !call PacketAcknowledgements.wasAcked(msg)) {
// AckPending is for case when DL cannot support acks.
! if (--qe->retries) {
! dbg("Forwarder", "%s: not acked\n", __FUNCTION__);
! call CollectionDebug.logEventRoute(NET_C_FE_SENDDONE_WAITACK, error, TOS_NODE_ID,
call AMPacket.destination(msg));
! startRetxmitTimer(SENDDONE_NOACK_WINDOW, SENDDONE_NOACK_OFFSET);
! } else {
! //max retries, dropping packet
! if (qe->client < CLIENT_COUNT) {
! clientPtrs[qe->client] = qe;
! signal Send.sendDone[qe->client](msg, FAIL);
! call CollectionDebug.logEventRoute(NET_C_FE_SENDDONE_FAIL_ACK_SEND,
! error, TOS_NODE_ID,
! call AMPacket.destination(msg));
! } else {
! call MessagePool.put(qe->msg);
! call QEntryPool.put(qe);
! call CollectionDebug.logEventRoute(NET_C_FE_SENDDONE_FAIL_ACK_FWD,
! error, TOS_NODE_ID,
! call AMPacket.destination(msg));
! }
! call SendQueue.dequeue();
! sending = FALSE;
! startRetxmitTimer(SENDDONE_OK_WINDOW, SENDDONE_OK_OFFSET);
! }
}
else if (qe->client < CLIENT_COUNT) {
***************
*** 367,370 ****
--- 399,403 ----
qe->msg = m;
qe->client = 0xff;
+ qe->retries = MAX_RETRIES;
if (call SendQueue.enqueue(qe) == SUCCESS) {
More information about the Tinyos-2-commits
mailing list