Skip to content

Commit

Permalink
Make disabling of tso and gso bandwith dependant
Browse files Browse the repository at this point in the history
  • Loading branch information
hkbakke committed Jan 27, 2017
1 parent d751745 commit 6e4a6f6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/tc-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ get_mtu () {
cat /sys/class/net/${1}/mtu
}

get_tx_offloads () {
# Takes rate in mbit/s as parameter
local RATE=$1

if [[ ${RATE} -lt 40 ]]; then
echo "tso off gso off"
else
echo "tso on gso on"
fi
}

get_limit () {
# Takes rate in mbit/s as parameter
local RATE=$1
Expand Down Expand Up @@ -227,10 +238,8 @@ print_config () {
}

apply_egress_shaping () {
# tso and probably gso on the outgoing interface makes the shaping
# inaccurate in my tests. It is not unusable with these on but the CPU
# hit is minimal in my tests and it makes the shaping much more accurate.
${ETHTOOL} --offload ${IF_NAME} tso off gso off
# Disable tso and gso for lower bandwiths
${ETHTOOL} --offload ${IF_NAME} $(get_tx_offloads ${UP_RATE})

# Add root handle and set default leaf
${TC} qdisc add dev ${IF_NAME} root handle 1: htb default 99
Expand Down

0 comments on commit 6e4a6f6

Please sign in to comment.