aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-01-08 18:57:21 +0100
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-01-08 20:14:00 +0100
commitef53ffe8bbc5a70518bb6bc9072655ec3a4d83c2 (patch)
treedd7e6276166abc04cda07a4824347cf463e37837 /src
parentef99e366262b381773783ea45f50be7d59a42e8e (diff)
power_control: rework handling of DL RxQual measurements
This change makes BS power control loop: - take the lower RxQual threshold (L_RXQUAL_XX_P) into account, so the BS power is increased only if RxQual exceeds this threshold; - apply the configured increase step size instead of reducing the current attenuation by half. MS power loop is not affected, it does not even handle RxQual yet. Change-Id: Ib3c740b9a0f3ba5dfb027e144dc13f456cb26ae2 Related: SYS#4918
Diffstat (limited to 'src')
-rw-r--r--src/common/power_control.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/common/power_control.c b/src/common/power_control.c
index 5e2e85e9..6620add2 100644
--- a/src/common/power_control.c
+++ b/src/common/power_control.c
@@ -274,12 +274,23 @@ int lchan_bs_pwr_ctrl(struct gsm_lchan *lchan,
rxlev = rxlev_full;
}
- /* Bit Error Rate > 0 => reduce by 2 */
- if (rxqual > 0) { /* FIXME: take RxQual threshold into account */
- LOGPLCHAN(lchan, DLOOP, LOGL_INFO, "Reducing Downlink attenuation "
- "by half: %u -> %u dB due to RXQUAL %u > 0\n",
- state->current, state->current / 2, rxqual);
- state->current /= 2;
+ /* If RxQual > L_RXQUAL_XX_P, try to increase Tx power */
+ if (rxqual > params->rxqual_meas.lower_thresh) {
+ uint8_t old = state->current;
+
+ /* Tx power has reached the maximum, nothing to do */
+ if (state->current == 0)
+ return 0;
+
+ /* Increase Tx power by reducing Tx attenuation */
+ if (state->current >= params->inc_step_size_db)
+ state->current -= params->inc_step_size_db;
+ else
+ state->current = 0;
+
+ LOGPLCHAN(lchan, DLOOP, LOGL_INFO, "Reducing Downlink attenuation: "
+ "%u -> %d dB due to RxQual %u worse than L_RXQUAL_XX_P %u\n",
+ old, state->current, rxqual, params->rxqual_meas.lower_thresh);
return 1;
}