diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-09-29 19:22:19 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-09-30 13:14:08 +0200 |
commit | d17beeacde000819c6481982da92fceed49eceb9 (patch) | |
tree | e0f6c166cc1e31bd1e2791f86289e5e095ffa813 | |
parent | 134c999103049581be340630e21f0ee486003a76 (diff) |
bts-trx: Delay power ramp up until RCARRIER is ENABLED
Prior to this patch, the power ramping started when the PHY is
available, but that doesn't necessarily mean the RCARRIER is enabled.
Due to this, it was spotted a situation where BTS bootstrap failed after
PHY turning up, when RSL connection establishment failed. Hence
bts_shutdown_fsm triggered a shutdown while an active power ramping up
was ongoing...
Change-Id: I17208b74ea2649b1bbb717aee0aa355e42b7e860
-rw-r--r-- | include/osmo-bts/signal.h | 6 | ||||
-rw-r--r-- | src/common/oml.c | 6 | ||||
-rw-r--r-- | src/osmo-bts-trx/trx_provision_fsm.c | 33 |
3 files changed, 37 insertions, 8 deletions
diff --git a/include/osmo-bts/signal.h b/include/osmo-bts/signal.h index c8168a26..8359f021 100644 --- a/include/osmo-bts/signal.h +++ b/include/osmo-bts/signal.h @@ -15,4 +15,10 @@ enum signals_global { S_NEW_NSVC_ATTR, }; +struct nm_statechg_signal_data { + struct gsm_abis_mo *mo; + uint8_t old_state; + uint8_t new_state; +}; + #endif diff --git a/src/common/oml.c b/src/common/oml.c index f841853f..30caad51 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -355,12 +355,16 @@ int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state, int mo->nm_state.availability = avail_state; } if (op_state != -1) { + struct nm_statechg_signal_data nsd; LOGP(DOML, LOGL_INFO, "%s OPER STATE %s -> %s\n", gsm_abis_mo_name(mo), abis_nm_opstate_name(mo->nm_state.operational), abis_nm_opstate_name(op_state)); + nsd.mo = mo; + nsd.old_state = mo->nm_state.operational; + nsd.new_state = op_state; mo->nm_state.operational = op_state; - osmo_signal_dispatch(SS_GLOBAL, S_NEW_OP_STATE, NULL); + osmo_signal_dispatch(SS_GLOBAL, S_NEW_OP_STATE, &nsd); } if (adm_state != -1) { LOGP(DOML, LOGL_INFO, "%s ADMIN STATE %s -> %s\n", diff --git a/src/osmo-bts-trx/trx_provision_fsm.c b/src/osmo-bts-trx/trx_provision_fsm.c index 39fb6081..52736ade 100644 --- a/src/osmo-bts-trx/trx_provision_fsm.c +++ b/src/osmo-bts-trx/trx_provision_fsm.c @@ -34,6 +34,7 @@ #include <osmo-bts/bts.h> #include <osmo-bts/rsl.h> #include <osmo-bts/nm_common_fsm.h> +#include <osmo-bts/signal.h> #include "l1_if.h" #include "trx_provision_fsm.h" @@ -314,6 +315,30 @@ static void trx_prov_fsm_apply_close(struct phy_link *plink, int rc) } } +static int trx_prov_fsm_signal_cb(unsigned int subsys, unsigned int signal, + void *hdlr_data, void *signal_data) +{ + struct nm_statechg_signal_data *nsd; + struct gsm_bts_trx *trx; + + if (subsys != SS_GLOBAL) + return -EINVAL; + + if (signal != S_NEW_OP_STATE) + return 0; + + nsd = (struct nm_statechg_signal_data *)signal_data; + + if (nsd->mo->obj_class != NM_OC_RADIO_CARRIER) + return 0; + + if (nsd->old_state != NM_OPSTATE_ENABLED && nsd->new_state == NM_OPSTATE_ENABLED) { + trx = gsm_objclass2obj(nsd->mo->bts, nsd->mo->obj_class, &nsd->mo->obj_inst); + l1if_trx_start_power_ramp(trx, NULL); + } + return 0; +} + ////////////////////////// // FSM STATE ACTIONS ////////////////////////// @@ -511,13 +536,6 @@ static void st_open_wait_power_cnf(struct osmo_fsm_inst *fi, uint32_t event, voi if (rc == 0 && plink->state != PHY_LINK_CONNECTED) { trx_sched_clock_started(pinst->trx->bts); phy_link_state_set(plink, PHY_LINK_CONNECTED); - - /* Begin to ramp up the power on all TRX associated with this phy */ - llist_for_each_entry(pinst, &plink->instances, list) { - if (pinst->trx->mo.nm_state.administrative == NM_STATE_UNLOCKED) - l1if_trx_start_power_ramp(pinst->trx, NULL); - } - trx_prov_fsm_state_chg(fi, TRX_PROV_ST_OPEN_POWERON); } else if (rc != 0 && plink->state != PHY_LINK_SHUTDOWN) { trx_sched_clock_stopped(pinst->trx->bts); @@ -709,4 +727,5 @@ struct osmo_fsm trx_prov_fsm = { static __attribute__((constructor)) void trx_prov_fsm_init(void) { OSMO_ASSERT(osmo_fsm_register(&trx_prov_fsm) == 0); + OSMO_ASSERT(osmo_signal_register_handler(SS_GLOBAL, trx_prov_fsm_signal_cb, NULL) == 0); } |