From: Johannes Truschnigg Date: Sat, 3 Sep 2022 14:34:05 +0000 (+0200) Subject: Phase out settings-in-wrapper-script config style X-Git-Url: https://johannes.truschnigg.info/gitweb/?a=commitdiff_plain;h=9ac30f0ce4c5641e29fe4d70bc1dedad10964fb8;p=sqm_lagthrottle Phase out settings-in-wrapper-script config style Making use of the config wizard/suggester is the better approach to generating an "out of band"-style config that can be managed independently from the implementation itself. --- diff --git a/sqm_lagthrottle.sh b/sqm_lagthrottle.sh index 8d41030..fa970cb 100755 --- a/sqm_lagthrottle.sh +++ b/sqm_lagthrottle.sh @@ -21,20 +21,20 @@ # probably do more harm than good. Please be aware that this is work in # progress, and the main application logic is implemented in the awk script. -# HINT: You may want to use `sqm_lagthrottle_suggest_config.sh` from this +# HINT: You will want to use `sqm_lagthrottle_suggest_config.sh` from this # distribution to get (hopefully) sensible configuration values for most of # the below settings! -FUDGE_MS=20.0 # "fudge" factor in msec that your PING_PEERS are expected to fluctuate in latency under normal conditions -PING_PEERS='1.1.1.1 8.8.8.8' # space-separated list of peer addresses to ping -BW_MIN_RX=4000 # CHANGE THIS - your min. acceptable downstream bandwidth to shape to in Kbps -BW_MAX_RX=30000 # CHANGE THIS - your max. desired downstream bandwidth to shape to in Kbps -STATS_RX='/sys/class/net/ifb4eth1/statistics/tx_bytes' # CHANGE THIS - downstream bandwidth accounting file for your SQM'd interface -IFACE_RX='ifb4eth1' # CHANGE THIS - interface to apply downstream SQM to -STATS_TX='/sys/class/net/eth1/statistics/tx_bytes' # CHANGE THIS - upstream bandwidth accounting file for your SQM'd interface (presently unused) -IFACE_TX='eth1' # CHANGE THIS - interface to apply upstream SQM to (presently unused) -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" +## FUDGE_MS="" # "fudge" factor in msec that your PING_PEERS are expected to fluctuate in latency under normal conditions +## PING_PEERS=""# space-separated list of peer addresses to ping +## BW_MIN_RX="" # CHANGE THIS - your min. acceptable downstream bandwidth to shape to in Kbps +## BW_MAX_RX="" # CHANGE THIS - your max. desired downstream bandwidth to shape to in Kbps +## STATS_RX="" # CHANGE THIS - downstream bandwidth accounting file for your SQM'd interface +## IFACE_RX="" # CHANGE THIS - interface to apply downstream SQM to +## STATS_TX="" # CHANGE THIS - upstream bandwidth accounting file for your SQM'd interface (presently unused) +## IFACE_TX="" # CHANGE THIS - interface to apply upstream SQM to (presently unused) +## TREND_DECISION="" # choose either "eager" or "relaxed" - the latter trades additional CPU load for quicker decision making +## OPTIMIZATION_PREFERENCE="" # try to optimize for either "latency" (i.e., minimze it) or increased "bandwidth" # Less commonly changed config knobs PING_SLOTS_PER_PEER=5 # number of samples per PING_PEER to calculate averages over @@ -50,7 +50,7 @@ THRESHOLD=1.2 # factor relevant in judging current latency compared to avg. - le TZ=UTC LC_ALL=C export TZ LC_ALL -SQML_CFGFILE=./sqm_lagthrottle.conf +SQML_CFGFILE="${1:-./sqm_lagthrottle.conf}" __is_num() { @@ -102,8 +102,8 @@ done if [ -r "${SQML_CFGFILE}" ] && sh -n "${SQML_CFGFILE}" then - printf '# INFO: Evaluating configuration delta from file "%s"...\n' "${SQML_CFGFILE}" - eval "PS4='# SETTING: ' set -x; $(grep -E '[A-Z][A-Z_]+=' "${SQML_CFGFILE}"); set +x" + printf '# INFO: Evaluating configuration file at "%s"...\n' "${SQML_CFGFILE}" + eval "PS4='# CONFIG: ' set -x; $(grep -E '[A-Z][A-Z_]+=' "${SQML_CFGFILE}"); set +x" _cfg_ok=$? set +x if [ ${_cfg_ok} -ne 0 ]