

Public Member Functions | |
| SRR () | |
| virtual int | command (int argc, const char *const *argv) |
| Packet * | deque (void) |
| void | enque (Packet *pkt) |
| void | clear () |
| PacketSRR * | getMaxflow () |
| int | length () |
| int | blength () |
| int | add_to_WM (int queueid, int weight) |
| int | del_from_WM (int queueid, int weight) |
| wm_node * | getNextNode () |
| virtual void | recv (Packet *, Handler *) |
| virtual void | recv (Packet *p, const char *s) |
| virtual void | updateStats (int queuesize) |
| void | resume () |
| int | blocked () const |
| void | unblock () |
| void | block () |
| int | limit () |
| int | byteLength () |
| virtual double | utilization (void) |
| virtual void | reset () |
| virtual void | destroy () |
| void | enqueue (QueueElem< T > *e) |
| QueueElem< T > * | dequeue () |
| void | detach (QueueElem< T > *e) |
| QueueElem< T > * | getHead () |
| int | is_empty () const |
| int | size () const |
| NsObject * | target () |
| virtual void | drop (Packet *p) |
| 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,...) |
Public Attributes | |
| int | maxqueuenumber_ |
| int | blimit_ |
| int | bytecnt |
| int | pktcnt |
| int | flwcnt |
| int | last_queueid |
| int | last_size |
| PacketSRR | srr [MAXFLOW] |
| int | f2q [MAXFLOW] |
| int | private_rate [MAXFLOW] |
| int | mtu_ |
| int | granularity_ |
| int | maxRate |
| int | minRate |
| WSS | wss |
| wm_node | wmHead [MAXWSSORDER] |
| wm_node | wmTail [MAXWSSORDER] |
| wm_node * | pwmCurr |
| wm_node * | pRowHead [MAXFLOW] |
| wm_node * | pRowTail [MAXFLOW] |
| int | wmEmptyFlag |
| int | maxColumn |
| int | currMaxColumn |
| int | min_quantum |
Protected Member Functions | |
| void | reset () |
| void | utilUpdate (double int_begin, double int_end, int link_state) |
| virtual void | drop (Packet *p, const char *s) |
| void | send (Packet *p, Handler *h) |
| void | handle (Event *) |
Protected Attributes | |
| int | qlim_ |
| int | blocked_ |
| int | unblock_on_resume_ |
| QueueHandler | qh_ |
| PacketQueue * | pq_ |
| double | true_ave_ |
| double | total_time_ |
| double | last_change_ |
| double | old_util_ |
| double | util_weight_ |
| QueueElem< T > * | head_ |
| QueueElem< T > * | tail_ |
| int | size_ |
| NsObject * | target_ |
| NsObject * | drop_ |
| int | debug_ |
|
|
Definition at line 216 of file srr.cc. References blimit_, bytecnt, currMaxColumn, f2q, flwcnt, granularity_, WSS::init(), last_queueid, last_size, maxColumn, MAXFLOW, maxqueuenumber_, maxRate, MAXWSSORDER, min_quantum, minRate, mtu_, wm_node::next, pktcnt, wm_node::prev, private_rate, pRowHead, pRowTail, pwmCurr, wm_node::queueid, wm_node::weight, wmEmptyFlag, wmHead, wmTail, and wss.
00217 { int i;
00218
00219 maxqueuenumber_ = 10;
00220 blimit_ = 25000;
00221 mtu_= 1000; //1000 bytes quantum at default setting
00222 granularity_ = 1000; //default to 1K bit/s
00223
00224 last_queueid = -1; // -1 means that SRR does not have a previous deque operation
00225 last_size = 0;
00226
00227 flwcnt = 0; // init
00228 bytecnt = 0;
00229 pktcnt = 0;
00230 min_quantum = 1000;
00231
00232 pwmCurr = 0; // at first, pwmCurr points to NULL
00233
00234 for(i=0; i<MAXFLOW; i++)
00235 {
00236 private_rate[i] = granularity_; //default quantum value for each flow
00237 f2q[i]=0; // default queue id for all the flow
00238 // or it will not works right at the default config
00239 }
00240
00241 maxRate = 100000000; //100Mbps
00242 minRate = 1000; //1kbps
00243
00244 // init the WM double queues here too.
00245 for(i=0;i<MAXWSSORDER;i++){
00246 wmHead[i].prev=NULL;
00247 wmHead[i].next=&wmTail[i];
00248 wmTail[i].prev=&wmHead[i];
00249 wmTail[i].next=NULL;
00250 wmHead[i].queueid=wmTail[i].queueid=-1; //
00251 wmHead[i].weight=wmHead[i].weight=i;
00252 }
00253
00254 for (i=0;i<MAXFLOW; i++)
00255 pRowHead[i]= pRowTail[i] = NULL;
00256
00257 wmEmptyFlag=1; // it is empty at first
00258 wss.init(MAXWSSORDER); // create the Weight Spread Sequence
00259
00260 currMaxColumn = -1;
00261 maxColumn=0;
00262
00263 // allow the TCL scripts to change the following values
00264 bind("maxqueuenumber_",&maxqueuenumber_); //it is the max queuenumber set in the TCL script
00265 bind("mtu_", &mtu_); // set the Max Transfer Unit of the output link
00266 bind("granularity_", &granularity_); // set the rate allocation granularity of the
00267 // all the flows.
00268 bind("blimit_",&blimit_);
00269 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 474 of file srr.cc. References currMaxColumn, flwcnt, WSS::get_ptr(), maxColumn, wm_node::next, wm_node::prev, pRowHead, pRowTail, pwmCurr, WSS::set_ptr(), wm_node::sibling, wm_node::weight, wmEmptyFlag, wmTail, and wss. Referenced by enque().
00475 {
00476 struct wm_node *pNode;
00477 int i;
00478 //int j=maxColumn;
00479 //int temp=weight;
00480 //int flag=0;
00481
00482 int old_colno = currMaxColumn;
00483
00484 if(weight==0)
00485 {
00486 fprintf(stderr, "add_to_WM: weight should not be zero");
00487 exit(1);
00488 }
00489
00490 if(weight > ( (1<<(maxColumn+1))-1) )
00491 {
00492 fprintf(stderr, "add_to_WM: weight too big");
00493 exit(1);
00494 }
00495
00496 // add to the WM
00497 // adjust currMaxColumn
00498 // if it is a first active flow, put the pwmPtr
00499
00500
00501 for(i=maxColumn; i>=0; i--)
00502 {
00503
00504 if (weight & (1<<i) )
00505 {
00506 //
00507 // add to queueid= i; wmHead[queueid], wmTail[queueid]
00508 pNode=(struct wm_node*)malloc(sizeof(struct wm_node));
00509
00510 if(pNode==NULL)
00511 {
00512 fprintf(stderr, "no memeory to create WM node");
00513 exit(2);
00514 }
00515
00516
00517 pNode->queueid = queueid;
00518 pNode->weight = i;
00519 pNode->sibling = NULL;
00520
00521 if(pRowTail[queueid] == NULL){
00522 pRowHead[queueid]= pRowTail[queueid] = pNode;
00523 }else{
00524 pRowTail[queueid]->sibling = pNode;
00525 pRowTail[queueid] = pNode;
00526 }
00527
00528 if( pwmCurr && (pwmCurr->weight == i) ){
00529 pNode-> prev = pwmCurr->prev;
00530 pNode-> next = pwmCurr;
00531 (pwmCurr->prev)->next = pNode;
00532 pwmCurr->prev = pNode;
00533
00534 }else {
00535
00536 pNode->prev = wmTail[i].prev;
00537 pNode->next = &wmTail[i];
00538 (wmTail[i].prev)->next = pNode;
00539 wmTail[i].prev = pNode;
00540 }
00541
00542 if(currMaxColumn < i)
00543 currMaxColumn = i; // adjust the current max column number
00544
00545 if(wmEmptyFlag == 1)
00546 {
00547 wmEmptyFlag=0;
00548 if(pwmCurr == NULL) // we should let it points to the correct place.
00549 pwmCurr=pNode;
00550 }
00551
00552 }
00553 }
00554
00555 if ( old_colno < currMaxColumn )
00556 {
00557 if(old_colno >= 0){
00558 // if(old_colno > 0){
00559 int pc = wss.get_ptr () + 1;
00560 pc = pc << (currMaxColumn - old_colno);
00561 wss.set_ptr ( pc -1);
00562 // printf("set_ptr in add_to_wm: ptr:%d\n", pc-1);
00563 // printf("old column no: %d %d\n", old_colno, currMaxColumn);
00564 }
00565 }
00566
00567 //printf("in add_to_wm: k:%d, j:%d\n", currMaxColumn, old_colno);
00568 ++flwcnt;
00569 return 0;
00570 }
|
Here is the call graph for this function:

|
|
Definition at line 199 of file srr.cc. References bytecnt.
00199 {
00200 return bytecnt;
00201 }
|
|
|||||||||
|
Definition at line 131 of file queue.h. References Queue< T >::blocked_.
00131 { blocked_ = 1; }
|
|
|||||||||
|
Definition at line 129 of file queue.h. References Queue< T >::blocked_. Referenced by CBQClass::recv().
00129 { return (blocked_ == 1); }
|
|
|||||||||
|
Definition at line 135 of file queue.h. References PacketQueue::byteLength(), and Queue< T >::pq_.
00135 { return pq_->byteLength(); } /* number of bytes *
|
Here is the call graph for this function:

|
|
Definition at line 456 of file srr.cc. References maxqueuenumber_, PacketSRR::pkts, and srr.
00457 {
00458 PacketSRR *q =srr;
00459 int i = maxqueuenumber_;
00460
00461 if (!q)
00462 return;
00463 while (i--) {
00464 if (q->pkts) {
00465 fprintf(stderr, "Changing non-empty flow from srr\n");
00466 exit(1);
00467 }
00468 ++q;
00469 }
00470 }
|
|
||||||||||||
|
Reimplemented from Connector. Definition at line 752 of file srr.cc. References blimit_, bytecnt, Connector::command(), f2q, getOrder(), granularity_, maxColumn, MAXFLOW, MAXQUEUE, maxqueuenumber_, maxRate, MAXWSSORDER, min_quantum, minRate, mtu_, and private_rate.
00753 {
00754
00755
00756 if (argc==3) {
00757
00758 if (strcmp(argv[1], "blimit") == 0) {
00759 blimit_ = atoi(argv[2]);
00760 if (bytecnt > blimit_)
00761 {
00762 fprintf (stderr,"More packets in buffer than the new limit");
00763 exit (1);
00764 }
00765 return (TCL_OK);
00766 }
00767 if (strcmp(argv[1], "maxqueuenumber") == 0) {
00768 //clear();
00769 maxqueuenumber_ = atoi(argv[2]);
00770 return (TCL_OK);
00771 }
00772 if (strcmp(argv[1],"mtu")==0) {
00773 mtu_= atoi(argv[2]);
00774 return (TCL_OK);
00775 }
00776 if (strcmp(argv[1], "granularity")==0) {
00777 granularity_ = atoi(argv[2]);
00778 return (TCL_OK);
00779 }
00780 }
00781
00782 if (argc == 4) {
00783 if(!strcmp(argv[1],"setrate")) {
00784 int rate;
00785 int queue,success=0;
00786 int temp;
00787
00788 success += sscanf(argv[2],"%d",&queue);
00789 success += sscanf(argv[3],"%d",&rate);
00790
00791 if(success!=2){
00792 fprintf(stderr, "SRR setrate ??"); exit(0);
00793 exit(1);
00794 }
00795
00796 if ( queue>MAXQUEUE ) {
00797 fprintf(stderr,"queue id out of range"); exit(0);
00798 }
00799 min_quantum= min_quantum<rate ? min_quantum:rate;
00800 private_rate[queue]=rate;
00801
00802
00803 if(private_rate[queue]<minRate)
00804 private_rate[queue]=minRate;
00805 if(private_rate[queue]>maxRate){
00806 fprintf(stderr, "Rate too hight!\n");
00807 exit(1);
00808 }
00809
00810
00811 success=private_rate[queue]/granularity_;
00812 if(success==0) success=1;
00813 /*if(private_rate[queue]%granularity_)
00814 success++;*/
00815 temp=getOrder(success); //now we have the order of the WSS
00816 if(maxColumn<temp){
00817 maxColumn=temp;
00818
00819 }
00820
00821 #ifdef DEBUG_SRR
00822 printf("maxColumn=%d\n", maxColumn), fflush(0);
00823 #endif
00824 if(maxColumn>(MAXWSSORDER-1)){ //the order of max band flow is too big!
00825 fprintf(stderr, "granularity too small or band too big!");
00826 exit(2);
00827 }
00828
00829 return (TCL_OK);
00830 }
00831
00832 else if(!strcmp(argv[1],"setqueue")) {
00833 int queue,flow,success=0;
00834 success += sscanf(argv[2],"%d",&flow);
00835 success += sscanf(argv[3],"%d",&queue);
00836 if(success==2) {
00837 if ( !(queue<MAXQUEUE) ) {
00838 fprintf(stderr,"queue id out of range");exit(1);
00839 }
00840 if ( !(flow<MAXFLOW) ) {
00841 fprintf(stderr,"flow id out of range"); exit(1);
00842 }
00843
00844 f2q[flow]=queue;
00845
00846 return TCL_OK;
00847 }
00848 }
00849 }
00850 return (Queue::command(argc, argv));
00851 }
|
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 }
|
|
||||||||||||
|
Definition at line 574 of file srr.cc. References currMaxColumn, flwcnt, WSS::get(), WSS::get_ptr(), WSS::inc_ptr(), last_queueid, wm_node::next, wm_node::prev, pRowHead, pRowTail, pwmCurr, wm_node::queueid, WSS::set_ptr(), wm_node::sibling, wm_node::weight, wmEmptyFlag, wmHead, wmTail, and wss. Referenced by deque().
00575 {
00576 struct wm_node *pNode, *pNode2;
00577 int i;
00578 int wss_term;
00579 int temp;
00580
00581
00582 if(pwmCurr->queueid==queueid) // we adjust pwmCurr before we delete the row
00583 {
00584 if (pwmCurr->next != &wmTail[pwmCurr->weight])
00585 pwmCurr = pwmCurr->next ;
00586 else pwmCurr = NULL;
00587 }
00588
00589 /*
00590 for(i=0;i<=currMaxColumn;i++) // travel all double links, and delete the node whose id is queueid
00591 {
00592 pNode=wmHead[i].next;
00593
00594 while(pNode!=&wmTail[i]){
00595 if(pNode->queueid==queueid){ //yes, we get one.
00596 //remove it from the link, and free the node.
00597 (pNode->prev)->next=pNode->next;
00598 (pNode->next)->prev=pNode->prev;
00599 free(pNode);
00600
00601 break;
00602 }
00603 else
00604 pNode=pNode->next;
00605
00606 }
00607
00608 } */
00609
00610 pNode = pRowHead[queueid];
00611 while (pNode){
00612 (pNode->prev)->next=pNode->next;
00613 (pNode->next)->prev=pNode->prev;
00614
00615 pNode2= pNode;
00616 pNode = pNode->sibling;
00617 free(pNode2);
00618 }
00619
00620 pRowHead[queueid] = pRowTail[queueid] = NULL;
00621
00622 // we should adjust currMaxColumn,
00623 //and if currMaxColumn becomes less, we should also adjust WSS's pointer
00624
00625 int old_colno = currMaxColumn;
00626
00627 for(i=currMaxColumn;i>=0;i--)
00628 {
00629 if(wmHead[i].next != &wmTail[i])
00630 {
00631 currMaxColumn=i;
00632 break;
00633 }
00634 }
00635
00636 if(i<0)
00637 {
00638 // it is empty now.
00639 #ifdef DEBUG_SRR
00640 //printf("WM empty\n");
00641 #endif
00642 wmEmptyFlag=1;
00643 currMaxColumn=-1;
00644 pwmCurr=NULL;
00645 last_queueid=-1;
00646 wss.set_ptr (0); // reset the WSS sequence pointer to 0;
00647 goto rr;
00648 } else if ( currMaxColumn < old_colno)
00649 {
00650 int pc = wss.get_ptr () +1;
00651 //printf("pc = %d \n", pc);
00652 int mul = 1 << (old_colno - currMaxColumn );
00653 int tmpc = pc / mul;
00654 if (pc % mul){
00655 tmpc += 1;
00656 if (tmpc > ((1<<(currMaxColumn+1) )- 1) )
00657 tmpc = 1;
00658
00659 }
00660 wss.set_ptr (tmpc -1);
00661 //printf("set_ptr in del_from__wm: ptr:%d\n", tmpc-1);
00662 //printf("k:%d j:%d\n", currMaxColumn, old_colno);
00663
00664 }
00665 if (pwmCurr == NULL){
00666 loop:
00667 wss_term=wss.get(currMaxColumn+1);
00668 wss.inc_ptr (currMaxColumn+1 );
00669 temp = currMaxColumn+1-wss_term;
00670
00671 // try to point pwmCurr to the right place.
00672 if( wmHead[temp].next != &wmTail[temp])
00673 {
00674 pwmCurr=wmHead[temp].next;
00675
00676 }else
00677 goto loop;
00678 }
00679
00680 rr:
00681 --flwcnt;
00682 return 0;
00683 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
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 }
|
|
|
Implements Queue< T >. Definition at line 338 of file srr.cc. References hdr_cmn::access(), hdr_ip::access(), bytecnt, PacketSRR::deficitCounter, del_from_WM(), PacketSRR::deque(), f2q, hdr_ip::flowid(), getNextNode(), granularity_, last_queueid, last_size, PacketSRR::lookup(), mtu_, pktcnt, private_rate, pwmCurr, wm_node::queueid, hdr_cmn::size(), srr, PacketSRR::turn, and wm_node::weight.
00339 {
00340 hdr_cmn *ch;
00341 hdr_ip *iph;
00342 Packet *pkt=0;
00343 int flowid;
00344 int queueid;
00345 PacketSRR *pP;
00346 // static int dcnt = 0;
00347
00348 // if(dcnt <20){
00349 // printf(" in dequeue: %lf \n", Scheduler::instance().clock() );
00350 // dcnt++;
00351 // }
00352 #ifdef DEBUG_SRR
00353 printf(" in deque\n");
00354 #endif
00355
00356 if(last_queueid>=0){
00357 //printf("last size=%d\n ", last_size);
00358 srr[last_queueid].bcount -= last_size;
00359 srr[last_queueid].pkts-=1;
00360 --pktcnt;
00361 bytecnt -= last_size;
00362
00363 if (srr[last_queueid].pkts == 0) {
00364 srr[last_queueid].turn=0;
00365 srr[last_queueid].deficitCounter=0;
00366
00367 // delete the queue from SRR
00368 del_from_WM(last_queueid, private_rate[last_queueid]/granularity_ );
00369 }
00370
00371 }
00372
00373 assert(pktcnt>=0);
00374 if (pktcnt==0) {
00375 // fprintf (stderr,"No active flow\n");
00376 last_queueid=-1;
00377 return(0);
00378 }
00379
00380 if(pwmCurr == NULL){
00381 printf("wrong, pwmCurr is NULL\n");
00382 exit(0);
00383 }
00384
00385 //printf("pktcnt=%d\n", pktcnt);
00386
00387 while (!pkt) {
00388
00389 if(pwmCurr->queueid==-1){ // it should never happen
00390
00391 fprintf(stderr,"pwmCurr points to head or tail\n");
00392 fprintf(stderr, "weight:%d", pwmCurr->weight);
00393 exit(0);
00394 }
00395 pP=&srr[pwmCurr->queueid];
00396
00397 pkt=pP->lookup(0);
00398
00399 if(pkt==0){
00400 fprintf(stderr, "wrong place, should never be here\n");
00401 exit(2);
00402
00403 }
00404
00405 iph = hdr_ip::access(pkt);
00406
00407 flowid=iph->flowid();
00408 queueid= f2q[flowid]; // get the corresponding queue id
00409
00410 assert(queueid== pwmCurr->queueid);
00411
00412 if (!pP->turn) {
00413 pP->deficitCounter+= mtu_; // each queue shares the same quantum!
00414 // this is the difference between DRR!
00415 pP->turn=1;
00416 }
00417
00418 ch=hdr_cmn::access(pkt);
00419
00420 if (pP->deficitCounter >= ch->size()) {
00421 pP->deficitCounter -= (ch->size());
00422 pkt=pP->deque();
00423 last_size=ch->size( );
00424
00425 // pP->bcount -= ch->size();
00426 // --pP->pkts;
00427 // --pktcnt;
00428 // bytecnt -= ch->size();
00429 // if (pP->pkts == 0) {
00430 // pP->turn=0;
00431 // pP->deficitCounter=0;
00432
00433 // delete the queue from SRR
00434 // del_from_WM(queueid, private_rate[queueid]/granularity_ );
00435 //getNextNode();
00436 // }
00437
00438 #ifdef DEBUG_SRR
00439 printf("deque a packet, id=%d, size=%d\n", queueid, last_size);
00440 #endif
00441 last_queueid=queueid;
00442
00443 return pkt;
00444 }
00445 else {
00446 pP->turn=0;
00447
00448 // pwmCurr should be adjusted.
00449 getNextNode( );
00450 pkt=0;
00451 }
00452 }
00453 return 0; // not reached
00454 }
|
Here is the call graph for this function:

|
|||||||||
|
Definition at line 378 of file mcache.h. References Queue< T >::head_, QueueElem< T >::next(), QueueElem< T >::next_, Queue< T >::size_, and Queue< T >::tail_. Referenced by Queue< T >::detach(), and MediaServer::get_next_segment().
|
Here is the call graph for this function:

|
|||||||||
|
Definition at line 358 of file mcache.h. References QueueElem< T >::data(), Queue< T >::head_, and QueueElem< T >::next().
00358 {
00359 QueueElem<T> *p = head_, *q;
00360 while (p != NULL) {
00361 q = p;
00362 p = p->next();
00363 delete q->data();
00364 delete q;
00365 }
00366 head_ = NULL;
00367 }
|
Here is the call graph for this function:

|
||||||||||
|
Definition at line 390 of file mcache.h. References Queue< T >::dequeue(), Queue< T >::head_, QueueElem< T >::next_, Queue< T >::size_, and Queue< T >::tail_. Referenced by MediaServer::command().
00390 {
00391 assert(head_ != 0);
00392 if (head_ == e) {
00393 dequeue();
00394 return;
00395 }
00396 QueueElem<T> *p = head_;
00397 while (p != NULL) {
00398 if (p->next_ != e)
00399 p = p->next_;
00400 else
00401 break;
00402 }
00403 assert(p != NULL);
00404 p->next_ = e->next_;
00405 if (tail_ == e)
00406 tail_ = p;
00407 size_--;
00408 if (size_ == 0)
00409 assert((head_ == 0) && (tail_ == 0));
00410 }
|
Here is the call graph for this function:

|
||||||||||||
|
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 Queue< T >. Definition at line 274 of file srr.cc. References hdr_ip::access(), hdr_cmn::access(), add_to_WM(), PacketSRR::bcount, bytecnt, PacketSRR::deficitCounter, Connector::drop(), PacketSRR::enque(), f2q, hdr_ip::flowid(), granularity_, maxqueuenumber_, pktcnt, PacketSRR::pkts, private_rate, Queue< T >::qlim_, hdr_cmn::size(), and srr.
00275 {
00276 PacketSRR *q;
00277 //PacketSRR *remq;
00278 int flowid, queueid;
00279 int weight;
00280
00281 hdr_cmn *ch=hdr_cmn::access(pkt);
00282 hdr_ip *iph = hdr_ip::access(pkt);
00283
00284 flowid= iph->flowid(); //get the flowid
00285 queueid= f2q[flowid]; // get the corresponding queue id
00286
00287 if(queueid > maxqueuenumber_)
00288 {
00289 fprintf(stderr, "queueid too big\n");
00290 exit(1);
00291 }
00292
00293 #ifdef DEBUG_SRR
00294 printf(" in enque\n"); fflush(0);
00295 #endif
00296
00297
00298 // we drop packets from the longest queue
00299 /* if( bytecnt+ ch->size() > blimit_){
00300
00301 drop(pkt);
00302 return;
00303 }
00304 */
00305
00306 q=&srr[queueid];
00307
00308 if(q->pkts==qlim_){
00309
00310 drop(pkt);
00311 return;
00312 }
00313
00314 q->enque(pkt);
00315
00316 ++q->pkts;
00317 ++pktcnt;
00318 q->bcount += ch->size();
00319 bytecnt +=ch->size();
00320
00321
00322 if (q->pkts==1)
00323 {
00324 //add to the WM
00325 // adjust currMaxColumn
00326 // if it is a first active flow, put the pwmPtr
00327 // all the above works are done in add_to_WM
00328 weight= private_rate[queueid];
00329 weight/=granularity_;
00330
00331 add_to_WM(queueid, weight);
00332
00333 q->deficitCounter=0;
00334 }
00335
00336 }
|
Here is the call graph for this function:

|
||||||||||
|
Definition at line 369 of file mcache.h. References QueueElem< T >::append(), Queue< T >::head_, Queue< T >::size_, and Queue< T >::tail_. Referenced by MediaServer::command(), and MediaServer::get_next_segment().
|
Here is the call graph for this function:

|
|||||||||
|
Definition at line 411 of file mcache.h. References Queue< T >::head_. Referenced by MediaServer::find_prefinfo().
00411 { return head_; }
|
|
|
Definition at line 171 of file srr.cc. References PacketSRR::bcount, maxqueuenumber_, and srr.
00171 { //returns flow with max bytes
00172 int j,i;
00173 PacketSRR *tmp=0;
00174 PacketSRR *maxflow=0;
00175
00176
00177 int bcount=0;
00178
00179 for (i=0;i<maxqueuenumber_;i++) {
00180 tmp=&srr[i];
00181 if (tmp->bcount > bcount){
00182 bcount= tmp->bcount;
00183 maxflow=tmp;j=i;
00184 }
00185 }
00186 if(maxflow==0){
00187 fprintf(stderr, "getMaxflow, err");
00188 exit(1);
00189 }
00190 return maxflow;
00191 }
|
|
|
Definition at line 689 of file srr.cc. References bytecnt, currMaxColumn, WSS::get(), WSS::inc_ptr(), wm_node::next, pwmCurr, wm_node::queueid, wm_node::weight, wmHead, wmTail, and wss. Referenced by deque().
00689 {
00690 //struct wm_node *pNode;
00691 int queueid;
00692 int weight;
00693 int wss_term;
00694 int temp;
00695
00696
00697 if(bytecnt==0){
00698 // printf("getNextNode, pwmCurr = NULL, wmEmptyFlag=%d\n", wmEmptyFlag);
00699 return NULL;
00700 }
00701
00702 queueid=pwmCurr->queueid;
00703 weight= pwmCurr->weight;
00704
00705 if(pwmCurr->next != &wmTail[weight]){ // not the tail
00706 pwmCurr=pwmCurr ->next;
00707 } else{
00708 if (currMaxColumn==-1){
00709 fprintf(stderr, "getNextNode, empty WM");
00710 exit(0);
00711 }
00712
00713 again:
00714 wss_term=wss.get(currMaxColumn+1);
00715 wss.inc_ptr (currMaxColumn+1 );
00716
00717 temp = currMaxColumn+1-wss_term;
00718
00719 // wss_term according to currMaxColumn+1-wss_term queue
00720 if( wmHead[temp].next != &wmTail[temp]) {
00721 pwmCurr=wmHead[temp].next;
00722
00723 }else
00724 goto again;
00725
00726
00727 }
00728
00729 return pwmCurr;
00730 }
|
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 412 of file mcache.h. References Queue< T >::size_. Referenced by MediaServer::command(), and MediaServer::get_next_segment().
00412 { return (size_ == 0); }
|
|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
|
Reimplemented from Queue< T >. Definition at line 194 of file srr.cc. References pktcnt.
00194 {
00195 return pktcnt;
00196 }
|
|
|||||||||
|
Definition at line 132 of file queue.h. References Queue< T >::qlim_. Referenced by dsREDQueue::reset(), and Snoop::snoop_data().
00132 { return qlim_; }
|
|
||||||||||||
|
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. Reimplemented in CBQueue, FQ, and PriQueue. Definition at line 101 of file queue.cc. References Queue< T >::blocked_, Scheduler::clock(), Queue< T >::deque(), Queue< T >::enque(), Scheduler::instance(), Queue< T >::last_change_, Queue< T >::qh_, NsObject::recv(), Connector::target_, and Queue< T >::utilUpdate(). Referenced by PriQueue::recv().
00102 {
00103 double now = Scheduler::instance().clock();
00104 enque(p);
00105 if (!blocked_) {
00106 /*
00107 * We're not blocked. Get a packet and send it on.
00108 * We perform an extra check because the queue
00109 * might drop the packet even if it was
00110 * previously empty! (e.g., RED can do this.)
00111 */
00112 p = deque();
00113 if (p != 0) {
00114 utilUpdate(last_change_, now, blocked_);
00115 last_change_ = now;
00116 blocked_ = 1;
00117 target_->recv(p, &qh_);
00118 }
00119 }
00120 }
|
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 from NsObject. Reimplemented in dsREDQueue, CBQueue, DropTail, PIQueue, RedPDQueue, REDQueue, REMQueue, and RIOQueue. Definition at line 349 of file mcache.h. References Queue< T >::head_, and QueueElem< T >::next().
00349 {
00350 QueueElem<T> *p = head_, *q;
00351 while (p != NULL) {
00352 q = p;
00353 p = p->next();
00354 delete q;
00355 }
00356 head_ = NULL;
00357 }
|
Here is the call graph for this function:

|
|||||||||
|
Reimplemented from NsObject. Reimplemented in dsREDQueue, CBQueue, DropTail, PIQueue, RedPDQueue, REDQueue, REMQueue, and RIOQueue. Definition at line 174 of file queue.cc. References Queue< T >::deque(), Connector::drop(), Queue< T >::total_time_, and Queue< T >::true_ave_. Referenced by REDQueue::reset(), PIQueue::reset(), dsREDQueue::reset(), and DropTail::reset().
00175 {
00176 Packet* p;
00177 total_time_ = 0.0;
00178 true_ave_ = 0.0;
00179 while ((p = deque()) != 0)
00180 drop(p);
00181 }
|
Here is the call graph for this function:

|
|||||||||
|
Definition at line 154 of file queue.cc. References Queue< T >::blocked_, Scheduler::clock(), Queue< T >::deque(), Scheduler::instance(), Queue< T >::last_change_, Queue< T >::qh_, NsObject::recv(), Connector::target_, Queue< T >::unblock_on_resume_, and Queue< T >::utilUpdate(). Referenced by WRR_CBQueue::deque(), CBQueue::deque(), and QueueHandler::handle().
00155 {
00156 double now = Scheduler::instance().clock();
00157 Packet* p = deque();
00158 if (p != 0) {
00159 target_->recv(p, &qh_);
00160 } else {
00161 if (unblock_on_resume_) {
00162 utilUpdate(last_change_, now, blocked_);
00163 last_change_ = now;
00164 blocked_ = 0;
00165 }
00166 else {
00167 utilUpdate(last_change_, now, blocked_);
00168 last_change_ = now;
00169 blocked_ = 1;
00170 }
00171 }
00172 }
|
Here is the call graph for this function:

|
||||||||||||
|
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 413 of file mcache.h. References Queue< T >::size_. Referenced by JoBS::arvAccounting(), JoBS::assignRateDropsADC(), dsREDQueue::deque(), JoBS::dropFront(), JoBS::dropTail(), RedPDQueue::enque(), JoBS::enque(), MediaServer::get_next_segment(), JoBS::pickDroppedRLC(), and FQ::recv().
00413 { return size_; }
|
|
|
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 130 of file queue.h. References Queue< T >::blocked_.
00130 { blocked_ = 0; }
|
|
||||||||||
|
Definition at line 141 of file queue.cc. References Scheduler::clock(), Scheduler::instance(), Queue< T >::total_time_, and Queue< T >::true_ave_. Referenced by REDQueue::deque(), DropTail::deque(), REDQueue::enque(), and DropTail::enque().
00142 {
00143 double now = Scheduler::instance().clock();
00144 double newtime = now - total_time_;
00145 if (newtime > 0.0) {
00146 double oldave = true_ave_;
00147 double oldtime = total_time_;
00148 double newtime = now - total_time_;
00149 true_ave_ = (oldtime * oldave + newtime * queuesize) /now;
00150 total_time_ = now;
00151 }
00152 }
|
Here is the call graph for this function:

|
||||||||||
|
Definition at line 130 of file queue.cc. References Queue< T >::blocked_, Scheduler::clock(), Scheduler::instance(), Queue< T >::last_change_, Queue< T >::old_util_, and Queue< T >::utilUpdate(). Referenced by QSAgent::recv().
00131 {
00132 double now = Scheduler::instance().clock();
00133
00134 utilUpdate(last_change_, now, blocked_);
00135 last_change_ = now;
00136
00137 return old_util_;
00138
00139 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 122 of file queue.cc. References Queue< T >::old_util_, and Queue< T >::util_weight_. Referenced by Queue< T >::recv(), Queue< T >::resume(), and Queue< T >::utilization().
|
|
|
|
|
|||||
|
Definition at line 143 of file queue.h. Referenced by Queue< T >::block(), Queue< T >::blocked(), Queue< T >::Queue(), Queue< T >::recv(), FQ::recv(), CBQueue::recv(), PriQueue::recvHighPriority(), Queue< T >::resume(), CBQueue::sched(), Queue< T >::unblock(), and Queue< T >::utilization(). |
|
|
Definition at line 131 of file srr.cc. Referenced by blength(), command(), deque(), enque(), getNextNode(), and SRR(). |
|
|
Definition at line 167 of file srr.cc. Referenced by add_to_WM(), del_from_WM(), getNextNode(), and SRR(). |
|
|
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 133 of file srr.cc. Referenced by add_to_WM(), del_from_WM(), and SRR(). |
|
|
|
|
|||||
|
Definition at line 416 of file mcache.h. Referenced by Queue< T >::dequeue(), Queue< T >::destroy(), Queue< T >::detach(), Queue< T >::enqueue(), Queue< T >::getHead(), Queue< T >::Queue(), Queue< T >::reset(), and Queue< T >::~Queue(). |
|
|||||
|
Definition at line 154 of file queue.h. Referenced by Queue< T >::recv(), Queue< T >::resume(), and Queue< T >::utilization(). |
|
|
Definition at line 135 of file srr.cc. Referenced by del_from_WM(), deque(), and SRR(). |
|
|
|
|
|
Definition at line 164 of file srr.cc. Referenced by add_to_WM(), command(), and SRR(). |
|
|
Definition at line 129 of file srr.cc. Referenced by clear(), command(), enque(), getMaxflow(), and SRR(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
Definition at line 155 of file queue.h. Referenced by Queue< T >::utilization(), and Queue< T >::utilUpdate(). |
|
|
|
|
|||||
|
|
|
|
|
Definition at line 158 of file srr.cc. Referenced by add_to_WM(), del_from_WM(), and SRR(). |
|
|
Definition at line 159 of file srr.cc. Referenced by add_to_WM(), del_from_WM(), and SRR(). |
|
|
Definition at line 156 of file srr.cc. Referenced by add_to_WM(), del_from_WM(), deque(), getNextNode(), and SRR(). |
|
|||||
|
Definition at line 145 of file queue.h. Referenced by Queue< T >::recv(), FQ::recv(), PriQueue::recvHighPriority(), Queue< T >::resume(), and CBQueue::sched(). |
|
|||||
|
Definition at line 142 of file queue.h. Referenced by Vq::checkPacketForECN(), Vq::enque(), enque(), RIOQueue::enque(), REMQueue::enque(), REDQueue::enque(), PIQueue::enque(), Marker::enque(), JoBS::enque(), GK::enque(), DropTail::enque(), Demarker::enque(), Queue< T >::limit(), RIOQueue::print_edp(), REDQueue::print_edp(), Queue< T >::Queue(), and PriQueue::recvHighPriority(). |
|
|||||
|
Definition at line 417 of file mcache.h. Referenced by Queue< T >::dequeue(), Queue< T >::detach(), Queue< T >::enqueue(), Queue< T >::is_empty(), Queue< T >::Queue(), and Queue< T >::size(). |
|
|
Definition at line 138 of file srr.cc. Referenced by clear(), deque(), enque(), and getMaxflow(). |
|
|||||
|
Definition at line 416 of file mcache.h. Referenced by Queue< T >::dequeue(), Queue< T >::detach(), Queue< T >::enqueue(), and Queue< T >::Queue(). |
|
|
|||||
|
Definition at line 150 of file queue.h. Referenced by REDQueue::print_summarystats(), DropTail::print_summarystats(), Queue< T >::reset(), and Queue< T >::updateStats(). |
|
|||||
|
Definition at line 149 of file queue.h. Referenced by REDQueue::print_summarystats(), DropTail::print_summarystats(), Queue< T >::reset(), and Queue< T >::updateStats(). |
|
|||||
|
Definition at line 144 of file queue.h. Referenced by Queue< T >::Queue(), and Queue< T >::resume(). |
|
|||||
|
Definition at line 156 of file queue.h. Referenced by Queue< T >::Queue(), and Queue< T >::utilUpdate(). |
|
|
Definition at line 162 of file srr.cc. Referenced by add_to_WM(), del_from_WM(), and SRR(). |
|
|
Definition at line 154 of file srr.cc. Referenced by del_from_WM(), getNextNode(), and SRR(). |
|
|
Definition at line 155 of file srr.cc. Referenced by add_to_WM(), del_from_WM(), getNextNode(), and SRR(). |
|
|
Definition at line 148 of file srr.cc. Referenced by add_to_WM(), del_from_WM(), getNextNode(), and SRR(). |
1.3.3