Set quantum on htb root parent dev

This commit is contained in:
hk 2017-01-27 10:40:19 +01:00
parent a8d3bdfd1c
commit 905d62e4a6
1 changed files with 6 additions and 10 deletions

View File

@ -128,12 +128,10 @@ print_version () {
get_htb_quantum () { get_htb_quantum () {
# Takes input rate in mbit/s as parameter # Takes input rate in mbit/s as parameter
local RATE=$1 local RATE=$1
local QUANTUM local QUANTUM=8000
if [[ ${RATE} -lt 40 ]]; then if [[ ${RATE} -lt 40 ]]; then
QUANTUM=1514 QUANTUM=1514
else
QUANTUM=8000
fi fi
echo ${QUANTUM} echo ${QUANTUM}
@ -145,12 +143,10 @@ get_target () {
local MTU=$2 local MTU=$2
local KBYTES=$(( ${RATE} * 1000 / 8 )) local KBYTES=$(( ${RATE} * 1000 / 8 ))
local MS=$(( ${MTU} / ${KBYTES} )) local MS=$(( ${MTU} / ${KBYTES} ))
local TARGET local TARGET=5
if [[ ${MS} -gt 5 ]]; then if [[ ${MS} -gt 5 ]]; then
TARGET=$(( ${MS} + 1 )) TARGET=$(( ${MS} + 1 ))
else
TARGET=5
fi fi
echo "${TARGET}.0ms" echo "${TARGET}.0ms"
@ -195,7 +191,7 @@ get_tx_offloads () {
get_limit () { get_limit () {
# Takes rate in mbit/s as parameter # Takes rate in mbit/s as parameter
local RATE=$1 local RATE=$1
local LIMIT local LIMIT=10000
if [[ ${RATE} -le 10 ]]; then if [[ ${RATE} -le 10 ]]; then
LIMIT=600 LIMIT=600
@ -203,8 +199,6 @@ get_limit () {
LIMIT=800 LIMIT=800
elif [[ ${RATE} -le 1000 ]]; then elif [[ ${RATE} -le 1000 ]]; then
LIMIT=1200 LIMIT=1200
else
LIMIT=10000
fi fi
echo ${LIMIT} echo ${LIMIT}
@ -245,7 +239,9 @@ apply_egress_shaping () {
${TC} qdisc add dev ${IF_NAME} root handle 1: htb default 99 ${TC} qdisc add dev ${IF_NAME} root handle 1: htb default 99
# Set the overall shaped rate of the interface # Set the overall shaped rate of the interface
${TC} class add dev ${IF_NAME} parent 1: classid 1:1 htb rate ${UP_RATE}mbit ${TC} class add dev ${IF_NAME} parent 1: classid 1:1 htb \
rate ${UP_RATE}mbit \
quantum $(get_htb_quantum ${UP_RATE})
local DEFAULT_RATE=${UP_RATE} local DEFAULT_RATE=${UP_RATE}
local DEFAULT_PRIO=4 local DEFAULT_PRIO=4