aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-06-29 16:49:03 +0200
committerHarald Welte <laforge@gnumonks.org>2011-06-29 16:49:03 +0200
commitb7849987e516eb3bf102b29298ecc103b8b24d53 (patch)
tree7d0cef4dbe3ce0f8655a4dd989d7f1d3209dde0a
parentc7921c9205ae3ac131f4ce6447876fc46cd32fae (diff)
properly reset the MO state of all MO on Abis disconnect0.9.14
When we loose the A-bis link, we should properly re-set the administrative, operational and availability state of all MOs
-rw-r--r--openbsc/include/openbsc/gsm_data_shared.h5
-rw-r--r--openbsc/src/libbsc/bsc_init.c8
-rw-r--r--openbsc/src/libcommon/gsm_data_shared.c35
3 files changed, 38 insertions, 10 deletions
diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index b3b7b9050..011e0aa96 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -568,6 +568,8 @@ char *gsm_lchan_name(struct gsm_lchan *lchan);
const char *gsm_lchans_name(enum gsm_lchan_state s);
+void gsm_abis_mo_reset(struct gsm_abis_mo *mo);
+
struct gsm_abis_mo *
gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class,
struct abis_om_obj_inst *obj_inst);
@@ -579,6 +581,9 @@ void *
gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class,
struct abis_om_obj_inst *obj_inst);
+/* reset the state of all MO in the BTS */
+void gsm_bts_mo_reset(struct gsm_bts *bts);
+
uint8_t gsm_ts2chan_nr(const struct gsm_bts_trx_ts *ts, uint8_t lchan_nr);
uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan);
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 8654dd73a..1be8cb7a1 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -292,15 +292,9 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
lchan_free(&ts->lchan[lchan_no]);
lchan_reset(&ts->lchan[lchan_no]);
}
-
- ts->mo.nm_state.operational = 0;
- ts->mo.nm_state.availability = 0;
}
- trx->mo.nm_state.operational = 0;
- trx->mo.nm_state.availability = 0;
- trx->bb_transc.mo.nm_state.operational = 0;
- trx->bb_transc.mo.nm_state.availability = 0;
+ gsm_bts_mo_reset(trx->bts);
abis_nm_clear_queue(trx->bts);
break;
diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c
index baf8c3553..58e3bed66 100644
--- a/openbsc/src/libcommon/gsm_data_shared.c
+++ b/openbsc/src/libcommon/gsm_data_shared.c
@@ -34,6 +34,13 @@
#include <openbsc/gsm_data.h>
+void gsm_abis_mo_reset(struct gsm_abis_mo *mo)
+{
+ mo->nm_state.administrative = NM_STATE_NULL;
+ mo->nm_state.operational = NM_OPSTATE_NULL;
+ mo->nm_state.availability = NM_AVSTATE_POWER_OFF;
+}
+
static void gsm_mo_init(struct gsm_abis_mo *mo, struct gsm_bts *bts,
uint8_t obj_class, uint8_t p1, uint8_t p2, uint8_t p3)
{
@@ -42,9 +49,7 @@ static void gsm_mo_init(struct gsm_abis_mo *mo, struct gsm_bts *bts,
mo->obj_inst.bts_nr = p1;
mo->obj_inst.trx_nr = p2;
mo->obj_inst.ts_nr = p3;
- mo->nm_state.administrative = NM_STATE_NULL;
- mo->nm_state.operational = NM_OPSTATE_NULL;
- mo->nm_state.availability = NM_AVSTATE_POWER_OFF;
+ gsm_abis_mo_reset(mo);
}
static const struct value_string pchan_names[] = {
@@ -217,6 +222,30 @@ struct gsm_bts *gsm_bts_alloc(void *ctx)
return bts;
}
+/* reset the state of all MO in the BTS */
+void gsm_bts_mo_reset(struct gsm_bts *bts)
+{
+ struct gsm_bts_trx *trx;
+ unsigned int i;
+
+ gsm_abis_mo_reset(&bts->mo);
+ gsm_abis_mo_reset(&bts->site_mgr.mo);
+ for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++)
+ gsm_abis_mo_reset(&bts->gprs.nsvc[i].mo);
+ gsm_abis_mo_reset(&bts->gprs.nse.mo);
+ gsm_abis_mo_reset(&bts->gprs.cell.mo);
+
+ llist_for_each_entry(trx, &bts->trx_list, list) {
+ gsm_abis_mo_reset(&trx->mo);
+ gsm_abis_mo_reset(&trx->bb_transc.mo);
+
+ for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
+ struct gsm_bts_trx_ts *ts = &trx->ts[i];
+ gsm_abis_mo_reset(&ts->mo);
+ }
+ }
+}
+
struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num)
{
struct gsm_bts_trx *trx;