aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-09-14 19:16:06 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-09-17 18:19:08 +0200
commit00534b647bfe783fc70e5e96f169c82c3c03e041 (patch)
treeecd07cd868c863d1c19a1e29647d706cc00481d4
parent42916677f65895eaff7bb80d2d87a9e9510bbb52 (diff)
WIP: don't exit if active link towards BSC goes downpespin/connect
-rw-r--r--include/osmo-bts/bts.h2
-rw-r--r--src/common/abis.c10
-rw-r--r--src/common/bts_shutdown_fsm.c23
-rw-r--r--src/osmo-bts-trx/l1_if.c2
4 files changed, 24 insertions, 13 deletions
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index d3cb6bff..a6014239 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -368,6 +368,7 @@ struct gsm_bts {
} gsmtap;
struct osmo_fsm_inst *shutdown_fi; /* FSM instance to manage shutdown procedure during process exit */
+ bool shutdown_fi_exit_proc; /* exit process when shutdown_fsm is finished? */
struct osmo_fsm_inst *abis_link_fi; /* FSM instance to manage abis connection during process startup and link failure */
struct osmo_tdef *T_defs; /* Timer defines */
@@ -390,6 +391,7 @@ struct gsm_bts *gsm_bts_num(const struct gsm_network *net, int num);
int bts_init(struct gsm_bts *bts);
void bts_shutdown(struct gsm_bts *bts, const char *reason);
+void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc);
int bts_link_estab(struct gsm_bts *bts);
diff --git a/src/common/abis.c b/src/common/abis.c
index 8e713d27..1722f3de 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -215,12 +215,8 @@ static void abis_link_connected(struct osmo_fsm_inst *fi, uint32_t event, void *
trx->rsl_link = NULL;
}
}
-
- /* Note: if there was an OML or RSL connection present (the BTS was connected to a BSC). Then we will not try
- * to connect to an alternate BSC. Instead we will shut down the BTS process. This will ensure that all states
- * in the BTS (hardware and software) are reset properly. It is then up to the process management of the host
- * to restart osmo-bts. */
- osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_FAILED, 0, 0);
+ bts_model_abis_close(bts);
+ osmo_fsm_inst_state_chg(fi, ABIS_LINK_ST_WAIT_RECONNECT, OML_RETRY_TIMER, 0);
}
static void abis_link_failed_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
@@ -284,7 +280,7 @@ static struct osmo_fsm_state abis_link_fsm_states[] = {
.in_event_mask =
S(ABIS_LINK_EV_SIGN_LINK_DOWN),
.out_state_mask =
- S(ABIS_LINK_ST_FAILED),
+ S(ABIS_LINK_ST_WAIT_RECONNECT),
.onenter = abis_link_connected_onenter,
.action = abis_link_connected,
},
diff --git a/src/common/bts_shutdown_fsm.c b/src/common/bts_shutdown_fsm.c
index a9db76fd..123f6f9d 100644
--- a/src/common/bts_shutdown_fsm.c
+++ b/src/common/bts_shutdown_fsm.c
@@ -156,8 +156,11 @@ static void st_exit_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_SHUTDOWN_FINISH, NULL);
- LOGPFSML(fi, LOGL_NOTICE, "Shutdown process completed successfuly, exiting process\n");
- exit(0);
+ if (bts->shutdown_fi_exit_proc) {
+ LOGPFSML(fi, LOGL_NOTICE, "Shutdown process completed successfuly, exiting process\n");
+ exit(0);
+ }
+ bts_shutdown_fsm_state_chg(fi, BTS_SHUTDOWN_ST_NONE);
}
static struct osmo_fsm_state bts_shutdown_fsm_states[] = {
@@ -190,6 +193,8 @@ static struct osmo_fsm_state bts_shutdown_fsm_states[] = {
},
[BTS_SHUTDOWN_ST_EXIT] = {
.name = "EXIT",
+ .out_state_mask =
+ X(BTS_SHUTDOWN_ST_NONE),
.onenter = st_exit_on_enter,
}
};
@@ -232,18 +237,26 @@ static __attribute__((constructor)) void bts_shutdown_fsm_init(void)
OSMO_ASSERT(osmo_fsm_register(&bts_shutdown_fsm) == 0);
}
-void bts_shutdown(struct gsm_bts *bts, const char *reason)
+void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc)
{
struct osmo_fsm_inst *fi = bts->shutdown_fi;
if (fi->state != BTS_SHUTDOWN_ST_NONE) {
LOGPFSML(fi, LOGL_NOTICE, "BTS is already being shutdown.\n");
+ if (exit_proc)
+ bts->shutdown_fi_exit_proc = true;
return;
}
-
- LOGPFSML(fi, LOGL_NOTICE, "Shutting down BTS, reason: %s\n", reason);
+ bts->shutdown_fi_exit_proc = exit_proc;
+ LOGPFSML(fi, LOGL_NOTICE, "Shutting down BTS, exit %u, reason: %s\n",
+ exit_proc, reason);
osmo_fsm_inst_dispatch(fi, BTS_SHUTDOWN_EV_START, NULL);
}
+void bts_shutdown(struct gsm_bts *bts, const char *reason)
+{
+ bts_shutdown_ext(bts, reason, true);
+}
+
void bts_model_trx_close_cb(struct gsm_bts_trx *trx, int rc)
{
struct osmo_fsm_inst *fi = trx->bts->shutdown_fi;
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 7010405a..d9c5b539 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -217,7 +217,7 @@ void bts_model_trx_close(struct gsm_bts_trx *trx)
/* on RSL failure, deactivate transceiver */
void bts_model_abis_close(struct gsm_bts *bts)
{
- bts_shutdown(bts, "Abis close");
+ bts_shutdown_ext(bts, "Abis close", false);
}
int bts_model_adjst_ms_pwr(struct gsm_lchan *lchan)