aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-10-18 18:39:22 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-10-18 18:45:37 +0200
commit3b02b9ad53aacd83688a8b9e0b3edbaf38b6a4c2 (patch)
tree4035058bb532d6c48f76f6fda0f0cece864789fc /src/common
parent3cd4745efe3efe5620d82f5d67dcd141cabe9549 (diff)
bts_shutdown_fsm: Make sure pending power ramping are aborted before closing TRX
It can happen when using several TRX that all of them go alreadyunder shutdown target tx power level, but that due to configuration the BTS still may want to keep pushing the tx power level even lower. Hence, we end up in a situation where the FSM is trying to close all the TRX while the power ramp procedure is ongoing for some of them. As a result, race conditions can happen where for instance the power ramping procedure for one TRX ends and calls the cb to send SETPOWER after the TRX PHY has been closed (and hence TRXC link is unavaialble). If that happens, the trx_if lower layers store the SETPOWER and attempt a later retransmit, which may take up to 2 seconds after TRX becomes active if BTS reconnects immediatelly. Hence, we end up in some test cases where BTS reconnects and configures some TRX while others are kep unconfigured for a while due to the mentioned delay, hence the test attempting to use the TS while it hasn't been yet configured. The solution is to avoid this kind of unexpected events with ongoing powe ramp once we have decided tx power is lower enough to shutdown the TRX completely. Hence we abort the pending power ramp procedure. Change-Id: Ibca581131eb142d7c38c917a0d6990efec03123c
Diffstat (limited to 'src/common')
-rw-r--r--src/common/bts_shutdown_fsm.c9
-rw-r--r--src/common/tx_power.c8
2 files changed, 15 insertions, 2 deletions
diff --git a/src/common/bts_shutdown_fsm.c b/src/common/bts_shutdown_fsm.c
index a663f5bf..0c6d80c1 100644
--- a/src/common/bts_shutdown_fsm.c
+++ b/src/common/bts_shutdown_fsm.c
@@ -112,8 +112,15 @@ static void st_wait_ramp_down_compl(struct osmo_fsm_inst *fi, uint32_t event, vo
LOGPFSML(fi, LOGL_INFO, "%s Ramping down complete, %u TRX remaining\n",
gsm_trx_name(src_trx), remaining);
- if (remaining == 0)
+ if (remaining == 0) {
+ /* Make sure we end up any remaining ongoing power ramp
+ * down under target shutdown tx power level, then
+ * finally transit to next state:
+ */
+ llist_for_each_entry(trx, &bts->trx_list, list)
+ power_ramp_abort(trx);
bts_shutdown_fsm_state_chg(fi, BTS_SHUTDOWN_ST_WAIT_TRX_CLOSED);
+ }
break;
}
}
diff --git a/src/common/tx_power.c b/src/common/tx_power.c
index 348aba5c..03074221 100644
--- a/src/common/tx_power.c
+++ b/src/common/tx_power.c
@@ -259,7 +259,7 @@ int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass,
}
/* Cancel any pending request */
- osmo_timer_del(&tpp->ramp.step_timer);
+ power_ramp_abort(trx);
/* set the new target */
tpp->p_total_tgt_mdBm = p_total_tgt_mdBm;
@@ -297,6 +297,12 @@ int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass,
return 0;
}
+/* Cancel any pending request */
+void power_ramp_abort(struct gsm_bts_trx *trx)
+{
+ osmo_timer_del(&trx->power_params.ramp.step_timer);
+}
+
/* determine the initial transceiver output power at start-up time */
int power_ramp_initial_power_mdBm(const struct gsm_bts_trx *trx)
{