Change in osmo-bsc[master]: OML: Stay compatible with older osmo-bts versions

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Oct 15 05:55:42 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/20405 )

Change subject: OML: Stay compatible with older osmo-bts versions
......................................................................

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
---
M include/osmocom/bsc/bts.h
M src/osmo-bsc/nm_bb_transc_fsm.c
M src/osmo-bsc/nm_bts_fsm.c
M src/osmo-bsc/nm_bts_sm_fsm.c
M src/osmo-bsc/nm_channel_fsm.c
M src/osmo-bsc/nm_rcarrier_fsm.c
6 files changed, 22 insertions(+), 17 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index a9d57a3..284a932 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -364,6 +364,12 @@
 /* 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 d4875c1..c29f53d 100644
--- a/src/osmo-bsc/nm_bb_transc_fsm.c
+++ b/src/osmo-bsc/nm_bb_transc_fsm.c
@@ -113,10 +113,7 @@
 	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 @@
 			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 fa42351..5f47fdc 100644
--- a/src/osmo-bsc/nm_bts_fsm.c
+++ b/src/osmo-bsc/nm_bts_fsm.c
@@ -119,7 +119,7 @@
 	/* 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 @@
 			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 94ca9d3..ce9e15b 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 @@
 			} 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 aeaf1fe..1d798a6 100644
--- a/src/osmo-bsc/nm_channel_fsm.c
+++ b/src/osmo-bsc/nm_channel_fsm.c
@@ -125,10 +125,7 @@
 {
 	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 @@
 			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 5a95461..8702ebe 100644
--- a/src/osmo-bsc/nm_rcarrier_fsm.c
+++ b/src/osmo-bsc/nm_rcarrier_fsm.c
@@ -123,7 +123,7 @@
 	 * 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;
 	}*/

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/20405
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Iaa036a2936f609b9b9721b2b4ad8d6deaf023f42
Gerrit-Change-Number: 20405
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201015/6a911a83/attachment.htm>


More information about the gerrit-log mailing list