aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2015-05-10 16:05:08 +0200
committerDaniel Willmann <daniel@totalueberwachung.de>2015-05-10 16:46:24 +0200
commitc1f78e4de8d741c849b68b1e7b1b5042bbef34a5 (patch)
tree2738f50239bf389eeed5bb6e6a22cec4b041a79b
parent83a549a153a30b8bc7122e0ca2f99ea6fcb1ea44 (diff)
osmo-bts-sysmo/oml.c: Update opstate and avstate after rf_lock completes
According to 3GPP TS 12.21 Ch. 5.3: The admin state can be used to control the power of a trx by setting it to locked or unlocked. As a result when the operation completes the trx should set its operational state to disabled and the availability to off-line (if locked) or enabled and ok (if unlocked). Before this patch that didn't happen and so the nitb would still list all trx as operational/ok even after the trx has been switched off. The spec doesn't clearly recommend setting opstate to disabled, but that is what the nanoBTS does, so mimic its behaviour.
-rw-r--r--src/osmo-bts-sysmo/oml.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 2bfc241..84f4dbe 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -386,8 +386,10 @@ int oml_mo_rf_lock_chg(struct gsm_abis_mo *mo, uint8_t mute_state[8],
int success)
{
if (success) {
+ int rc;
int i;
int is_locked = 1;
+ int opstate, avstate;
for (i = 0; i < 8; ++i)
if (!mute_state[i])
@@ -396,7 +398,27 @@ int oml_mo_rf_lock_chg(struct gsm_abis_mo *mo, uint8_t mute_state[8],
mo->nm_state.administrative =
is_locked ? NM_STATE_LOCKED : NM_STATE_UNLOCKED;
mo->procedure_pending = 0;
- return oml_mo_statechg_ack(mo);
+
+ /* If this fails it means abis_sendmsg() failed and oml_mo_state_chg()
+ * will probably fail as well. Return directly */
+ rc = oml_mo_statechg_ack(mo);
+ if (rc < 0) {
+ LOGP(DL1C, LOGL_ERROR, "oml_mo_statechg_ack() failed with %i\n", rc);
+ return rc;
+ }
+
+ if (is_locked) {
+ opstate = NM_OPSTATE_DISABLED;
+ avstate = NM_AVSTATE_OFF_LINE;
+ } else {
+ opstate = NM_OPSTATE_ENABLED;
+ avstate = NM_AVSTATE_OK;
+ }
+ rc = oml_mo_state_chg(mo, opstate, avstate);
+ if (rc < 0)
+ LOGP(DL1C, LOGL_ERROR, "oml_mo_state_chg() failed with %i\n", rc);
+
+ return rc;
} else {
mo->procedure_pending = 0;
return oml_mo_statechg_nack(mo, NM_NACK_REQ_NOT_GRANT);