aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/bts.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-10-02 17:06:45 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-10-02 19:40:11 +0200
commita97941aaca7b12f98633a3a97fd71f48b082d591 (patch)
tree2cd3935823f29c0d818ea40ffe5b6f5fd35e430c /src/common/bts.c
parent396cb163e6f85ef56ed26fbf9bfcdd0edb577457 (diff)
Introduce NM BTS Site Manager FSM
This fixes old behavior mimicing broken behavior in nanoBTS (according to TS 12.21) where BTS Site Mgr NM object was announced as Enabled despite no OPSTART was sent by the BSC. With this new FSM, BTS SiteManager will be announced as Disabled Offline during OML startup conversation, instead of Enabled. The new osmo-bsc OML management FSMs use this change in behavior to find out whether it should use the old broken management states (without Offline state, as per nanoBTS) or use the new state transitions (which allow fixing several race conditions). Change-Id: Iab2d17c45c9642860cd2d5d523c1baae24502243
Diffstat (limited to 'src/common/bts.c')
-rw-r--r--src/common/bts.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/common/bts.c b/src/common/bts.c
index c900428c..34a6be27 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -52,6 +52,7 @@
#include <osmo-bts/dtx_dl_amr_fsm.h>
#include <osmo-bts/cbch.h>
#include <osmo-bts/bts_shutdown_fsm.h>
+#include <osmo-bts/nm_bts_sm_fsm.h>
#define MIN_QUAL_RACH 50 /* minimum link quality (in centiBels) for Access Bursts */
#define MIN_QUAL_NORM -5 /* minimum link quality (in centiBels) for Normal Bursts */
@@ -219,10 +220,14 @@ struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
LOGL_INFO, NULL);
osmo_fsm_inst_update_id_f(bts->shutdown_fi, "bts%d", bts->nr);
+ bts->site_mgr.fi = osmo_fsm_inst_alloc(&nm_bts_sm_fsm, bts, bts,
+ LOGL_INFO, NULL);
+ osmo_fsm_inst_update_id_f(bts->site_mgr.fi, "bts_sm%d", bts->nr);
+ gsm_mo_init(&bts->site_mgr.mo, bts, NM_OC_SITE_MANAGER,
+ 0xff, 0xff, 0xff);
+
gsm_mo_init(&bts->mo, bts, NM_OC_BTS,
bts->nr, 0xff, 0xff);
- gsm_mo_init(&bts->site_mgr.mo, bts, NM_OC_SITE_MANAGER,
- 0xff, 0xff, 0xff);
for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
bts->gprs.nsvc[i].bts = bts;
@@ -327,7 +332,7 @@ int bts_init(struct gsm_bts *bts)
bts->radio_link_timeout = 32;
/* Start with the site manager */
- oml_mo_state_init(&bts->site_mgr.mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
+ oml_mo_state_init(&bts->site_mgr.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
/* set BTS to dependency */
oml_mo_state_init(&bts->mo, -1, NM_AVSTATE_DEPENDENCY);
@@ -390,8 +395,8 @@ int bts_link_estab(struct gsm_bts *bts)
LOGP(DSUM, LOGL_INFO, "Main link established, sending NM Status.\n");
- /* BTS and SITE MGR are EANBLED, BTS is DEPENDENCY */
- oml_tx_state_changed(&bts->site_mgr.mo);
+ /* BTS SITE MGR becomes Offline (tx SW ACT Report), BTS is DEPENDENCY */
+ osmo_fsm_inst_dispatch(bts->site_mgr.fi, NM_BTS_SM_EV_SW_ACT, NULL);
oml_tx_state_changed(&bts->mo);
/* those should all be in DEPENDENCY */