aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2021-11-02 15:52:11 +0100
committerdexter <pmaier@sysmocom.de>2021-11-10 14:33:26 +0000
commit1140216a885ff175053f1c00cd3dc0fedd84c35c (patch)
tree18e1e5f92ae159e60bf3ccbca6fa21b5af8bb8d5
parentc2a10a739b5e68dd5957218a03cfed9b0b509479 (diff)
osmo_bsc_main: separate checks from bootstrap_bts
The function bootstrap_bts does a few checks before it does the actual initialization. To make the code more modular, lets split the function into two functions, check_bts and bootstrap_bts. Also be sure that we print the BTS number when the check failes. Change-Id: Id2b26f147d2f35e156e2da8ee58d2bbbb93de4ac Related: SYS#5369
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index a39c1092e..11db2605d 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -436,10 +436,9 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
return 0;
}
-static int bootstrap_bts(struct gsm_bts *bts)
+static int check_bts(struct gsm_bts *bts)
{
struct gsm_bts_trx *trx;
- unsigned int n = 0;
if (!bts->model)
return -EFAULT;
@@ -484,6 +483,13 @@ static int bootstrap_bts(struct gsm_bts *bts)
}
}
+ return 0;
+}
+
+static void bootstrap_bts(struct gsm_bts *bts)
+{
+ unsigned int n = 0;
+
/* Control Channel Description is set from vty/config */
/* Determine the value of CCCH_CONF. Is TS0/C0 combined? */
@@ -510,8 +516,6 @@ static int bootstrap_bts(struct gsm_bts *bts)
/* Initialize the BTS state */
gsm_bts_sm_mo_reset(bts->site_mgr);
-
- return 0;
}
static int bsc_network_configure(const char *config_file)
@@ -535,11 +539,12 @@ static int bsc_network_configure(const char *config_file)
osmo_signal_register_handler(SS_L_INPUT, inp_sig_cb, NULL);
llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) {
- rc = bootstrap_bts(bts);
+ rc = check_bts(bts);
if (rc < 0) {
- LOGP(DNM, LOGL_FATAL, "Error bootstrapping BTS\n");
+ LOGP(DNM, LOGL_FATAL, "(bts=%u) cannot bootstrap BTS, invalid BTS configuration\n", bts->nr);
return rc;
}
+ bootstrap_bts(bts);
rc = e1_reconfig_bts(bts);
if (rc < 0) {
LOGP(DNM, LOGL_FATAL, "Error enabling E1 input driver\n");