Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stab setting to better Accurate. #3

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions supershaper.init
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ UPLINK_BW=3422 # 3.4Mbps, measured 2017-08-31
# calculated bandwidth (see UPLINK below) you modem is probably still
# queuing packets. This can only be set by trial an error, but 90% is
# probably a good ballpark number.
UPLINK_PERCENT=90
UPLINK_PERCENT=98

# Skype normally uses a random UDP/TCP port, but specify it manually to be
# able to control it better
Expand Down Expand Up @@ -108,6 +108,14 @@ TC=tc
# Where to store flow labels, accessible for other tools
FLOWS_FILENAME="/run/tc-flows.csv"

# Stab setting
# Configure a stab to calculate a more accurate queue size and avoid wasting bandwidth.
# PPPoE ADSL/VDSL over ATM
STAB="stab linklayer ethernet overhead 40"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yutayu This number 40 is what I call a "magic number". You should include (in a comment) how it was calculated. Same for the number 10 below.

# PPPoA ADSL/VDSL over ATM
# STAB="stab linklayer atm overhead 10"
# If you are using any other line, refer to the following. http://linuxcommandlibrary.com/man/tc-stab.html

##############################################################################
######## Nothing to change below this line unless you're adventurous #########
##############################################################################
Expand All @@ -118,7 +126,9 @@ UPLINK=$((UPLINK_PERCENT*UPLINK_BW/100))
# Which qdisc to use for HFSC leaves
# Turns out that the old sfq seems to work better than fq_codel in
# conjunction with HFSC Try out both and decide for yourself
LEAF_QDISC="sfq divisor 65536 headdrop"
# Quantum must be greater than or equal to MTU. Also, on ATM lines, Quantum should be a multiple of (48 + 5) = 53.
# If MTU = 1500 , 1500 + 40 < 48 * 33 = 1584 , 33 * ( 48 + 5 ) = 1749.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yutayu If you intend the SFQ quantum to be changed by the user, it should be a variable above line 119.

That calculation in the comment contains too many magic numbers. Please explain what those numbers are, like IP header, ATM header, PPP header, etc.

LEAF_QDISC="sfq divisor 65536 headdrop quantum 1749"
#LEAF_QDISC="fq_codel noecn"

filter_prio=1
Expand Down Expand Up @@ -147,7 +157,7 @@ function start_me {
################### FLOW DEFINITIONS ###################

# Add root qdisc
$TC qdisc add dev $DEV root handle 1: hfsc default 50
$TC qdisc add dev $DEV root handle 1: $STAB hfsc default 50

# Add main class, setting interface rate limit (your upstream max bandwidth)
$TC class add dev $DEV parent 1: classid 1:1 hfsc ls m2 "${UPLINK}kbit" ul m2 "${UPLINK}kbit"
Expand Down