[Tinyos-2-commits]
CVS: tinyos-2.x/tos/lib/net/ctp .cvsignore, NONE,
1.1.2.1 Ctp.h, 1.1.2.2, 1.1.2.3 CtpForwardingEngine.h, 1.1.2.1,
1.1.2.2 CtpForwardingEngineP.nc, 1.1.2.5, 1.1.2.6 CtpPacket.nc,
1.1.2.3, 1.1.2.4
Kyle Jamieson
kasj78 at users.sourceforge.net
Fri Sep 8 14:51:57 PDT 2006
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/MultihopOscilloscope
Makefile, 1.1.2.1, 1.1.2.2 MultihopOscilloscopeAppC.nc,
1.1.2.1, 1.1.2.2
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/doc/html install-tinyos.html,
1.1.2.6, 1.1.2.7 overview.html, 1.1.2.9,
1.1.2.10 upgrade-tinyos.html, 1.1.2.6, 1.1.2.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv970/tos/lib/net/ctp
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
Ctp.h CtpForwardingEngine.h CtpForwardingEngineP.nc
CtpPacket.nc
Added Files:
Tag: tinyos-2_0_devel-BRANCH
.cvsignore
Log Message:
Preliminary dev for ECN and PULL bits.
--- NEW FILE: .cvsignore ---
.*.swp
Index: Ctp.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/Attic/Ctp.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
*** Ctp.h 25 Aug 2006 00:41:28 -0000 1.1.2.2
--- Ctp.h 8 Sep 2006 21:51:55 -0000 1.1.2.3
***************
*** 50,58 ****
enum {
AM_CTP_DATA = 23,
AM_CTP_ROUTING = 24,
AM_CTP_DEBUG = 25,
! CTP_PULL_OPT = 0x80,
! CTP_ECN_OPT = 0x40,
};
--- 50,61 ----
enum {
+ // AM types:
AM_CTP_DATA = 23,
AM_CTP_ROUTING = 24,
AM_CTP_DEBUG = 25,
!
! // CTP Options:
! CTP_OPT_PULL = 0x80, // TEP 123: P field
! CTP_OPT_ECN = 0x40, // TEP 123: C field
};
Index: CtpForwardingEngine.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/Attic/CtpForwardingEngine.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** CtpForwardingEngine.h 24 Aug 2006 20:04:23 -0000 1.1.2.1
--- CtpForwardingEngine.h 8 Sep 2006 21:51:55 -0000 1.1.2.2
***************
*** 75,78 ****
--- 75,80 ----
SENDDONE_NOACK_WINDOW = SENDDONE_NOACK_OFFSET - 1,
SENDDONE_OK_WINDOW = SENDDONE_OK_OFFSET - 1,
+ CONGESTED_WAIT_OFFSET = FORWARD_PACKET_TIME << 2,
+ CONGESTED_WAIT_WINDOW = CONGESTED_WAIT_OFFSET - 1,
};
Index: CtpForwardingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/Attic/CtpForwardingEngineP.nc,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** CtpForwardingEngineP.nc 6 Sep 2006 20:14:30 -0000 1.1.2.5
--- CtpForwardingEngineP.nc 8 Sep 2006 21:51:55 -0000 1.1.2.6
***************
*** 150,153 ****
--- 150,158 ----
interface Pool<message_t> as MessagePool;
interface Timer<TMilli> as RetxmitTimer;
+
+ // Counts down from the last time we heard from our parent; used
+ // to expire local state about parent congestion.
+ interface Timer<TMilli> as CongestionTimer;
+
interface Cache<message_t*> as SentCache;
interface CtpInfo;
***************
*** 162,169 ****
}
implementation {
! /* Starts the retxmit timer with a random number masked by the given
! * mask and added to the given offset.
*/
static void startRetxmitTimer(uint16_t mask, uint16_t offset);
/* Keeps track of whether the routing layer is running; if not,
--- 167,183 ----
}
implementation {
! /* Helper functions to start the given timer with a random number
! * masked by the given mask and added to the given offset.
*/
static void startRetxmitTimer(uint16_t mask, uint16_t offset);
+ static void startCongestionTimer(uint16_t mask, uint16_t offset);
+
+ /*
+ * Predicate to indicate our *local* congestion state (see TEP 123).
+ */
+ static bool congested();
+
+ /* Tracks our parent's congestion state. */
+ bool parentCongested = FALSE;
/* Keeps track of whether the routing layer is running; if not,
***************
*** 427,430 ****
--- 441,450 ----
ackPending = (call PacketAcknowledgements.requestAck(qe->msg) == SUCCESS);
+
+ // Set or clear the congestion bit on *outgoing* packets.
+ if (congested)
+ call CtpPacket.setOption(qe->msg, CTP_OPTION_ECN);
+ else
+ call CtpPacket.clearOption(qe->msg, CTP_OPTION_ECN);
subsendResult = call SubSend.send(dest, qe->msg, payloadLen);
***************
*** 755,760 ****
event message_t*
SubSnoop.receive(message_t* msg, void *payload, uint8_t len) {
! return signal Snoop.receive[call CtpPacket.getType(msg)] (msg, payload + sizeof(ctp_data_header_t),
! len - sizeof(ctp_data_header_t));
}
--- 775,799 ----
event message_t*
SubSnoop.receive(message_t* msg, void *payload, uint8_t len) {
! am_addr_t parent = call UnicastNameFreeRouting.nextHop();
! am_addr_t proximalSrc = call AMPacket.address(msg);
!
! // 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();
!
! if (call CtpPacket.option(msg, CTP_OPT_ECN) && proximalSrc == parent)
! // We've overheard our parent's ECN bit set.
! startCongestionTimer(CONGESTED_WAIT_WINDOW, CONGESTED_WAIT_OFFSET);
! } else if (proximalSrc == parent) {
! // We've overheard out parent's ECN bit cleared.
! call CongestionTimer.stop();
! parentCongested = FALSE;
! post sendTask();
! }
!
! return signal Snoop.receive[call CtpPacket.getType(msg)]
! (msg, payload + sizeof(ctp_data_header_t),
! len - sizeof(ctp_data_header_t));
}
***************
*** 763,766 ****
--- 802,810 ----
post sendTask();
}
+
+ event void CongestionTimer.fired() {
+ parentCongested = FALSE;
+ post sendTask();
+ }
command void Packet.clear(message_t* msg) {
***************
*** 789,792 ****
--- 833,837 ----
command am_addr_t CollectionPacket.getOrigin(message_t* msg) {return getHeader(msg)->origin;}
+
command collection_id_t CollectionPacket.getType(message_t* msg) {return getHeader(msg)->type;}
command uint8_t CollectionPacket.getSequenceNumber(message_t* msg) {return getHeader(msg)->originSeqNo;}
***************
*** 795,799 ****
command void CollectionPacket.setSequenceNumber(message_t* msg, uint8_t _seqno) {getHeader(msg)->originSeqNo = _seqno;}
! command ctp_options_t CtpPacket.getOptions(message_t* msg) {return getHeader(msg)->options;}
command uint8_t CtpPacket.getType(message_t* msg) {return getHeader(msg)->type;}
command am_addr_t CtpPacket.getOrigin(message_t* msg) {return getHeader(msg)->origin;}
--- 840,845 ----
command void CollectionPacket.setSequenceNumber(message_t* msg, uint8_t _seqno) {getHeader(msg)->originSeqNo = _seqno;}
! //command ctp_options_t CtpPacket.getOptions(message_t* msg) {return getHeader(msg)->options;}
!
command uint8_t CtpPacket.getType(message_t* msg) {return getHeader(msg)->type;}
command am_addr_t CtpPacket.getOrigin(message_t* msg) {return getHeader(msg)->origin;}
***************
*** 805,809 ****
command void CtpPacket.setOrigin(message_t* msg, am_addr_t addr) {getHeader(msg)->origin = addr;}
command void CtpPacket.setType(message_t* msg, uint8_t id) {getHeader(msg)->type = id;}
! command void CtpPacket.setOptions(message_t* msg, ctp_options_t opt) {getHeader(msg)->options = opt;}
command void CtpPacket.setEtx(message_t* msg, uint16_t e) {getHeader(msg)->etx = e;}
command void CtpPacket.setSequenceNumber(message_t* msg, uint8_t _seqno) {getHeader(msg)->originSeqNo = _seqno;}
--- 851,867 ----
command void CtpPacket.setOrigin(message_t* msg, am_addr_t addr) {getHeader(msg)->origin = addr;}
command void CtpPacket.setType(message_t* msg, uint8_t id) {getHeader(msg)->type = id;}
!
! command bool CollectionPacket.option(message_t* msg, ctp_options_t opt) {
! return (getHeader(msg)->options & opt == opt) ? TRUE : FALSE;
! }
!
! command void CtpPacket.setOption(message_t* msg, ctp_options_t opt) {
! getHeader(msg)->options |= opt;
! }
!
! command void CtpPacket.clearOption(message_t* msg, ctp_options_t opt) {
! getHeader(msg)->options &= ~opt;
! }
!
command void CtpPacket.setEtx(message_t* msg, uint16_t e) {getHeader(msg)->etx = e;}
command void CtpPacket.setSequenceNumber(message_t* msg, uint8_t _seqno) {getHeader(msg)->originSeqNo = _seqno;}
***************
*** 856,860 ****
r += offset;
call RetxmitTimer.startOneShot(r);
! dbg("Forwarder", "started rexmit timer in %hu ms\n", r);
}
--- 914,933 ----
r += offset;
call RetxmitTimer.startOneShot(r);
! dbg("Forwarder", "Rexmit timer will fire in %hu ms\n", r);
! }
!
! static void startCongestionTimer(uint16_t mask, uint16_t offset) {
! uint16_t r = call Random.rand16();
! r &= mask;
! r += offset;
! call CongestionTimer.startOneShot(r);
! dbg("Forwarder", "Congestion timer will fire in %hu ms\n", r);
! }
!
! static inline bool congested() {
! // A simple predicate for now to determine congestion state of
! // this node.
! return (call SendQueue.size() + 2 >= SendQueue.maxSize()) ?
! TRUE : FALSE;
}
Index: CtpPacket.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/ctp/Attic/CtpPacket.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** CtpPacket.nc 6 Sep 2006 20:14:30 -0000 1.1.2.3
--- CtpPacket.nc 8 Sep 2006 21:51:55 -0000 1.1.2.4
***************
*** 42,48 ****
interface CtpPacket {
! command ctp_options_t getOptions(message_t* msg);
! command void setOptions(message_t* msg, ctp_options_t options);
command uint8_t getThl(message_t* msg);
--- 42,53 ----
interface CtpPacket {
+ // Sets the given options bit.
+ command void setOption(message_t* msg, ctp_options_t option);
! // Clears the given options bit.
! command void clearOption(message_t* msg, ctp_options_t option);
!
! // Returns TRUE iff all of the given options bits are set.
! command bool option(message_t* msg, ctp_options_t opt);
command uint8_t getThl(message_t* msg);
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/MultihopOscilloscope
Makefile, 1.1.2.1, 1.1.2.2 MultihopOscilloscopeAppC.nc,
1.1.2.1, 1.1.2.2
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/doc/html install-tinyos.html,
1.1.2.6, 1.1.2.7 overview.html, 1.1.2.9,
1.1.2.10 upgrade-tinyos.html, 1.1.2.6, 1.1.2.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list