diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-11-14 20:00:23 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-11-14 20:02:45 +0100 |
commit | d0a2caa021b66d1f5272004c42c817c068be5dc9 (patch) | |
tree | 99d52a190e5bd30ed429aaabc87e299975221693 | |
parent | 38c12e9df9355d7ac6c925296188398904e8fa3f (diff) |
power_control.c: Fix ms pwr ctrl skipped if MS doesn't support announced MS Power Level
Related: OS#1851
Change-Id: I1a9c00fe4eb3fa1eaa7997a9ec20716ddfe180a7
-rw-r--r-- | include/osmo-bts/gsm_data_shared.h | 1 | ||||
-rw-r--r-- | src/common/l1sap.c | 1 | ||||
-rw-r--r-- | src/common/power_control.c | 15 |
3 files changed, 15 insertions, 2 deletions
diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h index 8a52fe9f..bd10056b 100644 --- a/include/osmo-bts/gsm_data_shared.h +++ b/include/osmo-bts/gsm_data_shared.h @@ -322,6 +322,7 @@ struct gsm_lchan { uint8_t current; uint8_t max; bool fixed; + int8_t last_received; /* last received MS Power in uplink L1 SACCH, -1 means not set */ } ms_power_ctrl; /* Power levels for BTS */ uint8_t bs_power; diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 7bf0b09a..4937d1e5 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -1647,6 +1647,7 @@ int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr, struct tlv_parsed * lchan->sacch_deact = 0; lchan->s = lchan->ts->trx->bts->radio_link_timeout; + lchan->ms_power_ctrl.last_received = -1; /* mark no ms power received yet */ rc = l1sap_chan_act_dact_modify(trx, chan_nr, PRIM_INFO_ACTIVATE, 0); if (rc) diff --git a/src/common/power_control.c b/src/common/power_control.c index 574825e5..129334e7 100644 --- a/src/common/power_control.c +++ b/src/common/power_control.c @@ -53,8 +53,19 @@ int lchan_ms_pwr_ctrl(struct gsm_lchan *lchan, /* The phone hasn't reached the power level yet. TODO: store .last and check if MS is trying to move towards current. */ - if (lchan->ms_power_ctrl.current != ms_power) - return 0; + if (lchan->ms_power_ctrl.current != ms_power) { + if (lchan->ms_power_ctrl.last_received == -1 || + lchan->ms_power_ctrl.last_received != ms_power) { + /* MS Power still changing, keep current power level */ + lchan->ms_power_ctrl.last_received = ms_power; + return 0; + } + /* else: we are stuck with some received MS Power level + different than the one we announce, probably because the MS + doesn't support that exact one so it picked the nearest one + */ + lchan->ms_power_ctrl.last_received = ms_power; + } /* How many dBs measured power should be increased (+) or decreased (-) to reach expected power. */ |