aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/abis.c9
-rw-r--r--src/common/bts.c24
-rw-r--r--src/common/oml.c9
3 files changed, 25 insertions, 17 deletions
diff --git a/src/common/abis.c b/src/common/abis.c
index c1e1c4f3..7a08e188 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -74,6 +74,11 @@ int abis_oml_sendmsg(struct msgb *msg)
abis_push_ipa(msg, 0xff);
+ if (!bts->oml_link) {
+ msgb_free(msg);
+ return 0;
+ }
+
return abis_tx((struct ipabis_link *) bts->oml_link, msg);
}
@@ -516,9 +521,9 @@ void abis_close(struct ipabis_link *link)
/* for now, we simply terminate the program and re-spawn */
if (link->bts)
- bts_shutdown(link->bts);
+ bts_shutdown(link->bts, "Abis close / OML");
else if (link->trx)
- bts_shutdown(link->trx->bts);
+ bts_shutdown(link->trx->bts, "Abis close / RSL");
else
exit(43);
}
diff --git a/src/common/bts.c b/src/common/bts.c
index 19a3e430..e3463972 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -53,6 +53,9 @@ int bts_init(struct gsm_bts *bts)
/* FIXME: make those parameters configurable */
btsb->paging_state = paging_init(btsb, 200, 0);
+ /* set BTS to dependency */
+ oml_mo_state_chg(&bts->mo, -1, NM_AVSTATE_DEPENDENCY);
+
return bts_model_init(bts);
}
@@ -65,10 +68,13 @@ static struct osmo_timer_list shutdown_timer = {
.cb = &shutdown_timer_cb,
};
-void bts_shutdown(struct gsm_bts *bts)
+void bts_shutdown(struct gsm_bts *bts, const char *reason)
{
struct gsm_bts_trx *trx;
+ LOGP(DOML, LOGL_INFO, "Shutting down BTS %u, Reason %s\n",
+ bts->nr, reason);
+
llist_for_each_entry(trx, &bts->trx_list, list)
bts_model_trx_deact_rf(trx);
@@ -302,27 +308,25 @@ void destroy_bts(struct osmocom_bts *bts)
int bts_link_estab(struct gsm_bts *bts)
{
int i, j;
- uint8_t radio_state;
LOGP(DSUM, LOGL_INFO, "Main link established, sending Status'.\n");
- oml_mo_state_chg(&bts->site_mgr.mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
- oml_mo_state_chg(&bts->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_DEPENDENCY);
+ /* BTS and SITE MGR are EAABLED, BTS is DEPENDENCY */
+ oml_tx_state_changed(&bts->site_mgr.mo);
+ oml_tx_state_changed(&bts->mo);
+ /* All other objects start off-line until the BTS Model code says otherwise */
for (i = 0; i < bts->num_trx; i++) {
struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, i);
struct ipabis_link *link = (struct ipabis_link *) trx->rsl_link;
- radio_state = (link && link->state == LINK_STATE_CONNECT) ? NM_OPSTATE_ENABLED : NM_OPSTATE_DISABLED;
- oml_mo_state_chg(&trx->mo, radio_state, NM_AVSTATE_OK);
- oml_mo_tx_sw_act_rep(&trx->mo);
- oml_mo_state_chg(&trx->bb_transc.mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
- oml_mo_tx_sw_act_rep(&trx->bb_transc.mo);
+ oml_tx_state_changed(&trx->mo);
+ oml_tx_state_changed(&trx->bb_transc.mo);
for (j = 0; j < ARRAY_SIZE(trx->ts); j++) {
struct gsm_bts_trx_ts *ts = &trx->ts[j];
- oml_mo_state_chg(&ts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
+ oml_tx_state_changed(&ts->mo);
}
}
diff --git a/src/common/oml.c b/src/common/oml.c
index 26363321..ca19490a 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -207,8 +207,7 @@ char *gsm_abis_mo_name(const struct gsm_abis_mo *mo)
}
/* 8.8.1 sending State Changed Event Report */
-int oml_tx_state_changed(struct gsm_abis_mo *mo,
- uint8_t op_state, uint8_t avail_status)
+int oml_tx_state_changed(struct gsm_abis_mo *mo)
{
struct msgb *nmsg;
@@ -219,10 +218,10 @@ int oml_tx_state_changed(struct gsm_abis_mo *mo,
return -ENOMEM;
/* 9.4.38 Operational State */
- msgb_tv_put(nmsg, NM_ATT_OPER_STATE, op_state);
+ msgb_tv_put(nmsg, NM_ATT_OPER_STATE, mo->nm_state.operational);
/* 9.4.7 Availability Status */
- msgb_tl16v_put(nmsg, NM_ATT_AVAIL_STATUS, 1, &avail_status);
+ msgb_tl16v_put(nmsg, NM_ATT_AVAIL_STATUS, 1, &mo->nm_state.availability);
return oml_mo_send_msg(mo, nmsg, NM_MT_STATECHG_EVENT_REP);
}
@@ -249,7 +248,7 @@ int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state)
}
/* send state change report */
- rc = oml_tx_state_changed(mo, op_state, avail_state);
+ rc = oml_tx_state_changed(mo);
}
return rc;
}