summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-09-07 19:10:09 +0200
committerHarald Welte <laforge@gnumonks.org>2017-10-23 17:53:48 +0000
commit5a4594614390978f7dab05f08d607c3903163cea (patch)
tree751294462bd31537dc5e79e1dfb527ffecd1aeb9
parent65021ac50792a42bcc21e482c27e0f915c435716 (diff)
Make TRX rf locking more visible
* log administrative state transitions * log what's caused it * while at it, mark boolean variable as such Cherry-picked from osmo-bsc be356ed32fbd28dc8d1460371d9e47511b20ac63 Change-Id: I3e25a19fac4d0b4886d825c9876771b1f66efe58 Related: SYS#3864
-rw-r--r--openbsc/include/openbsc/gsm_data.h2
-rw-r--r--openbsc/src/libbsc/abis_nm.c8
-rw-r--r--openbsc/src/libbsc/bsc_rf_ctrl.c8
-rw-r--r--openbsc/src/libbsc/bsc_vty.c2
4 files changed, 12 insertions, 8 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 4035b396b..57fa30173 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -578,7 +578,7 @@ struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net,
void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr,
uint8_t e1_ts, uint8_t e1_ts_ss);
-void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
+void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason);
bool gsm_btsmodel_has_feature(struct gsm_bts_model *model, enum gsm_bts_features feat);
struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx);
diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index cf20d7c49..f24f6bf91 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -2791,9 +2791,13 @@ void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts)
*((uint16_t *)(buf + 5)) = htons(bts->cell_identity);
}
-void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked)
+void gsm_trx_lock_rf(struct gsm_bts_trx *trx, bool locked, const char *reason)
{
- int new_state = locked ? NM_STATE_LOCKED : NM_STATE_UNLOCKED;
+ uint8_t new_state = locked ? NM_STATE_LOCKED : NM_STATE_UNLOCKED;
+
+ LOGP(DNM, LOGL_NOTICE, "(bts=%d,trx=%d) Changing adm. state %s -> %s [%s]\n", trx->bts->nr, trx->nr,
+ get_value_string(abis_nm_adm_state_names, trx->mo.nm_state.administrative),
+ get_value_string(abis_nm_adm_state_names, new_state), reason);
trx->mo.nm_state.administrative = new_state;
if (!trx->bts || !trx->bts->oml_link)
diff --git a/openbsc/src/libbsc/bsc_rf_ctrl.c b/openbsc/src/libbsc/bsc_rf_ctrl.c
index b7b6fc819..0e28600b5 100644
--- a/openbsc/src/libbsc/bsc_rf_ctrl.c
+++ b/openbsc/src/libbsc/bsc_rf_ctrl.c
@@ -123,7 +123,7 @@ enum osmo_bsc_rf_policy osmo_bsc_rf_get_policy_by_bts(struct gsm_bts *bts)
}
}
-static int lock_each_trx(struct gsm_network *net, int lock)
+static int lock_each_trx(struct gsm_network *net, bool lock)
{
struct gsm_bts *bts;
@@ -138,7 +138,7 @@ static int lock_each_trx(struct gsm_network *net, int lock)
}
llist_for_each_entry(trx, &bts->trx_list, list) {
- gsm_trx_lock_rf(trx, lock);
+ gsm_trx_lock_rf(trx, lock, "ctrl");
}
}
@@ -245,7 +245,7 @@ static void send_signal(struct osmo_bsc_rf *rf, int val)
static int switch_rf_off(struct osmo_bsc_rf *rf)
{
- lock_each_trx(rf->gsm_network, 1);
+ lock_each_trx(rf->gsm_network, true);
send_signal(rf, S_RF_OFF);
return 0;
@@ -289,7 +289,7 @@ static void rf_delay_cmd_cb(void *data)
case RF_CMD_ON:
rf->last_state_command = "RF Direct On";
osmo_timer_del(&rf->grace_timeout);
- lock_each_trx(rf->gsm_network, 0);
+ lock_each_trx(rf->gsm_network, false);
send_signal(rf, S_RF_ON);
osmo_timer_schedule(&rf->rf_check, 3, 0);
break;
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index f50ebd8f4..5fb1c5d0e 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -3562,7 +3562,7 @@ DEFUN(cfg_trx_rf_locked,
int locked = atoi(argv[0]);
struct gsm_bts_trx *trx = vty->index;
- gsm_trx_lock_rf(trx, locked);
+ gsm_trx_lock_rf(trx, locked, "vty");
return CMD_SUCCESS;
}