aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/abis_nm.c7
-rw-r--r--openbsc/src/chan_alloc.c15
2 files changed, 13 insertions, 9 deletions
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index 38c8c2bf5..7a67fdf3b 100644
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -599,6 +599,13 @@ const char *nm_adm_name(u_int8_t adm)
}
}
+int nm_is_running(struct gsm_nm_state *s) {
+ return (s->operational == NM_OPSTATE_ENABLED) && (
+ (s->availability == NM_AVSTATE_OK) ||
+ (s->availability == 0xff)
+ );
+}
+
static void debugp_foh(struct abis_om_fom_hdr *foh)
{
DEBUGP(DNM, "OC=%s(%02x) INST=(%02x,%02x,%02x) ",
diff --git a/openbsc/src/chan_alloc.c b/openbsc/src/chan_alloc.c
index 48f87f211..ab26fcaf2 100644
--- a/openbsc/src/chan_alloc.c
+++ b/openbsc/src/chan_alloc.c
@@ -39,8 +39,7 @@ static int ts_is_usable(struct gsm_bts_trx_ts *ts)
{
/* FIXME: How does this behave for BS-11 ? */
if (is_ipaccess_bts(ts->trx->bts)) {
- if (ts->nm_state.operational != NM_OPSTATE_ENABLED ||
- ts->nm_state.availability != NM_AVSTATE_OK)
+ if (!nm_is_running(&ts->nm_state))
return 0;
}
@@ -51,10 +50,8 @@ int trx_is_usable(struct gsm_bts_trx *trx)
{
/* FIXME: How does this behave for BS-11 ? */
if (is_ipaccess_bts(trx->bts)) {
- if (trx->nm_state.operational != NM_OPSTATE_ENABLED ||
- trx->nm_state.availability != NM_AVSTATE_OK ||
- trx->bb_transc.nm_state.operational != NM_OPSTATE_ENABLED ||
- trx->bb_transc.nm_state.availability != NM_AVSTATE_OK)
+ if (!nm_is_running(&trx->nm_state) ||
+ !nm_is_running(&trx->bb_transc.nm_state))
return 0;
}
@@ -380,8 +377,8 @@ void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts)
int i;
/* skip administratively deactivated tranxsceivers */
- if (trx->nm_state.availability != NM_AVSTATE_OK ||
- trx->bb_transc.nm_state.availability != NM_AVSTATE_OK)
+ if (!nm_is_running(&trx->nm_state) ||
+ !nm_is_running(&trx->bb_transc.nm_state))
continue;
for (i = 0; i < ARRAY_SIZE(trx->ts); i++) {
@@ -390,7 +387,7 @@ void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts)
int j;
/* skip administratively deactivated timeslots */
- if (ts->nm_state.availability != NM_AVSTATE_OK)
+ if (!nm_is_running(&ts->nm_state))
continue;
for (j = 0; j < subslots_per_pchan[ts->pchan]; j++) {