From 32e2ea0ebf7dcad3d8e2bfa7dca74f6183d06aca Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Tue, 26 Nov 2019 17:46:29 +0100 Subject: osmo-bts-sysmo: Change op-/av-state as well when adm-state is changed Change-Id: Ie93a99938e4a8f3e9c1bcb9bfa5c31d5ae157ad4 Related: SYS#4700 --- include/osmo-bts/oml.h | 2 +- src/osmo-bts-sysmo/l1_if.c | 6 +++--- src/osmo-bts-sysmo/oml.c | 13 ++++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/osmo-bts/oml.h b/include/osmo-bts/oml.h index 139464ec..a631c0e6 100644 --- a/include/osmo-bts/oml.h +++ b/include/osmo-bts/oml.h @@ -27,7 +27,7 @@ int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state); void oml_mo_state_init(struct gsm_abis_mo *mo, int op_state, int avail_state); /* Update admin state and send ACK/NACK */ -int oml_mo_rf_lock_chg(struct gsm_abis_mo *mo, uint8_t mute_state[8], +int oml_mo_rf_lock_chg(struct gsm_bts_trx *mo, uint8_t mute_state[8], int success); /* Transmit STATE CHG REP even if there was no state change */ diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 87cf25a0..10e337bb 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -1371,14 +1371,14 @@ static int mute_rf_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp, if (status != GsmL1_Status_Success) { LOGP(DL1C, LOGL_ERROR, "Rx RF-MUTE.conf with status %s\n", get_value_string(femtobts_l1status_names, status)); - oml_mo_rf_lock_chg(&trx->mo, fl1h->last_rf_mute, 0); + oml_mo_rf_lock_chg(trx, fl1h->last_rf_mute, 0); } else { int i; LOGP(DL1C, LOGL_INFO, "Rx RF-MUTE.conf with status=%s\n", get_value_string(femtobts_l1status_names, status)); bts_update_status(BTS_STATUS_RF_MUTE, fl1h->last_rf_mute[0]); - oml_mo_rf_lock_chg(&trx->mo, fl1h->last_rf_mute, 1); + oml_mo_rf_lock_chg(trx, fl1h->last_rf_mute, 1); osmo_static_assert( ARRAY_SIZE(trx->ts) >= ARRAY_SIZE(fl1h->last_rf_mute), @@ -1411,7 +1411,7 @@ int l1if_mute_rf(struct femtol1_hdl *hdl, uint8_t mute[8], l1if_compl_cb *cb) /* always acknowledge an un-MUTE (which is a no-op if MUTE is not supported */ if (!memcmp(mute, unmuted, ARRAY_SIZE(unmuted))) { bts_update_status(BTS_STATUS_RF_MUTE, mute[0]); - oml_mo_rf_lock_chg(&trx->mo, mute, 1); + oml_mo_rf_lock_chg(trx, mute, 1); for (i = 0; i < ARRAY_SIZE(unmuted); ++i) mute_handle_ts(&trx->ts[i], mute[i]); return 0; diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index ea7527dd..1f056e42 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -465,9 +465,11 @@ static int trx_rf_lock(struct gsm_bts_trx *trx, int locked, l1if_compl_cb *cb) return l1if_mute_rf(fl1h, mute, cb); } -int oml_mo_rf_lock_chg(struct gsm_abis_mo *mo, uint8_t mute_state[8], +int oml_mo_rf_lock_chg(struct gsm_bts_trx *trx, uint8_t mute_state[8], int success) { + struct gsm_abis_mo *mo = &trx->mo; + if (success) { int i; int is_locked = 1; @@ -476,8 +478,17 @@ int oml_mo_rf_lock_chg(struct gsm_abis_mo *mo, uint8_t mute_state[8], if (!mute_state[i]) is_locked = 0; + /* Don't change av-/opstate before initial OPSTART */ + if (trx->rsl_link) { + mo->nm_state.operational = + is_locked ? NM_OPSTATE_DISABLED : NM_OPSTATE_ENABLED; + mo->nm_state.availability = + is_locked ? NM_AVSTATE_OFF_LINE : NM_AVSTATE_OK; + } + mo->nm_state.administrative = is_locked ? NM_STATE_LOCKED : NM_STATE_UNLOCKED; + mo->procedure_pending = 0; return oml_mo_statechg_ack(mo); } else { -- cgit v1.2.3