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/.

pespin gerrit-no-reply at lists.osmocom.org
Fri Oct 2 16:26:41 UTC 2020


pespin has uploaded this change for review. ( 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, 21 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/05/20405/1

diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index 564e2b8..26ad2d9 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -434,6 +434,12 @@
 
 	struct {
 		struct osmo_fsm_inst *fi;
+		/* 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;
 		bool opstart_sent;
 		struct gsm_abis_mo mo;
 	} site_mgr;
diff --git a/src/osmo-bsc/nm_bb_transc_fsm.c b/src/osmo-bsc/nm_bb_transc_fsm.c
index bdee054..ffb7167 100644
--- a/src/osmo-bsc/nm_bb_transc_fsm.c
+++ b/src/osmo-bsc/nm_bb_transc_fsm.c
@@ -111,10 +111,7 @@
 {
 	struct gsm_bts_trx *trx = (struct gsm_bts_trx *)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 (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;
 	}
@@ -185,9 +182,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 0a580ad..575e87a 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 0f66f38..6fcff3c 100644
--- a/src/osmo-bsc/nm_bts_sm_fsm.c
+++ b/src/osmo-bsc/nm_bts_sm_fsm.c
@@ -47,6 +47,7 @@
 {
 	struct gsm_bts *bts = (struct gsm_bts *)fi->priv;
 
+	bts->site_mgr.peer_has_no_avstate_offline = (bts->type == GSM_BTS_TYPE_NANOBTS);
 	bts->site_mgr.opstart_sent = false;
 }
 
@@ -72,7 +73,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 4520a14..a5656d0 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 68cc9ea..9f7828d 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: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201002/892f0663/attachment.htm>


More information about the gerrit-log mailing list