<html><head></head><body><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:x-small;"><div>Hi Jonathan,<br></div><div><br></div><div>I have some questions regarding the algorithm to choose a tin to dequeue from in sch_cake.c:</div>-----------8<------------<br> int oi, best_tin=0;<br> s64 best_time = 0xFFFFFFFFFFFFUL;<br><br> for(oi=0; oi < q->tin_cnt; oi++) {<br> int tin = q->tin_order[oi];<br> b = q->tins + tin;<br> if((b->sparse_flow_count + b->bulk_flow_count) > 0) {<br> s64 tdiff = b->tin_time_next_packet - now;<br> if(tdiff <= 0 || tdiff <= best_time) {<br> best_time = tdiff;<br> best_tin = tin;<br> }<br> }<br> }<br>-----------8<------------<br><br>1) best_time is defined as a positive signed integer, this equals to 78 hours if I did the calculations right. Why did you choose this? Did you mean to define it as "-1"?<br>2) If you meant to define it as "-1", the condition " tdiff <= best_time" would not matter. I can see no case where " tdiff > 0" and " tdiff <= best_time".<br><br>Could you shed some light into this?<br><br>Thank you,<br>George<br><br><br><br><br><br></div></body></html>