aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2021-10-12 15:35:47 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2021-10-29 10:23:51 +0200
commit343a1130f3ecf8a1bb544ea4bb397600a2694f87 (patch)
treef203334d9425b8126a4a20e472ac5fe55229dfb6
parent298f6bff8697ca6857664d14c446cd53826453e8 (diff)
osmo_bsc_main: call bootstrap_bts when OML TEI comes uppmaier/bootstrap
At the moment bootstrap_bts is called only once on startup. When a new BTY is set up during runtime bootstrap_bts is not called. This means that some parameters of the BTS stay uninitalized until osmo-bsc is restarted. Lets rather call bootstrap_bts() when the OML TEI of the BTS comes up. Change-Id: Ie599f809623efd6ea4ab3f39294195fc1ef84b85 Related: OS#5369
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c130
1 files changed, 72 insertions, 58 deletions
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 17196e9ea..e9c013e0f 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -389,57 +389,9 @@ static void update_connection_stats_cb(void *data)
osmo_timer_schedule(&update_connection_stats_timer, 1, 0);
}
-/* Callback function to be called every time we receive a signal from INPUT */
-static int inp_sig_cb(unsigned int subsys, unsigned int signal,
- void *handler_data, void *signal_data)
-{
- struct input_signal_data *isd = signal_data;
- struct gsm_bts_trx *trx = isd->trx;
-
- if (subsys != SS_L_INPUT)
- return -EINVAL;
-
- LOGP(DLMI, LOGL_DEBUG, "%s(): Input signal '%s' received\n", __func__,
- get_value_string(e1inp_signal_names, signal));
- switch (signal) {
- case S_L_INP_TEI_UP:
- if (isd->link_type == E1INP_SIGN_OML) {
- /* Generate Mobile Allocation bit-masks for all timeslots.
- * This needs to be done here, because it's used for TS configuration. */
- generate_ma_for_bts(trx->bts);
- }
- if (isd->link_type == E1INP_SIGN_RSL)
- bootstrap_rsl(trx);
- break;
- case S_L_INP_TEI_DN:
- LOG_TRX(trx, DLMI, LOGL_ERROR, "Lost E1 %s link\n", e1inp_signtype_name(isd->link_type));
-
- if (isd->link_type == E1INP_SIGN_OML) {
- rate_ctr_inc(rate_ctr_group_get_ctr(trx->bts->bts_ctrs, BTS_CTR_BTS_OML_FAIL));
- all_ts_dispatch_event(trx, TS_EV_OML_DOWN);
- } else if (isd->link_type == E1INP_SIGN_RSL) {
- rate_ctr_inc(rate_ctr_group_get_ctr(trx->bts->bts_ctrs, BTS_CTR_BTS_RSL_FAIL));
- acc_ramp_abort(&trx->bts->acc_ramp);
- all_ts_dispatch_event(trx, TS_EV_RSL_DOWN);
- if (trx->nr == 0)
- osmo_timer_del(&trx->bts->cbch_timer);
- }
-
- gsm_bts_sm_mo_reset(trx->bts->site_mgr);
-
- abis_nm_clear_queue(trx->bts);
- break;
- default:
- break;
- }
-
- 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;
@@ -447,26 +399,26 @@ static int bootstrap_bts(struct gsm_bts *bts)
switch (bts->band) {
case GSM_BAND_1800:
if (bts->c0->arfcn < 512 || bts->c0->arfcn > 885) {
- LOGP(DNM, LOGL_ERROR, "GSM1800 channel must be between 512-885.\n");
+ LOGP(DNM, LOGL_ERROR, "GSM1800 channel (%u) must be between 512-885.\n", bts->c0->arfcn);
return -EINVAL;
}
break;
case GSM_BAND_1900:
if (bts->c0->arfcn < 512 || bts->c0->arfcn > 810) {
- LOGP(DNM, LOGL_ERROR, "GSM1900 channel must be between 512-810.\n");
+ LOGP(DNM, LOGL_ERROR, "GSM1900 channel (%u) must be between 512-810.\n", bts->c0->arfcn);
return -EINVAL;
}
break;
case GSM_BAND_900:
if ((bts->c0->arfcn > 124 && bts->c0->arfcn < 955) ||
bts->c0->arfcn > 1023) {
- LOGP(DNM, LOGL_ERROR, "GSM900 channel must be between 0-124, 955-1023.\n");
+ LOGP(DNM, LOGL_ERROR, "GSM900 channel (%u) must be between 0-124, 955-1023.\n", bts->c0->arfcn);
return -EINVAL;
}
break;
case GSM_BAND_850:
if (bts->c0->arfcn < 128 || bts->c0->arfcn > 251) {
- LOGP(DNM, LOGL_ERROR, "GSM850 channel must be between 128-251.\n");
+ LOGP(DNM, LOGL_ERROR, "GSM850 channel (%u) must be between 128-251.\n", bts->c0->arfcn);
return -EINVAL;
}
break;
@@ -484,6 +436,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? */
@@ -511,6 +470,66 @@ static int bootstrap_bts(struct gsm_bts *bts)
/* Initialize the BTS state */
gsm_bts_sm_mo_reset(bts->site_mgr);
+ /* Generate Mobile Allocation bit-masks for all timeslots.
+ * This needs to be done here, because it's used for TS configuration. */
+ generate_ma_for_bts(bts);
+}
+
+/* Callback function to be called every time we receive a signal from INPUT */
+static int inp_sig_cb(unsigned int subsys, unsigned int signal,
+ void *handler_data, void *signal_data)
+{
+ struct input_signal_data *isd = signal_data;
+ struct gsm_bts_trx *trx = isd->trx;
+ int rc;
+
+ if (subsys != SS_L_INPUT)
+ return -EINVAL;
+
+ LOGP(DLMI, LOGL_DEBUG, "%s(): Input signal '%s' received\n", __func__,
+ get_value_string(e1inp_signal_names, signal));
+ switch (signal) {
+ case S_L_INP_TEI_UP:
+ if (isd->link_type == E1INP_SIGN_OML) {
+ /* Check parameters and apply vty config dependent parameters */
+ rc = check_bts(trx->bts);
+ if (rc < 0) {
+ LOGP(DNM, LOGL_ERROR, "Error in BTS configuration -- cannot bootstrap BTS %u\n", trx->bts->nr);
+ return rc;
+ }
+ bootstrap_bts(trx->bts);
+ }
+ if (isd->link_type == E1INP_SIGN_RSL) {
+ rc = check_bts(trx->bts);
+ if (rc < 0) {
+ LOGP(DNM, LOGL_ERROR, "Error in BTS configuration -- cannot bootstrap RSL for BTS %u\n", trx->bts->nr);
+ return rc;
+ }
+ bootstrap_rsl(trx);
+ }
+ break;
+ case S_L_INP_TEI_DN:
+ LOG_TRX(trx, DLMI, LOGL_ERROR, "Lost E1 %s link\n", e1inp_signtype_name(isd->link_type));
+
+ if (isd->link_type == E1INP_SIGN_OML) {
+ rate_ctr_inc(rate_ctr_group_get_ctr(trx->bts->bts_ctrs, BTS_CTR_BTS_OML_FAIL));
+ all_ts_dispatch_event(trx, TS_EV_OML_DOWN);
+ } else if (isd->link_type == E1INP_SIGN_RSL) {
+ rate_ctr_inc(rate_ctr_group_get_ctr(trx->bts->bts_ctrs, BTS_CTR_BTS_RSL_FAIL));
+ acc_ramp_abort(&trx->bts->acc_ramp);
+ all_ts_dispatch_event(trx, TS_EV_RSL_DOWN);
+ if (trx->nr == 0)
+ osmo_timer_del(&trx->bts->cbch_timer);
+ }
+
+ gsm_bts_sm_mo_reset(trx->bts->site_mgr);
+
+ abis_nm_clear_queue(trx->bts);
+ break;
+ default:
+ break;
+ }
+
return 0;
}
@@ -535,11 +554,6 @@ 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);
- if (rc < 0) {
- LOGP(DNM, LOGL_FATAL, "Error bootstrapping BTS\n");
- return rc;
- }
rc = e1_reconfig_bts(bts);
if (rc < 0) {
LOGP(DNM, LOGL_FATAL, "Error enabling E1 input driver\n");