diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-06-17 20:20:15 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-06-23 14:53:33 +0200 |
commit | 69299114f82215e964d8e10c7b84c0fe51cf9c33 (patch) | |
tree | b01203db5902c505d840c4669e40af3a18a5db3c | |
parent | fee04adc751747a476ce832be26a488df01f852e (diff) |
Implement tx power ramp down during BTS shutdown
Upon BTS shutdown (for instance because the Abis link against BSC was
lost), stop the operation in an ordered manner (cell soft lock). This
means slowly decrease tx power so that MS have time to handover to other
neighbour cells.
Related: SYS#4920
Change-Id: I70e34dda8974ebd94aea33bd9fb1d99f9063cc55
-rw-r--r-- | include/osmo-bts/bts_shutdown_fsm.h | 1 | ||||
-rw-r--r-- | src/common/bts_shutdown_fsm.c | 38 | ||||
-rw-r--r-- | src/common/gsm_data.c | 11 |
3 files changed, 43 insertions, 7 deletions
diff --git a/include/osmo-bts/bts_shutdown_fsm.h b/include/osmo-bts/bts_shutdown_fsm.h index 1268b2b6..42f953a3 100644 --- a/include/osmo-bts/bts_shutdown_fsm.h +++ b/include/osmo-bts/bts_shutdown_fsm.h @@ -33,6 +33,7 @@ enum bts_shutdown_fsm_states { enum bts_shutdown_fsm_events { BTS_SHUTDOWN_EV_START, + BTS_SHUTDOWN_EV_TRX_RAMP_COMPL, }; extern struct osmo_fsm bts_shutdown_fsm; diff --git a/src/common/bts_shutdown_fsm.c b/src/common/bts_shutdown_fsm.c index 50ef652e..faa92a0b 100644 --- a/src/common/bts_shutdown_fsm.c +++ b/src/common/bts_shutdown_fsm.c @@ -47,17 +47,41 @@ static void st_none(struct osmo_fsm_inst *fi, uint32_t event, void *data) } } +static void ramp_down_compl_cb(struct gsm_bts_trx *trx) { + osmo_fsm_inst_dispatch(trx->bts->shutdown_fi, BTS_SHUTDOWN_EV_TRX_RAMP_COMPL, trx); +} + static void st_wait_ramp_down_compl_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) { - /* TODO: here power ramp down will be started on all TRX, prior to changing state */ + struct gsm_bts *bts = (struct gsm_bts *)fi->priv; + struct gsm_bts_trx *trx; + + llist_for_each_entry(trx, &bts->trx_list, list) + power_ramp_start(trx, to_mdB(-10), 1, ramp_down_compl_cb); } static void st_wait_ramp_down_compl(struct osmo_fsm_inst *fi, uint32_t event, void *data) { - /* TODO: In here once we have ramp down implemented we'll transit to - regular exit. For now we simply wait for state timeout - bts_shutdown_fsm_state_chg(fi, BTS_SHUTDOWN_ST_EXIT); - */ + struct gsm_bts *bts = (struct gsm_bts *)fi->priv; + struct gsm_bts_trx *src_trx; + unsigned int remaining = 0; + struct gsm_bts_trx *trx; + + switch(event) { + case BTS_SHUTDOWN_EV_TRX_RAMP_COMPL: + src_trx = (struct gsm_bts_trx *)data; + + llist_for_each_entry(trx, &bts->trx_list, list) { + if (trx->power_params.p_total_cur_mdBm > 0) + remaining++; + } + + LOGPFSML(fi, LOGL_INFO, "%s Ramping down complete, %u TRX remaining\n", + gsm_trx_name(src_trx), remaining); + if (remaining == 0) + bts_shutdown_fsm_state_chg(fi, BTS_SHUTDOWN_ST_EXIT); + break; + } } static void st_exit_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state) @@ -82,7 +106,8 @@ static struct osmo_fsm_state bts_shutdown_fsm_states[] = { .action = st_none, }, [BTS_SHUTDOWN_ST_WAIT_RAMP_DOWN_COMPL] = { - .in_event_mask = 0, + .in_event_mask = + X(BTS_SHUTDOWN_EV_TRX_RAMP_COMPL), .out_state_mask = X(BTS_SHUTDOWN_ST_EXIT), .name = "WAIT_RAMP_DOWN_COMPL", @@ -97,6 +122,7 @@ static struct osmo_fsm_state bts_shutdown_fsm_states[] = { const struct value_string bts_shutdown_fsm_event_names[] = { OSMO_VALUE_STRING(BTS_SHUTDOWN_EV_START), + OSMO_VALUE_STRING(BTS_SHUTDOWN_EV_TRX_RAMP_COMPL), { 0, NULL } }; diff --git a/src/common/gsm_data.c b/src/common/gsm_data.c index 18d5b663..ae604ec0 100644 --- a/src/common/gsm_data.c +++ b/src/common/gsm_data.c @@ -40,7 +40,16 @@ #include <osmo-bts/bts_shutdown_fsm.h> static struct osmo_tdef bts_T_defs[] = { - { .T=-1, .default_val=1, .desc="Time after which osmo-bts exits if regular ramp down during shut down process does not finish (s)" }, + /* T-1: FIXME: Ideally should be dynamically calculated per trx at + * shutdown start based on params below, and highest trx value taken: + * + VTY's power-ramp step-interval. + * + Amount of steps needed (taking into account how many dB each step moves). + * + Extra time to get response back for each step. + * For now we simply give 5 mins, which should be enough for any + * acceptable setup, while still ensuring will timeout at some point if + * something fails in the ramp down procedure. + */ + { .T=-1, .default_val=300, .desc="Time after which osmo-bts exits if regular ramp down during shut down process does not finish (s)" }, { .T=-2, .default_val=3, .desc="Time after which osmo-bts exits if requesting transceivers to stop during shut down process does not finish (s)" }, {} }; |