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
This commit is contained in:
Pau Espin 2021-09-29 19:22:19 +02:00
parent 134c999103
commit d17beeacde
3 changed files with 37 additions and 8 deletions

View File

@ -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

View File

@ -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",

View File

@ -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);
}