From e30d40de0e0b9b55c551d87015a791d4a9bc418b Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 20 Jul 2012 10:27:31 +0200 Subject: bts: Allow to exclude a BTS from the global RF lock handling Some BTS might be in locations where they can run all the time, allow to exclude them from the global lock handling. --- openbsc/include/openbsc/gsm_data_shared.h | 3 +++ openbsc/src/libbsc/bsc_rf_ctrl.c | 28 +++++++++++++++++++++++++--- openbsc/src/libbsc/bsc_vty.c | 27 +++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 56d62e54c..4f9f21f01 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -699,6 +699,9 @@ struct gsm_bts { /* do we use static (user-defined) system information messages? (bitmask) */ uint32_t si_mode_static; + + /* exclude the BTS from the global RF Lock handling */ + int excl_from_rf_lock; #endif /* ROLE_BSC */ void *role; }; diff --git a/openbsc/src/libbsc/bsc_rf_ctrl.c b/openbsc/src/libbsc/bsc_rf_ctrl.c index 87bf39de5..bd36e1884 100644 --- a/openbsc/src/libbsc/bsc_rf_ctrl.c +++ b/openbsc/src/libbsc/bsc_rf_ctrl.c @@ -1,8 +1,8 @@ /* RF Ctl handling socket */ /* (C) 2010 by Harald Welte - * (C) 2010 by Holger Hans Peter Freyther - * (C) 2010 by On-Waves + * (C) 2010-2012 by Holger Hans Peter Freyther + * (C) 2010-2012 by On-Waves * All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -129,6 +129,14 @@ static int lock_each_trx(struct gsm_network *net, int lock) llist_for_each_entry(bts, &net->bts_list, list) { struct gsm_bts_trx *trx; + + /* Exclude the BTS from the global lock */ + if (bts->excl_from_rf_lock) { + LOGP(DLINP, LOGL_DEBUG, + "Excluding BTS(%d) from trx lock.\n", bts->nr); + continue; + } + llist_for_each_entry(trx, &bts->trx_list, list) { gsm_trx_lock_rf(trx, lock); } @@ -176,6 +184,13 @@ static void handle_query(struct osmo_bsc_rf_conn *conn) llist_for_each_entry(bts, &conn->rf->gsm_network->bts_list, list) { struct gsm_bts_trx *trx; + + /* Exclude the BTS from the global lock */ + if (bts->excl_from_rf_lock) { + LOGP(DLINP, LOGL_DEBUG, + "Excluding BTS(%d) from query.\n", bts->nr); + continue; + } llist_for_each_entry(trx, &bts->trx_list, list) { if (trx->mo.nm_state.availability == NM_AVSTATE_OK && trx->mo.nm_state.operational != NM_OPSTATE_DISABLED) { @@ -200,6 +215,13 @@ static void rf_check_cb(void *_data) if (!bts->oml_link || !is_ipaccess_bts(bts)) continue; + /* Exclude the BTS from the global lock */ + if (bts->excl_from_rf_lock) { + LOGP(DLINP, LOGL_DEBUG, + "Excluding BTS(%d) from query.\n", bts->nr); + continue; + } + llist_for_each_entry(trx, &bts->trx_list, list) { if (trx->mo.nm_state.availability != NM_AVSTATE_OK || trx->mo.nm_state.operational != NM_OPSTATE_ENABLED || @@ -233,7 +255,7 @@ static void grace_timeout(void *_data) { struct osmo_bsc_rf *rf = (struct osmo_bsc_rf *) _data; - LOGP(DLINP, LOGL_NOTICE, "Grace timeout. Disabling the TRX.\n"); + LOGP(DLINP, LOGL_NOTICE, "Grace timeout. Going to disable all BTS/TRX.\n"); switch_rf_off(rf); } diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index e89317ddd..ec92c1875 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -580,6 +580,9 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) config_write_bts_gprs(vty, bts); + if (bts->excl_from_rf_lock) + vty_out(vty, " rf-lock-exclude%s", VTY_NEWLINE); + if (bts->model->config_write_bts) bts->model->config_write_bts(vty, bts); @@ -2443,6 +2446,28 @@ DEFUN(cfg_bts_si5_neigh, cfg_bts_si5_neigh_cmd, return CMD_SUCCESS; } +#define EXCL_RFLOCK_STR "Exclude this BTS from the global RF Lock\n" + +DEFUN(cfg_bts_excl_rf_lock, + cfg_bts_excl_rf_lock_cmd, + "rf-lock-exclude", + EXCL_RFLOCK_STR) +{ + struct gsm_bts *bts = vty->index; + bts->excl_from_rf_lock = 1; + return CMD_SUCCESS; +} + +DEFUN(cfg_bts_no_excl_rf_lock, + cfg_bts_no_excl_rf_lock_cmd, + "no rf-lock-exclude", + NO_STR EXCL_RFLOCK_STR) +{ + struct gsm_bts *bts = vty->index; + bts->excl_from_rf_lock = 0; + return CMD_SUCCESS; +} + #define TRX_TEXT "Radio Transceiver\n" /* per TRX configuration */ @@ -3037,6 +3062,8 @@ int bsc_vty_init(const struct log_info *cat) install_element(BTS_NODE, &cfg_bts_neigh_mode_cmd); install_element(BTS_NODE, &cfg_bts_neigh_cmd); install_element(BTS_NODE, &cfg_bts_si5_neigh_cmd); + install_element(BTS_NODE, &cfg_bts_excl_rf_lock_cmd); + install_element(BTS_NODE, &cfg_bts_no_excl_rf_lock_cmd); install_element(BTS_NODE, &cfg_trx_cmd); install_node(&trx_node, dummy_config_write); -- cgit v1.2.3