#include <dsr-priqueue.h>
Inheritance diagram for CMUPriQueue:


Public Member Functions | |
| CMUPriQueue () | |
| int | command (int argc, const char *const *argv) |
| void | recv (Packet *p, Handler *) |
| void | prq_resume (void) |
| void | Terminate (void) |
| Packet * | prq_get_nexthop (nsaddr_t id) |
| int | prq_isfull (Packet *p) |
| int | prq_length (void) |
| NsObject * | target () |
| virtual void | drop (Packet *p) |
| virtual void | recv (Packet *p, const char *s) |
| virtual void | recvOnly (Packet *) |
| virtual void | delay_bind_init_all () |
| virtual int | delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer) |
| int | isdebug () const |
| virtual void | debug (const char *fmt,...) |
Protected Member Functions | |
| void | trace (char *fmt,...) |
| void | log_stats (void) |
| virtual void | drop (Packet *p, const char *s) |
| void | send (Packet *p, Handler *h) |
| virtual void | reset () |
| void | handle (Event *) |
Protected Attributes | |
| int | qlen_logthresh_ |
| int | fw_logthresh_ |
| int | last_ifqlen_ [IFQ_MAX] |
| int | stat_send_ |
| int | stat_recv_ |
| int | stat_blocked_ |
| NsObject * | target_ |
| NsObject * | drop_ |
| int | debug_ |
Private Member Functions | |
| int | prq_assign_queue (Packet *p) |
| void | prq_enqueue (Packet *p) |
| Packet * | prq_dequeue (void) |
| void | prq_validate (void) |
Private Attributes | |
| ifqueue | prq_snd_ [IFQ_MAX] |
| nsaddr_t | prq_ipaddr_ |
| Trace * | prq_logtarget_ |
| int | prq_blocked_ |
| CMUPriQueueHandler | prq_qh_ |
|
|
Definition at line 34 of file dsr-priqueue.cc. References fw_logthresh_, ifqueue::ifq_drops, ifqueue::ifq_head, ifqueue::ifq_len, IFQ_MAX, IFQ_MAXLEN, ifqueue::ifq_maxlen, ifqueue::ifq_tail, last_ifqlen_, prq_blocked_, prq_ipaddr_, prq_logtarget_, prq_snd_, qlen_logthresh_, stat_blocked_, stat_recv_, and stat_send_.
00034 : Connector(), prq_qh_(this) 00035 { 00036 int i; 00037 00038 for(i = 0; i < IFQ_MAX; i++) { 00039 prq_snd_[i].ifq_head = prq_snd_[i].ifq_tail = 0; 00040 prq_snd_[i].ifq_len = 0; 00041 prq_snd_[i].ifq_maxlen = IFQ_MAXLEN; 00042 prq_snd_[i].ifq_drops = 0; 00043 00044 last_ifqlen_[i] = 0; 00045 } 00046 prq_logtarget_ = 0; // no logging target by default 00047 prq_ipaddr_ = 0; 00048 prq_blocked_ = 0; 00049 00050 bind("qlen_logthresh_", &qlen_logthresh_); 00051 bind("fw_logthresh_", &fw_logthresh_); 00052 assert(qlen_logthresh_ > 0 && fw_logthresh_ > 0); 00053 00054 bzero(last_ifqlen_, sizeof(last_ifqlen_)); 00055 stat_send_ = stat_recv_ = stat_blocked_ = 0; 00056 } |
|
||||||||||||
|
Reimplemented from Connector. Definition at line 59 of file dsr-priqueue.cc. References Connector::command(), prq_ipaddr_, prq_logtarget_, and Terminate().
00060 {
00061 if (argc == 2 && strcasecmp(argv[1], "reset") == 0) {
00062 Terminate();
00063 //FALL-THROUGH to give parents a chance to reset
00064 } else if(argc == 3) {
00065 if(strcmp(argv[1], "logtarget") == 0) {
00066 prq_logtarget_ = (Trace*) TclObject::lookup(argv[2]);
00067 assert(prq_logtarget_);
00068 return (TCL_OK);
00069 }
00070 else if(strcmp(argv[1], "ipaddr") == 0) {
00071 prq_ipaddr_ = atoi(argv[2]);
00072 assert(prq_ipaddr_ > 0);
00073 return (TCL_OK);
00074 }
00075 }
00076 return Connector::command(argc, argv);
00077 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 102 of file object.cc. References NsObject::debug_.
00103 {
00104 if (!debug_)
00105 return;
00106 va_list ap;
00107 va_start(ap, fmt);
00108 vprintf(fmt, ap);
00109 }
|
|
||||||||||||||||
|
Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 63 of file object.cc. References NsObject::debug_. Referenced by MPLSAddressClassifier::delay_bind_dispatch(), and Agent::delay_bind_dispatch().
00064 {
00065 if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer))
00066 return TCL_OK;
00067 return TclObject::delay_bind_dispatch(varName, localName, tracer);
00068 }
|
|
|
Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent. Definition at line 57 of file object.cc. Referenced by MPLSAddressClassifier::delay_bind_init_all(), and Agent::delay_bind_init_all().
00058 {
00059 delay_bind_init_one("debug_");
00060 }
|
|
||||||||||||
|
Definition at line 114 of file connector.cc. References Connector::drop_, Packet::free(), and NsObject::recv().
00115 {
00116 if (drop_ != 0)
00117 drop_->recv(p, s);
00118 else
00119 Packet::free(p);
00120 }
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
|
Implements Handler. Reimplemented in LinkDelay, LL, AckRecons, and Snoop. Definition at line 91 of file object.cc. References NsObject::recv().
|
Here is the call graph for this function:

|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
|
Definition at line 80 of file dsr-priqueue.cc. References fw_logthresh_, ifqueue::ifq_len, IFQ_MAX, Scheduler::instance(), last_ifqlen_, prq_ipaddr_, prq_logtarget_, prq_snd_, Trace::pt_, qlen_logthresh_, stat_blocked_, stat_recv_, stat_send_, BaseTrace::tagged(), TIME_FORMAT, and trace().
00081 {
00082 int q, s = 0, d = 0;
00083
00084 assert(IFQ_MAX == 4);
00085
00086 /*
00087 * avoid logging useless information
00088 */
00089 for(q = 0; q < IFQ_MAX; q++) {
00090 s += prq_snd_[q].ifq_len;
00091 d += (prq_snd_[q].ifq_len - last_ifqlen_[q]);
00092 }
00093 if(d < 0)
00094 d = -d;
00095
00096 /*
00097 * Only write an entry to the log file is the queue length
00098 * or "delta change" over the last second meets the threshold
00099 * level OR, if this node is generally busy (forwarding more
00100 * than a certain number of packets per second).
00101 */
00102 if(s >= qlen_logthresh_ || d >= qlen_logthresh_ ||
00103 stat_recv_ > fw_logthresh_) {
00104 if (prq_logtarget_->pt_->tagged()) {
00105 // using the new tagged trace format
00106 trace("I "TIME_FORMAT" -prq:adr %d -prq:rx %d -prq:tx %d -prq:bl %d -prq:snd0 {%d %d} -prq:snd1 {%d %d} -prq:snd2 {%d %d} -prq:snd3 {%d %d}",
00107 Scheduler::instance().clock(),
00108 prq_ipaddr_,
00109 stat_recv_, stat_send_, stat_blocked_,
00110 prq_snd_[0].ifq_len, prq_snd_[0].ifq_len-last_ifqlen_[0],
00111 prq_snd_[1].ifq_len, prq_snd_[1].ifq_len-last_ifqlen_[1],
00112 prq_snd_[2].ifq_len, prq_snd_[2].ifq_len-last_ifqlen_[2],
00113 prq_snd_[3].ifq_len, prq_snd_[3].ifq_len-last_ifqlen_[3]);
00114 } else {
00115 trace("I %.9f _%d_ ifq rx %d tx %d bl %d [%d %d] [%d %d] [%d %d] [%d %d]",
00116 Scheduler::instance().clock(),
00117 prq_ipaddr_,
00118 stat_recv_, stat_send_, stat_blocked_,
00119 prq_snd_[0].ifq_len, prq_snd_[0].ifq_len-last_ifqlen_[0],
00120 prq_snd_[1].ifq_len, prq_snd_[1].ifq_len-last_ifqlen_[1],
00121 prq_snd_[2].ifq_len, prq_snd_[2].ifq_len-last_ifqlen_[2],
00122 prq_snd_[3].ifq_len, prq_snd_[3].ifq_len-last_ifqlen_[3]);
00123 }
00124 }
00125
00126 for(q = 0; q < IFQ_MAX; q++) {
00127 last_ifqlen_[q] = prq_snd_[q].ifq_len;
00128 }
00129 stat_send_ = stat_recv_ = stat_blocked_ = 0;
00130 }
|
Here is the call graph for this function:

|
|
Definition at line 315 of file dsr-priqueue.cc. References HDR_CMN, IFQ_LOWDELAY, IFQ_NORMAL, IFQ_REALTIME, IFQ_RTPROTO, PT_ACK, PT_AODV, PT_AUDIO, PT_DSR, PT_IMEP, PT_MESSAGE, PT_TORA, and PT_VIDEO. Referenced by prq_enqueue(), and prq_isfull().
00316 {
00317 struct hdr_cmn *ch = HDR_CMN(p);
00318
00319 switch(ch->ptype()) {
00320 case PT_AODV:
00321 case PT_DSR:
00322 case PT_IMEP:
00323 case PT_MESSAGE: /* used by DSDV */
00324 case PT_TORA:
00325 return IFQ_RTPROTO;
00326
00327 case PT_AUDIO:
00328 case PT_VIDEO:
00329 return IFQ_REALTIME;
00330
00331 case PT_ACK:
00332 return IFQ_LOWDELAY;
00333
00334 default:
00335 return IFQ_NORMAL;
00336 }
00337 }
|
|
|
Definition at line 298 of file dsr-priqueue.cc. References IF_DEQUEUE, ifqueue::ifq_len, IFQ_MAX, and prq_snd_. Referenced by prq_enqueue(), prq_resume(), and Terminate().
|
|
|
Definition at line 273 of file dsr-priqueue.cc. References Connector::drop(), DROP_IFQ_QFULL, IF_DROP, IF_ENQUEUE, IF_QFULL, prq_assign_queue(), prq_blocked_, prq_dequeue(), prq_qh_, prq_snd_, NsObject::recv(), stat_send_, and Connector::target_. Referenced by recv().
00274 {
00275 int q = prq_assign_queue(p);
00276 struct ifqueue *ifq = &prq_snd_[q];
00277
00278 if(IF_QFULL(ifq)) {
00279 IF_DROP(ifq);
00280 drop(p, DROP_IFQ_QFULL);
00281 return;
00282 }
00283 IF_ENQUEUE(ifq, p);
00284
00285 /*
00286 * Start queue if idle...
00287 */
00288 if(prq_blocked_ == 0) {
00289 p = prq_dequeue();
00290 prq_blocked_ = 1;
00291
00292 stat_send_++;
00293 target_->recv(p, &prq_qh_);
00294 }
00295 }
|
Here is the call graph for this function:

|
|
Definition at line 195 of file dsr-priqueue.cc. References HDR_CMN, IF_DEQUEUE, IFQ_MAX, Packet::next_, prq_snd_, and prq_validate(). Referenced by DSRAgent::xmitFailed().
00196 {
00197 int q;
00198 Packet *p, *pprev = 0;
00199 struct ifqueue *ifq;
00200
00201 #if PRIQUEUE_DEBUG > 0
00202 prq_validate();
00203 #endif
00204 for(q = 0; q < IFQ_MAX; q++) {
00205 ifq = &prq_snd_[q];
00206 pprev = 0;
00207 for(p = ifq->ifq_head; p; p = p->next_) {
00208 struct hdr_cmn *ch = HDR_CMN(p);
00209
00210 if(ch->next_hop() == id)
00211 break;
00212 pprev = p;
00213 }
00214
00215 if(p) {
00216 if(p == ifq->ifq_head) {
00217 assert(pprev == 0);
00218
00219 IF_DEQUEUE(ifq, p);
00220 /* don't increment drop counter */
00221 #if PRIQUEUE_DEBUG > 0
00222 prq_validate();
00223 #endif
00224 return p;
00225 } else {
00226 assert(pprev);
00227 pprev->next_ = p->next_;
00228
00229 if(p == ifq->ifq_tail)
00230 ifq->ifq_tail = pprev;
00231 ifq->ifq_len--;
00232
00233 #if PRIQUEUE_DEBUG > 0
00234 prq_validate();
00235 #endif
00236 p->next_ = 0;
00237 return p;
00238 }
00239 }
00240 }
00241
00242 return (Packet*) 0;
00243 }
|
Here is the call graph for this function:

|
|
Definition at line 246 of file dsr-priqueue.cc. References IF_QFULL, prq_assign_queue(), and prq_snd_. Referenced by DSRAgent::sendOutPacketWithRoute().
00247 {
00248 int q = prq_assign_queue(p);
00249 struct ifqueue *ifq = &prq_snd_[q];
00250
00251 if(IF_QFULL(ifq))
00252 return 1;
00253 else
00254 return 0;
00255 }
|
Here is the call graph for this function:

|
|
Definition at line 258 of file dsr-priqueue.cc. References ifqueue::ifq_len, IFQ_MAX, and prq_snd_. Referenced by DSRAgent::handleRouteRequest(), recv(), and DSRAgent::sendOutPacketWithRoute().
|
|
|
Definition at line 164 of file dsr-priqueue.cc. References prq_blocked_, prq_dequeue(), prq_qh_, prq_validate(), NsObject::recv(), stat_send_, and Connector::target_. Referenced by CMUPriQueueHandler::handle().
00165 {
00166 Packet *p;
00167
00168 assert(prq_blocked_);
00169 #if PRIQUEUE_DEBUG > 0
00170 prq_validate();
00171 #endif
00172 p = prq_dequeue();
00173 if (p != 0) {
00174 stat_send_++;
00175 target_->recv(p, &prq_qh_);
00176 } else {
00177 prq_blocked_ = 0;
00178 }
00179 }
|
Here is the call graph for this function:

|
|
Definition at line 340 of file dsr-priqueue.cc. References IFQ_MAX, Packet::next_, and prq_snd_. Referenced by prq_get_nexthop(), prq_resume(), and recv().
00341 {
00342 int q, qlen;
00343 Packet *p;
00344 struct ifqueue *ifq;
00345
00346 for(q = 0; q < IFQ_MAX; q++) {
00347 ifq = &prq_snd_[q];
00348 qlen = 0;
00349
00350 if(ifq->ifq_head == 0) {
00351 assert(ifq->ifq_len == 0);
00352 assert(ifq->ifq_head == ifq->ifq_tail);
00353 } else {
00354
00355 for(p = ifq->ifq_head; p; p = p->next_) {
00356 if(p->next_ == 0)
00357 assert(p == ifq->ifq_tail);
00358 qlen++;
00359 }
00360
00361 assert(qlen == ifq->ifq_len);
00362 assert(qlen <= ifq->ifq_maxlen);
00363 }
00364 }
00365 }
|
|
||||||||||||
|
Reimplemented in CMUTrace. Definition at line 96 of file object.cc. References Packet::free().
00097 {
00098 Packet::free(p);
00099 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from Connector. Definition at line 146 of file dsr-priqueue.cc. References prq_blocked_, prq_enqueue(), prq_length(), prq_validate(), stat_blocked_, and stat_recv_.
00147 {
00148 #if PRIQUEUE_DEBUG > 0
00149 prq_validate();
00150 #endif
00151 stat_recv_++;
00152 if(prq_blocked_ == 1) {
00153 stat_blocked_++;
00154 } else {
00155 assert(prq_length() == 0);
00156 }
00157 prq_enqueue(p);
00158 #if PRIQUEUE_DEBUG > 0
00159 prq_validate();
00160 #endif
00161 }
|
Here is the call graph for this function:

|
|
Reimplemented in Agent, and Trace. Definition at line 56 of file object.h. Referenced by Trace::recvOnly().
00056 {};
|
|
|
Reimplemented in BayFullTcpAgent, HashClassifier, IvsSource, dsREDQueue, DiffusionRate, SinkAgent, DiffusionAgent, FloodingAgent, OmniMcastAgent, LinkDelay, CBQueue, DropTail, ErrorModel, PIQueue, Queue< T >, RedPDQueue, REDQueue, REMQueue, RIOQueue, Snoop, FackTcpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, Sack1TcpAgent, TcpSink, DelAckSink, TcpAgent, VegasTcpAgent, toraAgent, and Queue< T >. Definition at line 70 of file object.cc. Referenced by NsObject::command().
00071 {
00072 }
|
|
||||||||||||
|
Reimplemented in Agent, and LinkDelay. Definition at line 54 of file connector.h. References NsObject::recv(), and Connector::target_. Referenced by SessionTTLChecker::recv(), TTLChecker::recv(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SatDequeTrace::recv(), SALink::recv(), SnoopQueueEDrop::recv(), SnoopQueueTagger::recv(), SnoopQueueDrop::recv(), SnoopQueueOut::recv(), SnoopQueueIn::recv(), PktCounter::recv(), NetworkInterface::recv(), MeasureMod::recv(), Filter::recv(), Connector::recv(), CMUTrace::recv(), CBQClass::recv(), and AddSR::recv().
|
Here is the call graph for this function:

|
|
Definition at line 48 of file connector.h. References Connector::target_. Referenced by JoBS::assignRateDropsADC(), FQ::deque(), QSAgent::recv(), and MIPMHAgent::reg().
00048 { return target_; }
|
|
|
Definition at line 186 of file dsr-priqueue.cc. References Connector::drop(), DROP_END_OF_SIMULATION, and prq_dequeue(). Referenced by command().
00187 {
00188 Packet *p;
00189 while((p = prq_dequeue())) {
00190 drop(p, DROP_END_OF_SIMULATION);
00191 }
00192 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 133 of file dsr-priqueue.cc. References BaseTrace::buffer(), BaseTrace::dump(), prq_logtarget_, and Trace::pt_. Referenced by log_stats().
00134 {
00135 va_list ap;
00136
00137 assert(prq_logtarget_);
00138
00139 va_start(ap, fmt);
00140 vsprintf(prq_logtarget_->pt_->buffer(), fmt, ap);
00141 prq_logtarget_->pt_->dump();
00142 va_end(ap);
00143 }
|
Here is the call graph for this function:

|
|
Reimplemented in FECModel, FloodAgent, and LandmarkAgent. Definition at line 66 of file object.h. Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset(). |
|
|
Definition at line 57 of file connector.h. Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv(). |
|
|
Definition at line 121 of file dsr-priqueue.h. Referenced by CMUPriQueue(), and log_stats(). |
|
|
Definition at line 123 of file dsr-priqueue.h. Referenced by CMUPriQueue(), and log_stats(). |
|
|
Definition at line 112 of file dsr-priqueue.h. Referenced by CMUPriQueue(), prq_enqueue(), prq_resume(), and recv(). |
|
|
Definition at line 110 of file dsr-priqueue.h. Referenced by CMUPriQueue(), command(), and log_stats(). |
|
|
Definition at line 111 of file dsr-priqueue.h. Referenced by CMUPriQueue(), command(), log_stats(), and trace(). |
|
|
Definition at line 113 of file dsr-priqueue.h. Referenced by prq_enqueue(), and prq_resume(). |
|
|
Definition at line 109 of file dsr-priqueue.h. Referenced by CMUPriQueue(), log_stats(), prq_dequeue(), prq_enqueue(), prq_get_nexthop(), prq_isfull(), prq_length(), and prq_validate(). |
|
|
Definition at line 120 of file dsr-priqueue.h. Referenced by CMUPriQueue(), and log_stats(). |
|
|
Definition at line 126 of file dsr-priqueue.h. Referenced by CMUPriQueue(), log_stats(), and recv(). |
|
|
Definition at line 125 of file dsr-priqueue.h. Referenced by CMUPriQueue(), log_stats(), and recv(). |
|
|
Definition at line 124 of file dsr-priqueue.h. Referenced by CMUPriQueue(), log_stats(), prq_enqueue(), and prq_resume(). |
|
1.3.3