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

[altq 45] Re: When a class is delayed (undertime)




Fulvio,

Today I finally had time to look into the undertime issue.
I'm now convinced that your suggestion makes sense under a steady
state.

CBQ keeps track of a time line of trasmission finish time that is
skewed by a number of packets in the network card.
In the current implementation, an overlimit class is suspended until
it becomes underlimit in the real time.  As a result, the skew is
added to the packet interval when a suspended class is resumed.
It makes sense to resume the suspended class earlier by the amount of
the skew.

Also, I have found two other minor problems:
 1. the target idle time should not include the packet transmission
    time (pkt_time) since it is already added to the finish time (ifnow).
 2. the undertime should not be cancelled.  (undertime + offtime) will
    make "avgidle" big enough to send "minburst" packets.

-Kenjiro

--- altq_rmclass.c-	Fri Jun 18 17:09:52 1999
+++ altq_rmclass.c	Fri Jun 18 20:44:57 1999
@@ -1270,7 +1270,7 @@
 	int		idle, avgidle, pktlen;
 	rm_class_t	*cl, *borrowed;
 	rm_class_t	*borrows;
-	long 		pkt_time;
+	long 		pkt_time, tidle;
 	struct timeval	*nowp;
 
 	/*
@@ -1369,8 +1369,8 @@
 				avgidle = cl->avgidle_ = cl->minidle_;
 #endif
 			/* set next idle to make avgidle 0 */
-			pkt_time += (1 - RM_POWER) * avgidle >> RM_FILTER_GAIN;
-			TV_ADD_DELTA(&ifd->ifnow_, pkt_time, &cl->undertime_);
+			tidle = (1 - RM_POWER) * avgidle >> RM_FILTER_GAIN;
+			TV_ADD_DELTA(nowp, tidle, &cl->undertime_);
 			++cl->stats_.over;
 		} else {
 			cl->avgidle_ =
@@ -1511,8 +1511,6 @@
 	int	t;
 
 	cl->stats_.overactions++;
-	if (TV_LT(&cl->overtime_, &cl->ifdat_->ifnow_))
-		cl->overtime_ = cl->ifdat_->ifnow_;
 	TV_DELTA(&cl->undertime_, &cl->overtime_, delay);
 #ifndef BORROW_OFFTIME
 	delay += cl->offtime_;
@@ -1532,10 +1530,6 @@
 #else /* BORROW_OFFTIME */
 		TV_ADD_DELTA(&cl->undertime_, cl->offtime_, &cl->undertime_);
 #endif /* BORROW_OFFTIME */
-		/* this code cancels the undertime set in rmc_update_class_util. */
-		TV_ADD_DELTA(&cl->undertime_,
-			     -((1 - RM_POWER) * cl->avgidle_) >> RM_FILTER_GAIN,
-			     &cl->undertime_);
 		cl->sleeping_ = 1;
 		cl->stats_.delays++;