osmo-bts-trx: fix trx_init(): do not send OPSTART ACK blindly

It was reported that both osmo-bsc and osmo-bts-trx may end up
running in a half-broken state, when everything looks good and
the UEs can see the network, but all channel requests get
rejected due to "trx not usable" error:

  lchan_select.c:173 (bts=0) lchan_select_by_type(SDCCH)
  lchan_select.c:48 looking for lchan CCCH+SDCCH4: (bts=0,trx=0) trx not usable
  lchan_select.c:48 looking for lchan SDCCH8: (bts=0,trx=0) trx not usable
  lchan_select.c:239 (bts=0) Failed to select SDCCH channel

  lchan_select.c:173 (bts=0) lchan_select_by_type(TCH_H)
  lchan_select.c:48 looking for lchan TCH/H: (bts=0,trx=0) trx not usable
  lchan_select.c:239 (bts=0) Failed to select TCH_H channel

  lchan_select.c:173 (bts=0) lchan_select_by_type(TCH_F)
  lchan_select.c:48 looking for lchan TCH/F: (bts=0,trx=0) trx not usable
  lchan_select.c:239 (bts=0) Failed to select TCH_F channel

As was then figured out, this happens because the Radio Carrier
MO (Managed Object) remains Disabled even after the BSC has
sent OPSTART and the BTS ACKed it:

  oml.c:986 OC=RADIO-CARRIER(02) INST=(00,00,ff): Rx OPSTART
  l1_if.c:614 Rx OPSTART for RADIO-CARRIER MO
  l1_if.c:201 TRX_PROV(phy0-0)[0x1238c0]{OPEN_POWERON}:
              Event TRX_PROV_EV_CFG_ENABLE not permitted
  oml.c:144 OC=RADIO-CARRIER(02) INST=(00,00,ff): Tx Opstart Ack

It remains a mistery why the TRX_PROV FSM is already in state
OPEN_POWERON, while it's expected to be in state OPEN_POWEROFF,
but we definitely should not ACKnowledge the OPSTART if this
happens.  Send a NACK instead with cause NM_NACK_CANT_PERFORM.

Change-Id: I8727460acbf850b84df67a9cbdc25b47dee1fadd
Related: SYS#5063
This commit is contained in:
Vadim Yanitskiy 2020-09-05 19:18:58 +07:00
parent 6f4db8c620
commit 5a2262da64
1 changed files with 4 additions and 1 deletions

View File

@ -197,8 +197,11 @@ static int trx_init(struct gsm_bts_trx *trx)
{
struct phy_instance *pinst = trx_phy_instance(trx);
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
int rc;
osmo_fsm_inst_dispatch(l1h->provision_fi, TRX_PROV_EV_CFG_ENABLE, (void*)(intptr_t)true);
rc = osmo_fsm_inst_dispatch(l1h->provision_fi, TRX_PROV_EV_CFG_ENABLE, (void*)(intptr_t)true);
if (rc != 0)
return oml_mo_opstart_nack(&trx->mo, NM_NACK_CANT_PERFORM);
if (trx == trx->bts->c0)
lchan_init_lapdm(&trx->ts[0].lchan[CCCH_LCHAN]);