[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/collection
ForwardingEngineP.nc, 1.1.2.13, 1.1.2.14 LinkEstimatorP.nc,
1.1.2.13, 1.1.2.14 TreeCollectionC.nc, 1.1.2.8, 1.1.2.9
Phil Levis
scipio at users.sourceforge.net
Wed Jun 7 14:21:13 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21049/collection
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
ForwardingEngineP.nc LinkEstimatorP.nc TreeCollectionC.nc
Log Message:
Remove dissemimation Leds.
Fix forwarder for two problems:
1) Allocating queue entries from the same pool as forwarding means that there
is no rate limiting on the client; clients have a separate pool, which is now
statically allocated as an array.
2) If a Send.send() accepted a packet to send but there was no route, then
it would hold onto the packet forever and not retry. In the "no route" case,
the forwarder sets a 10 second retransmit timer, so it will check if there is
a route 10 seconds later.
Increased the LE table to 8 from 5 entries. Some basic connectivity/percolation
theory asserts that you need a degree of 4.5 to have a fully connected network,
and so 5 is too close.
Index: ForwardingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/ForwardingEngineP.nc,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -C2 -d -r1.1.2.13 -r1.1.2.14
*** ForwardingEngineP.nc 2 Jun 2006 02:10:19 -0000 1.1.2.13
--- ForwardingEngineP.nc 7 Jun 2006 21:21:11 -0000 1.1.2.14
***************
*** 80,84 ****
--- 80,91 ----
};
+ fe_queue_entry_t clientEntries[CLIENT_COUNT];
+ fe_queue_entry_t* clientPtrs[CLIENT_COUNT];
+
command error_t Init.init() {
+ int i;
+ for (i = 0; i < CLIENT_COUNT; i++) {
+ clientPtrs[i] = &clientEntries[i];
+ }
return SUCCESS;
}
***************
*** 130,134 ****
network_header_t* hdr;
fe_queue_entry_t *qe;
!
if (!running) {return EOFF;}
--- 137,141 ----
network_header_t* hdr;
fe_queue_entry_t *qe;
!
if (!running) {return EOFF;}
***************
*** 138,148 ****
hdr->collectid = call CollectionId.fetch[client]();
! if (call QEntryPool.empty()) {
! dbg("PhilTest", "Send failed as pool is empty.\n");
! // Queue pool is empty; fail the send.
return EBUSY;
}
! qe = call QEntryPool.get();
qe->msg = msg;
qe->client = client;
--- 145,154 ----
hdr->collectid = call CollectionId.fetch[client]();
! if (clientPtrs[client] == NULL) {
! dbg("Forwarder", "%s: send failed as client is busy.\n", __FUNCTION__);
return EBUSY;
}
! qe = clientPtrs[client];
qe->msg = msg;
qe->client = client;
***************
*** 152,159 ****
post sendTask();
}
return SUCCESS;
}
else {
! dbg("PhilTest", "Send failed as packet could not be enqueued.\n");
return FAIL;
}
--- 158,167 ----
post sendTask();
}
+ clientPtrs[client] = NULL;
return SUCCESS;
}
else {
! dbg("Forwarder", "%s: send failed as packet could not be enqueued.\n", __FUNCTION__);
! // Return the pool entry, as it's not for me...
return FAIL;
}
***************
*** 177,188 ****
// queue until it is successfully sent.
task void sendTask() {
! if (!call UnicastNameFreeRouting.hasRoute() ||
! call SendQueue.empty() ||
! sending) {
return;
}
! // else if (call RootControl.isRoot()) {
! // loopback();
! // }
else {
error_t eval;
--- 185,203 ----
// queue until it is successfully sent.
task void sendTask() {
! dbg("Forwarder", "%s: Trying to send a packet.\n", __FUNCTION__);
! if (sending) {
! dbg("Forwarder", "%s: busy, don't send\n", __FUNCTION__);
return;
}
! if (call SendQueue.empty()) {
! dbg("Forwarder", "%s: queue empty, don't send\n", __FUNCTION__);
! return;
! }
! if (!call UnicastNameFreeRouting.hasRoute()) {
! dbg("Forwarder", "%s: no route, don't send, start retry timer\n", __FUNCTION__);
! call RetxmitTimer.startOneShot(10000);
! return;
! }
!
else {
error_t eval;
***************
*** 197,215 ****
// Successfully submitted to the data-link layer.
sending = TRUE;
! call QEntryPool.put(qe);
return;
}
! if (eval == EOFF) {
// The radio has been turned off underneath us. Assume that
// this is for the best. When the radio is turned back on, we'll
// handle a startDone event and resume sending.
radioOn = FALSE;
}
! if (eval == EBUSY) {
// This shouldn't happen, as we sit on top of a client and
// control our own output; it means we're trying to
// double-send (bug). This means we expect a sendDone, so just
// wait for that: when the sendDone comes in, // we'll try
! // sending this packet again.
}
}
--- 212,240 ----
// Successfully submitted to the data-link layer.
sending = TRUE;
! dbg("Forwarder", "%s: subsend succeeded.\n", __FUNCTION__);
! if (qe >= clientEntries && qe <= clientEntries + (CLIENT_COUNT - 1)) {
! dbg("Forwarder", "%s: client packet, put queue entry back in array.\n", __FUNCTION__);
! clientPtrs[qe->client] = qe;
! }
! else {
! dbg("Forwarder", "%s: forwarded packet, put queue entry back in pool.\n", __FUNCTION__);
! call QEntryPool.put(qe);
! }
return;
}
! else if (eval == EOFF) {
// The radio has been turned off underneath us. Assume that
// this is for the best. When the radio is turned back on, we'll
// handle a startDone event and resume sending.
radioOn = FALSE;
+ dbg("Forwarder", "%s: subsend failed from EOFF.\n", __FUNCTION__);
}
! else if (eval == EBUSY) {
// This shouldn't happen, as we sit on top of a client and
// control our own output; it means we're trying to
// double-send (bug). This means we expect a sendDone, so just
// wait for that: when the sendDone comes in, // we'll try
! // sending this packet again.
! dbg("Forwarder", "%s: subsend failed from EBUSY.\n", __FUNCTION__);
}
}
***************
*** 218,222 ****
event void SubSend.sendDone(message_t* msg, error_t error) {
fe_queue_entry_t *qe = call SendQueue.head();
! if (qe->msg != msg) {
// Not our packet, something is very wrong...
return;
--- 243,247 ----
event void SubSend.sendDone(message_t* msg, error_t error) {
fe_queue_entry_t *qe = call SendQueue.head();
! if (qe == NULL || qe->msg != msg) {
// Not our packet, something is very wrong...
return;
***************
*** 257,260 ****
--- 282,286 ----
// to put this, so we have to leak it...
}
+ call QEntryPool.put(qe);
}
Index: LinkEstimatorP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/LinkEstimatorP.nc,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -C2 -d -r1.1.2.13 -r1.1.2.14
*** LinkEstimatorP.nc 4 Jun 2006 23:17:59 -0000 1.1.2.13
--- LinkEstimatorP.nc 7 Jun 2006 21:21:11 -0000 1.1.2.14
***************
*** 56,60 ****
// Number of entries in the neighbor table
! #define NEIGHBOR_TABLE_SIZE 5
// Timer that determines how often beacons should be
// sent and link estimate updated
--- 56,60 ----
// Number of entries in the neighbor table
! #define NEIGHBOR_TABLE_SIZE 8
// Timer that determines how often beacons should be
// sent and link estimate updated
***************
*** 347,350 ****
--- 347,351 ----
minPkt = TABLEUPDATE_INTERVAL / BEACON_INTERVAL;
dbg("LI", "%s\n", __FUNCTION__);
+ dbg("LIPrint", "Link table for %i\n", (int)sim_node());
for (i = 0; i < NEIGHBOR_TABLE_SIZE; i++) {
ne = &NeighborTable[i];
***************
*** 370,373 ****
--- 371,375 ----
newEst = (255 * ne->rcvcnt) / totalPkt;
dbg("LI,LITest", " %hu: %hhu -> %hhu", ne->ll_addr, ne->inquality, (ALPHA * ne->inquality + (10-ALPHA) * newEst)/10);
+ dbg("LIPrint", " link[%hhu] = %hu, %hhu\n", i, ne->ll_addr, ne->inquality);
ne->inquality = (ALPHA * ne->inquality + (10-ALPHA) * newEst)/10;
}
Index: TreeCollectionC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/TreeCollectionC.nc,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** TreeCollectionC.nc 2 Jun 2006 02:10:19 -0000 1.1.2.8
--- TreeCollectionC.nc 7 Jun 2006 21:21:11 -0000 1.1.2.9
***************
*** 21,25 ****
CLIENT_COUNT = uniqueCount(UQ_COLLECTION_CLIENT),
FORWARD_COUNT = 5,
! TREE_ROUTING_TABLE_SIZE = 12,
QUEUE_SIZE = CLIENT_COUNT + FORWARD_COUNT,
};
--- 21,25 ----
CLIENT_COUNT = uniqueCount(UQ_COLLECTION_CLIENT),
FORWARD_COUNT = 5,
! TREE_ROUTING_TABLE_SIZE = 4,
QUEUE_SIZE = CLIENT_COUNT + FORWARD_COUNT,
};
More information about the Tinyos-2-commits
mailing list