magnific0 / wondershaper

Command-line utility for limiting an adapter's bandwidth
GNU General Public License v2.0
1.73k stars 264 forks source link

difference between high prio class 1:10 and default class 1:20 #41

Closed patatetom closed 3 years ago

patatetom commented 4 years ago

hi, wouldn't it be the same formula that's used in both classes ?

rate $[40*$USPEED/100]kbit ceil $[95*$USPEED/100]kbit \
magnific0 commented 4 years ago

Sorry can you please explain your remark further. I read your question as "the formulas are the same, shouldn't they be different if prio 2 is lower than prio 1?"

Both classes indeed use the same formula, the only difference is the X=1 or X=2 in the example code below.

   tc class add dev $IFACE parent 1:1 classid 1:X0 htb \
        rate $[40*$USPEED/100]kbit ceil $[95*$USPEED/100]kbit \
        prio X $COMMONOPTIONS

This was equalized in a021ccd2d34d52f1b37e0973bc700c8257dfd604. @saimonn should know the reason for this. But the foggy way I remember it is that the prio 1 traffic was always above the set limit anyway. 95% more matches reality to the settings. But again, I am not sure about that one. I'll leave this open for a bit for you and or @saimonn to comment on this.

patatetom commented 4 years ago

yes, this is the way to understand/read my question : sorry for the lack of clarity.

I read 1:10=>95%, 1:20=>95% and 1:30=>90%, so I asked myself and left you a trail of that questioning.

but I just saw that the formulas were in fact different although they both use 95% : 1:10 uses rate "${RATE}kbit" and 1:20 uses rate "${USPEED}kbit".

oliverkurth commented 4 years ago

Somewhat related to this issue - it looks to me that there is a bug somewhere here:

  RATE=$((40*"$USPEED"/100))
  if [ "$RATE" -eq 0 ]; then RATE=1 ; fi
  tc class add dev "$IFACE" parent 1:1 classid 1:20 htb \
    rate "${USPEED}kbit" ceil $((95*"$USPEED"/100))kbit \
    prio 2 ${COMMONOPTIONS[@]};

RATE is set but never used. And then RATE is set again further down, but never used either.

I think, but I am not sure, that it should be rate ${RATE} in both the 1:20 and the 1:30 classes, just like in the 1:10 class.

magnific0 commented 4 years ago

@oliverkurth you are absolutely right. I have now fixed this.

magnific0 commented 3 years ago

Closing the issue.