diff options
authorPau Espin Pedrol <pespin@sysmocom.de>2021-09-09 14:21:18 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-09-09 14:21:21 +0200
commitdf93b188ec73191df57dae5f6150c2b20689060a (patch)
parentcf9cfb66214c785b6ff155ccd7225ca606665058 (diff)
lchan_fsm: Avoid inheriting bs_power from old lchan
So far we were inherting the bs_power in used when activating an lchan for an MS for which we already had previous lchan. For instance, when an MS is first assigned an SDCCH, and later on, it is assigned a TCH to place a voice call. Doing so is, however, not correct because current and old lchans may be placed on different TS or even on different TRX, which means they will have different BS Power restrictions. In the scenario described above, for instance, an SDCCH could have been assigned on C0 and hence have a bs_power of 0, and later on, whenever the TCH lchan as created, it would have inherited the C0 bs_power despite it may have been possible to use a different (lower) max bs power. Furthermore, the lchan->bs_power_db basically stores the *maximum* bs power reduction. Hence it makes not sense at all to copy over the value, since it is anyway not updated from MS measurement reports so far anyway. Fixes: 997a257f8dabe5dd940a1271e56e676a871896d7 Related: SYS#4919 Change-Id: I4a7736aa9a1395e0cc118b98b69896bd0f1e94e6
1 files changed, 9 insertions, 15 deletions
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index a18cba5b7..d06dbacb3 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -681,7 +681,7 @@ static void lchan_fsm_wait_ts_ready_onenter(struct osmo_fsm_inst *fi, uint32_t p
struct osmo_mgcpc_ep_ci *use_mgwep_ci;
struct gsm_lchan *old_lchan = lchan->activate.info.re_use_mgw_endpoint_from_lchan;
struct lchan_activate_info *info = &lchan->activate.info;
- int ms_power_dbm;
+ int ms_power_dbm = bts->ms_max_power;
if (lchan->release.requested) {
lchan_fail("Release requested while activating");
@@ -691,23 +691,17 @@ static void lchan_fsm_wait_ts_ready_onenter(struct osmo_fsm_inst *fi, uint32_t p
lchan->conn = info->for_conn;
/* If there is a previous lchan, and the new lchan is on the same cell as previous one,
- * take over power values. Otherwise, use max power. */
+ * take over MS power values. Otherwise, use configured MS max power. */
if (old_lchan && old_lchan->ts->trx->bts == bts) {
- ms_power_dbm = ms_pwr_dbm(bts->band, old_lchan->ms_power);
- lchan_update_ms_power_ctrl_level(lchan, ms_power_dbm >= 0 ? ms_power_dbm : bts->ms_max_power);
- lchan->bs_power_db = old_lchan->bs_power_db;
- } else {
- lchan_update_ms_power_ctrl_level(lchan, bts->ms_max_power);
- /* Upon last entering the UNUSED state, from lchan_reset():
- * - bs_power_db is still zero, 0dB reduction, output power = Pn. */
- /* Default BS Power reduction value (in dB) */
- if (bts->bs_power_ctrl.mode == GSM_PWR_CTRL_MODE_DYN_BTS)
- lchan->bs_power_db = bts->bs_power_ctrl.bs_power_max_db;
- else
- lchan->bs_power_db = bts->bs_power_ctrl.bs_power_val_db;
+ if ((ms_power_dbm = ms_pwr_dbm(bts->band, old_lchan->ms_power)) == 0)
+ ms_power_dbm = bts->ms_max_power;
+ lchan_update_ms_power_ctrl_level(lchan, ms_power_dbm);
+ /* Default BS Power reduction value (in dB) */
+ lchan->bs_power_db = (bts->bs_power_ctrl.mode == GSM_PWR_CTRL_MODE_DYN_BTS) ?
+ bts->bs_power_ctrl.bs_power_max_db :
+ bts->bs_power_ctrl.bs_power_val_db;
/* BS Power Control is generally not allowed on the BCCH/CCCH carrier.
* However, we allow it in the BCCH carrier power reduction mode of operation. */
if (lchan->ts->trx == bts->c0) {