print "# THRESHOLD=" THRESHOLD
print "# FUDGE=" FUDGE
print "# DECISION=" DECISION
+ print "# PREFER=" PREFER
print "# PINGSLOTS=" PINGSLOTS
print "# BW_MAX_RX=" BW_MAX_RX
print "# BW_MIN_RX=" BW_MIN_RX
not_increasing_count[pn] = 0 # number of consecutive cycles with no (fudged) latency increase
}
ts = get_time()
- bw_step_rx_next = 1
slice_bw_window_rx(BW_MIN_RX, BW_MAX_RX)
+ if (PREFER == "bandwidth") {
+ prefer_high_bw = 1
+ bw_step_rx_next = bw_maxindex_rx
+ } else if (PREFER == "latency") {
+ prefer_high_bw = 0
+ bw_step_rx_next = 1 + int(bw_maxindex_rx / 4)
+ } else {
+ print "FATAL: BOGUS PREFER SETTING: " PREFER
+ exit 1
+ }
+ set_bw(IFACE_RX, STEPS_RX[bw_step_rx_next])
consec_timeouts = 0
adjust_ts_delta = 0
rx_rate_max = 100 # make something up
}
k--
bw_maxindex_rx = k
- bw_step_rx_next = k
- bw_step_rx_cur = k
- set_bw(IFACE_RX, STEPS_RX[bw_step_rx_next])
}
}
not_increasing_count[peername] = 0
} else if (latency < (ping_prev[peername] + FUDGE / 2) && latency < (ping_pprev[peername] + FUDGE / 2) && ping_prev[peername] < (ping_pprev[peername] + FUDGE/2)) {
+ if (prefer_high_bw == 0) { # no preference for high bw caps configured
+ if (rx_rate < (0.9 * STEPS_RX[bw_step_rx_cur])) { # line not loaded close to current cap, so skip increasing bw
+ adjust_old = ts
+ not_increasing_count[peername]++
+ print "=== " ts " NOOP skiping increase; rx rate too far from current cap of " STEPS_RX[bw_step_rx_cur] "Kbps rx=" rx_rate " tx=" tx_rate
+ return
+ }
+ }
if (not_increasing_count[peername] > (decision_pingslots_factor * PINGSLOTS)) {
if (bw_step_rx_cur < bw_maxindex_rx) {
bw_step_rx_next = bw_step_rx_cur + 1
IFACE_RX='ifb4eth1' # interface to apply downstream SQM to
STATS_TX='/sys/class/net/eth1/statistics/tx_bytes' # upstream bandwidth accounting file for your SQM'd interface (presently not used)
IFACE_TX='eth1' # interface to apply upstream SQM to (presently not used)
-BW_MIN_RX=10000 # your min. acceptable downstream bandwidth to shape to in Kbps
+BW_MIN_RX=4000 # your min. acceptable downstream bandwidth to shape to in Kbps
BW_MAX_RX=30000 # your max. desired downstream bandwidth to shape to in Kbps
-TREND_DECISION="relaxed" # choose either "eager" or "relaxed" - the latter trades additional CPU load for quicker decision making
+TREND_DECISION="eager" # choose either "eager" or "relaxed" - the latter trades additional CPU load for quicker decision making
+OPTIMIZATION_PREFERENCE="latency" # try to optimize for either "latency" (i.e., minimze it) or increased "bandwidth"
}
-for p in traceroute fping awk tc ip
+for p in fping awk tc ip
do
if ! type "${p}" >/dev/null
then
done
+case "${OPTIMIZATION_PREFERENCE}" in
+ latency)
+ ;;
+ bandwidth)
+ ;;
+ *)
+ printf 'FATAL: Invalid setting for OPTIMIZATION_PREFERENCE - choose either "bandwidth" or "latency".\n'
+ exit 1
+ ;;
+esac
+
+
case "${TREND_DECISION}" in
eager)
;;
relaxed)
;;
*)
- printf 'FATAL: Interface "%s" does not seem to have cake SQM set up\n' "${i}"
+ printf 'FATAL: Invalid setting for TREND_DECISION - choose either "eager" or "relaxed".\n'
exit 1
;;
esac
-v BW_MAX_RX="${BW_MAX_RX}" \
-v THRESHOLD="${THRESHOLD}" \
-v DECISION="${TREND_DECISION}" \
+ -v PREFER="${OPTIMIZATION_PREFERENCE}" \
-v PINGSLOTS="${PING_SLOTS_PER_PEER}" \
-v FUDGE="${FUDGE_MS}" \
-v PING_PEERS="${PING_PEERS}" \