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
# 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))))
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
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
}
}