From a97941aaca7b12f98633a3a97fd71f48b082d591 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 2 Oct 2020 17:06:45 +0200 Subject: 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 --- src/common/bts.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/common/bts.c') 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 #include #include +#include #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 */ -- cgit v1.2.3