From: Johannes Truschnigg Date: Sat, 19 Mar 2022 17:58:43 +0000 (+0100) Subject: Rename bw_step vars for better consistency X-Git-Url: https://johannes.truschnigg.info/gitweb/?a=commitdiff_plain;h=8c3903ecbd6b3abce9e8a75fbbb1c3290db2dd9e;p=sqm_lagthrottle Rename bw_step vars for better consistency Time- and age-based name components shall be last, I just decided. --- diff --git a/__lagdetect.awk b/__lagdetect.awk index 8b2bd32..7c390c4 100644 --- a/__lagdetect.awk +++ b/__lagdetect.awk @@ -50,7 +50,7 @@ BEGIN { not_increasing_count[pn] = 0 # number of consecutive cycles with no (fudged) latency increase } ts = get_time() - bw_next_step_rx = 1 + bw_step_rx_next = 1 slice_bw_window_rx(BW_MIN_RX, BW_MAX_RX) consec_timeouts = 0 adjust_ts_delta = 0 @@ -110,9 +110,9 @@ function slice_bw_window_rx(bw_lower_bound_rx, bw_upper_bound_rx) { } k-- bw_maxindex_rx = k - bw_next_step_rx = k - bw_cur_step_rx = k - set_bw(IFACE_RX, STEPS_RX[bw_next_step_rx]) + bw_step_rx_next = k + bw_step_rx_cur = k + set_bw(IFACE_RX, STEPS_RX[bw_step_rx_next]) } @@ -219,9 +219,9 @@ function adjust_sqm(peername, latency) { if (consec_timeouts > ((1.5 * peer_count) + 2)) { print "# " ts " --- TIMEOUT-caused bw collapse triggered" # print "# " ts " too many TIMEOUTS in a row, decreasing SQM bw" - bw_cur_step_rx = 0 - bw_next_step_rx = 0 - set_bw(IFACE_RX, STEPS_RX[bw_next_step_rx]) + bw_step_rx_cur = 0 + bw_step_rx_next = 0 + set_bw(IFACE_RX, STEPS_RX[bw_step_rx_next]) adjust_old = ts return } @@ -241,13 +241,13 @@ function adjust_sqm(peername, latency) { if (rx_rate < (rx_rate_max * 0.1)) { # XXX TODO is this correct? print "# " ts " line does not appear to be loaded, skipping futile SQM bw downgrade" } else { - if (bw_cur_step_rx > 0) { - bw_next_step_rx = bw_cur_step_rx - 1 - print "--- " ts " choosing bw rx step " bw_next_step_rx " := " STEPS_RX[bw_next_step_rx] "Kbps rx=" rx_rate " tx=" tx_rate - set_bw(IFACE_RX, STEPS_RX[bw_next_step_rx]) - bw_cur_step_rx = bw_next_step_rx + if (bw_step_rx_cur > 0) { + bw_step_rx_next = bw_step_rx_cur - 1 + print "--- " ts " choosing bw rx step " bw_step_rx_next " := " STEPS_RX[bw_step_rx_next] "Kbps rx=" rx_rate " tx=" tx_rate + set_bw(IFACE_RX, STEPS_RX[bw_step_rx_next]) + bw_step_rx_cur = bw_step_rx_next } else { - print "--- " ts " already at lowest bw rx step " bw_cur_step_rx " rx=" rx_rate " tx=" tx_rate + print "--- " ts " already at lowest bw rx step " bw_step_rx_cur " rx=" rx_rate " tx=" tx_rate } } # print "set adjust_old=" ts @@ -256,13 +256,13 @@ function adjust_sqm(peername, latency) { 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 (not_increasing_count[peername] > (decision_pingslots_factor * PINGSLOTS)) { - if (bw_cur_step_rx < bw_maxindex_rx) { - bw_next_step_rx = bw_cur_step_rx + 1 - print "+++ " ts " choosing bw rx step " bw_next_step_rx " := " STEPS_RX[bw_next_step_rx] "Kbps rx=" rx_rate " tx=" tx_rate - set_bw(IFACE_RX, STEPS_RX[bw_next_step_rx]) - bw_cur_step_rx = bw_next_step_rx + if (bw_step_rx_cur < bw_maxindex_rx) { + bw_step_rx_next = bw_step_rx_cur + 1 + print "+++ " ts " choosing bw rx step " bw_step_rx_next " := " STEPS_RX[bw_step_rx_next] "Kbps rx=" rx_rate " tx=" tx_rate + set_bw(IFACE_RX, STEPS_RX[bw_step_rx_next]) + bw_step_rx_cur = bw_step_rx_next } else { - print "+++ " ts " already at highest bw rx step " bw_cur_step_rx " rx=" rx_rate " tx=" tx_rate + print "+++ " ts " already at highest bw rx step " bw_step_rx_cur " rx=" rx_rate " tx=" tx_rate } not_increasing_count[peername] = 0 adjust_old = ts