aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-10-02 16:20:00 +0200
committerlaforge <laforge@osmocom.org>2020-10-15 05:55:36 +0000
commit558183f3dc7d4f17b937f978db1b1cab8da040da (patch)
treedff02a102fbdb4da71d1f387b39a4038c7d59fb4
parent09544ab43657d16f0ff58f7aa1ee113c9cb4bb05 (diff)
OML: Stay compatible with older osmo-bts versions
Older osmo-bts versions (before FSMs) tended to mimic broken behavior from nanoBTS. As so, we detect it because SiteMGr becomes Enabled by default as in nanoBTS, and hence we can manage them also by expecting no Offline state and sending Opstart (and hence finally transitting to Enabled) during Dependency state. Change-Id: Iaa036a2936f609b9b9721b2b4ad8d6deaf023f42
-rw-r--r--include/osmocom/bsc/bts.h6
-rw-r--r--src/osmo-bsc/nm_bb_transc_fsm.c9
-rw-r--r--src/osmo-bsc/nm_bts_fsm.c6
-rw-r--r--src/osmo-bsc/nm_bts_sm_fsm.c7
-rw-r--r--src/osmo-bsc/nm_channel_fsm.c9
-rw-r--r--src/osmo-bsc/nm_rcarrier_fsm.c2
6 files changed, 22 insertions, 17 deletions
diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index a9d57a380..284a932cb 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -364,6 +364,12 @@ struct gsm_bts_model {
/* BTS Site Manager */
struct gsm_bts_sm {
struct gsm_abis_mo mo;
+ /* nanoBTS and old versions of osmo-bts behaves this way due to
+ broken FSMs not following TS 12.21: they never do
+ Dependency->Offline transition, but they should be OPSTARTed
+ nevertheless during Dependnecy state to work. This field is
+ used by all dependent NM objects. */
+ bool peer_has_no_avstate_offline;
};
/* One BTS */
diff --git a/src/osmo-bsc/nm_bb_transc_fsm.c b/src/osmo-bsc/nm_bb_transc_fsm.c
index d4875c18a..c29f53d3c 100644
--- a/src/osmo-bsc/nm_bb_transc_fsm.c
+++ b/src/osmo-bsc/nm_bb_transc_fsm.c
@@ -113,10 +113,7 @@ static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_
struct gsm_bts_bb_trx *bb_transc = (struct gsm_bts_bb_trx *)fi->priv;
struct gsm_bts_trx *trx = gsm_bts_bb_trx_get_trx(bb_transc);
- /* nanoBTS is broken, doesn't follow TS 12.21. Opstart MUST be sent
- during Dependency, so we simply move to OFFLINE state here to avoid
- duplicating code */
- if (trx->bts->type == GSM_BTS_TYPE_NANOBTS) {
+ if (trx->bts->site_mgr.peer_has_no_avstate_offline) {
nm_bb_transc_fsm_state_chg(fi, NM_BB_TRANSC_ST_OP_DISABLED_OFFLINE);
return;
}
@@ -188,9 +185,9 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
nm_bb_transc_fsm_state_chg(fi, NM_BB_TRANSC_ST_OP_DISABLED_NOTINSTALLED);
return;
case NM_AVSTATE_DEPENDENCY:
- /* There's no point in moving back to Dependency in nanoBTS, since it's broken
+ /* There's no point in moving back to Dependency, since it's broken
and it acts actually as if it was in Offline state */
- if (trx->bts->type != GSM_BTS_TYPE_NANOBTS) {
+ if (!trx->bts->site_mgr.peer_has_no_avstate_offline) {
nm_bb_transc_fsm_state_chg(fi, NM_BB_TRANSC_ST_OP_DISABLED_DEPENDENCY);
} else {
/* Moreover, in nanoBTS we need to check here for tx
diff --git a/src/osmo-bsc/nm_bts_fsm.c b/src/osmo-bsc/nm_bts_fsm.c
index fa4235166..5f47fdcc1 100644
--- a/src/osmo-bsc/nm_bts_fsm.c
+++ b/src/osmo-bsc/nm_bts_fsm.c
@@ -119,7 +119,7 @@ static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_
/* nanoBTS is broken, doesn't follow TS 12.21. Opstart MUST be sent
during Dependency, so we simply move to OFFLINE state here to avoid
duplicating code */
- if (bts->type == GSM_BTS_TYPE_NANOBTS) {
+ if (bts->site_mgr.peer_has_no_avstate_offline) {
nm_bts_fsm_state_chg(fi, NM_BTS_ST_OP_DISABLED_OFFLINE);
return;
}
@@ -200,9 +200,9 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
nm_bts_fsm_state_chg(fi, NM_BTS_ST_OP_DISABLED_NOTINSTALLED);
return;
case NM_AVSTATE_DEPENDENCY:
- /* There's no point in moving back to Dependency in nanoBTS, since it's broken
+ /* There's no point in moving back to Dependency, since it's broken
and it acts actually as if it was in Offline state */
- if (bts->type != GSM_BTS_TYPE_NANOBTS) {
+ if (!bts->site_mgr.peer_has_no_avstate_offline) {
nm_bts_fsm_state_chg(fi, NM_BTS_ST_OP_DISABLED_DEPENDENCY);
} else {
/* Moreover, in nanoBTS we need to check here for tx
diff --git a/src/osmo-bsc/nm_bts_sm_fsm.c b/src/osmo-bsc/nm_bts_sm_fsm.c
index 94ca9d3d4..ce9e15b0e 100644
--- a/src/osmo-bsc/nm_bts_sm_fsm.c
+++ b/src/osmo-bsc/nm_bts_sm_fsm.c
@@ -46,7 +46,9 @@
static void st_op_disabled_notinstalled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
struct gsm_bts_sm *site_mgr = (struct gsm_bts_sm *)fi->priv;
+ struct gsm_bts *bts = gsm_bts_sm_get_bts(site_mgr);
+ site_mgr->peer_has_no_avstate_offline = (bts->type == GSM_BTS_TYPE_NANOBTS);
site_mgr->mo.opstart_sent = false;
}
@@ -73,7 +75,10 @@ static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event
} else {
LOGPFSML(fi, LOGL_NOTICE, "Received BTS Site Mgr State Report Enabled "
"without Opstart. You are probably using a nanoBTS but don't "
- "have your .cfg with 'type nanobts'\n");
+ "have your .cfg with 'type nanobts'. Otherwise, you probably "
+ "are using an old osmo-bts; automatically adjusting OML "
+ "behavior to be backward-compatible.\n");
+ bts->site_mgr.peer_has_no_avstate_offline = true;
}
nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_ENABLED);
return;
diff --git a/src/osmo-bsc/nm_channel_fsm.c b/src/osmo-bsc/nm_channel_fsm.c
index aeaf1fe50..1d798a6e0 100644
--- a/src/osmo-bsc/nm_channel_fsm.c
+++ b/src/osmo-bsc/nm_channel_fsm.c
@@ -125,10 +125,7 @@ static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_
{
struct gsm_bts_trx_ts *ts = (struct gsm_bts_trx_ts *)fi->priv;
- /* nanoBTS is broken, doesn't follow TS 12.21. Opstart MUST be sent
- during Dependency, so we simply move to OFFLINE state here to avoid
- duplicating code */
- if (ts->trx->bts->type == GSM_BTS_TYPE_NANOBTS) {
+ if (ts->trx->bts->site_mgr.peer_has_no_avstate_offline) {
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_OFFLINE);
return;
}
@@ -209,9 +206,9 @@ static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, voi
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_NOTINSTALLED);
return;
case NM_AVSTATE_DEPENDENCY:
- /* There's no point in moving back to Dependency in nanoBTS, since it's broken
+ /* There's no point in moving back to Dependency, since it's broken
and it acts actually as if it was in Offline state */
- if (ts->trx->bts->type != GSM_BTS_TYPE_NANOBTS) {
+ if (!ts->trx->bts->site_mgr.peer_has_no_avstate_offline) {
nm_chan_fsm_state_chg(fi, NM_CHAN_ST_OP_DISABLED_DEPENDENCY);
} else {
/* Moreover, in nanoBTS we need to check here for tx
diff --git a/src/osmo-bsc/nm_rcarrier_fsm.c b/src/osmo-bsc/nm_rcarrier_fsm.c
index 5a9546133..8702ebeec 100644
--- a/src/osmo-bsc/nm_rcarrier_fsm.c
+++ b/src/osmo-bsc/nm_rcarrier_fsm.c
@@ -123,7 +123,7 @@ static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_
* version is found with the aboev estated bug, this code needs to be
* enabled, similar to what we do in nm_bb_transc_fsm:
*/
- /*if (trx->bts->type == GSM_BTS_TYPE_NANOBTS) {
+ /*if (trx->bts->site_mgr.peer_has_no_avstate_offline) {
nm_rcarrier_fsm_state_chg(fi, NM_RCARRIER_ST_OP_DISABLED_OFFLINE);
return;
}*/