[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[altq 89] Some questons about cutoff_



Hi,
 
I have some questions about the setting of cutoff_. I don't understand it so well, so please correct me if you think what I describe below is not correct!
 
The cutoff_ is the variable used to achieve the heuristics of Top-Level link-sharing.  In paper "Link-sharing and Resource Management Modules for Packet Networks", page 8 or section Top-Level link-sharing guidelines, it says
1: If a packet arrives for anot-verlimit class, set Top-Level to 1
2: If Top-Level is i, and a packet arrives for an overlimit class with an underlimit parent at a lower level than i(say j), then set Top-Level to j.
3: After a packet is sent from a class, and that class now either has an empty queue or is unable to continue unregulated, then set Top-Level to Infinity.
 
I think rmc_queue_packet() implements rule 1 and 2.
 
My quesitons are
 
1:
In line 1079 of _rmc_wrr_dequeue_next() in altq_rmclass.c
 
    1079: ifd->cutoff_ = cl->borrow_->depth_;
 
and line 11979 of _rmc_prr_dequeue_next() in altq_rmclass.c
 
    1079: ifd->cutoff_ = cl->borrow_->depth_;
 
Why does it set cutoff_ to the new value?
 
2: I guess that from line 1490 of rmc_update_class_util() in altq_rmclass.c implements rule 3
 
1490:  if (borrowed && (ifd->cutoff_ >= borrowed->depth_)) {
#if 1 /* ALTQ */
1492:   if ((qlen(cl->q_) <= 1) || TV_LT(nowp, &borrowed->undertime_)) {
   rmc_tl_satisfied(ifd, nowp);
   CBQTRACE(rmc_update_class_util, 'broe', ifd->cutoff_);
  }
  else {
   ifd->cutoff_ = borrowed->depth_;
   CBQTRACE(rmc_update_class_util, 'ffob', borrowed->depth_);
  }
#else /* !ALTQ */
  if ((qlen(cl->q_) <= 1) || TV_LT(&now, &borrowed->undertime_)) {
   reset_cutoff(ifd);
#ifdef notdef
   rmc_tl_satisfied(ifd, &now);
#endif
   CBQTRACE(rmc_update_class_util, 'broe', ifd->cutoff_);
  }
  else {
   ifd->cutoff_ = borrowed->depth_;
   CBQTRACE(rmc_update_class_util, 'ffob', borrowed->depth_);
  }
#endif /* !ALTQ */
 }
I don't understand line 1492, why the condition is not
qlen(cl->q_) <= 0
But is qlen(cl->q_) < = 1

I also don't understand line 1490,
1490:  if (borrowed && (ifd->cutoff_ >= borrowed->depth_))
why we reset the cutoff_ value only if a class borrowed.
 
Suppose in the begining, one packet is classify to an underlimit class and rmc_queue_packet() executes
 
  if (TV_LT(&cl->undertime_, &now)) {
   if (ifd->cutoff_ > cl->depth_)
    ifd->cutoff_ = cl->depth_;
...
to set the cutoff_ to be cl->depth_.
 
If the scheduler chooses this class to be the one to send the next packet. Since it is underlimit it doesn't have to borrow, 
ifd->borrowed_[ifd->qo_] in rmc_update_class_util() would be 0.
 
the condition in
1490:  if (borrowed && (ifd->cutoff_ >= borrowed->depth_))
would fail and not to modify the cutoff_ value. But actually, the sending class is no more unsatisfied(underlimit but still has packets to send), the cutoff_ value should be modifed.
 
Do I misundersand anything?

 
Lin Su-Mei