]> johannes.truschnigg.info Git - sqm_lagthrottle/commitdiff
Increase bw steps in low-latency mode
authorJohannes Truschnigg <johannes@truschnigg.info>
Sat, 19 Mar 2022 20:09:17 +0000 (21:09 +0100)
committerJohannes Truschnigg <johannes@truschnigg.info>
Sat, 19 Mar 2022 20:09:17 +0000 (21:09 +0100)
__lagdetect.awk

index 63cf2c5deb7972550e260d458e3bfc17bd377312..c97a8fc12d86ab7ee247508c0d906614ec12f97e 100644 (file)
@@ -50,14 +50,21 @@ BEGIN {
     ping_pprev[pn] = -1 # latency recorded in the pre-previous cycle
     not_increasing_count[pn] = 0 # number of consecutive cycles with no (fudged) latency increase
   }
+  if (PREFER == "bandwidth") {
+    bw_slice_exponent = 1.6
+  } else if (PREFER == "latency") {
+    bw_slice_exponent = 1.95
+  }
   ts = get_time()
   slice_bw_window_rx(BW_MIN_RX, BW_MAX_RX)
   if (PREFER == "bandwidth") {
     prefer_high_bw = 1
     bw_step_rx_next = bw_maxindex_rx
+    bw_step_rx_cur = bw_maxindex_rx
   } else if (PREFER == "latency") {
     prefer_high_bw = 0
     bw_step_rx_next = 1 + int(bw_maxindex_rx / 4)
+    bw_step_rx_cur = 1 + int(bw_maxindex_rx / 4)
   } else {
     print "FATAL: BOGUS PREFER SETTING: " PREFER
     exit 1
@@ -113,7 +120,8 @@ BEGIN {
 # XXX TODO impl. tunable for acting more fine-grained?
 function slice_bw_window_rx(bw_lower_bound_rx, bw_upper_bound_rx) {
   bw_bound_delta_rx = (bw_upper_bound_rx - bw_lower_bound_rx)
-  bw_steps_rx = 1 + int((log(bw_bound_delta_rx) / log(10)) ^ 1.6)
+  bw_steps_rx = 1 + int((log(bw_bound_delta_rx) / log(10)) ^ bw_slice_exponent)
+  print "# EXP=" bw_slice_exponent
   print "# STEPS_RX=" bw_steps_rx
   for (k = 0; k <= bw_steps_rx; k++) {
     STEPS_RX[k] = int((bw_lower_bound_rx + (k * (bw_bound_delta_rx / bw_steps_rx))))
@@ -247,6 +255,7 @@ function adjust_sqm(peername, latency) {
     if (latency > ping_prev[peername] && latency > ping_pprev[peername]) {
       if (prefer_high_bw == 0) {
           bw_step_rx_next = 0
+          bw_step_rx_cur = 0
           print "--- " ts " low-latency mode enforces 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])
          return
@@ -270,7 +279,7 @@ function adjust_sqm(peername, latency) {
     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
        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
+        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
       }
     }