summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/acc_ramp.h16
-rw-r--r--openbsc/src/libbsc/acc_ramp.c40
-rw-r--r--openbsc/src/libbsc/bsc_init.c15
-rw-r--r--openbsc/src/libbsc/bsc_vty.c7
4 files changed, 43 insertions, 35 deletions
diff --git a/openbsc/include/openbsc/acc_ramp.h b/openbsc/include/openbsc/acc_ramp.h
index cb063bf53..efb12b088 100644
--- a/openbsc/include/openbsc/acc_ramp.h
+++ b/openbsc/include/openbsc/acc_ramp.h
@@ -79,6 +79,18 @@ struct acc_ramp {
};
/*!
+ * Enable or disable ACC ramping.
+ * When enabled, ramping begins once acc_ramp_start() is called.
+ * When disabled, an ACC ramping process in progress will continue
+ * unless acc_ramp_abort() is called as well.
+ * \param[in] acc_ramp Pointer to acc_ramp structure.
+ */
+static inline void acc_ramp_set_enabled(struct acc_ramp *acc_ramp, bool enable)
+{
+ acc_ramp->acc_ramping_enabled = enable;
+}
+
+/*!
* Return true if ACC ramping is currently enabled, else false.
* \param[in] acc_ramp Pointer to acc_ramp structure.
*/
@@ -141,9 +153,9 @@ static inline void acc_ramp_apply(struct gsm48_rach_control *rach_control, struc
rach_control->t3 |= acc_ramp_get_barred_t3(acc_ramp);
}
-void acc_ramp_init(struct acc_ramp *acc_ramp, bool enable, struct gsm_bts *bts);
+void acc_ramp_init(struct acc_ramp *acc_ramp, struct gsm_bts *bts);
int acc_ramp_set_step_size(struct acc_ramp *acc_ramp, unsigned int step_size);
int acc_ramp_set_step_interval(struct acc_ramp *acc_ramp, unsigned int step_interval);
void acc_ramp_set_step_interval_dynamic(struct acc_ramp *acc_ramp);
-void acc_ramp_start(struct acc_ramp *acc_ramp);
+void acc_ramp_trigger(struct acc_ramp *acc_ramp);
void acc_ramp_abort(struct acc_ramp *acc_ramp);
diff --git a/openbsc/src/libbsc/acc_ramp.c b/openbsc/src/libbsc/acc_ramp.c
index 9b3f90b51..e88772346 100644
--- a/openbsc/src/libbsc/acc_ramp.c
+++ b/openbsc/src/libbsc/acc_ramp.c
@@ -140,28 +140,20 @@ static void do_acc_ramping_step(void *data)
* Initialize an acc_ramp data structure.
* Storage for this structure must be provided by the caller.
*
- * If ACC ramping is enabled, all ACCs are denied by default.
- * A subsequent call to acc_ramp_start() will begin the ramping process.
- * If ACC ramping is disabled, all ACCs will be allowed by default,
- * and there is no need to do anything else.
+ * By default, ACC ramping is disabled and all ACCs are allowed.
*
* \param[in] acc_ramp Pointer to acc_ramp structure to be initialized.
- * \param[in] enable Indicates whether ACC ramping should be enabled or disabled.
* \param[in] bts BTS which uses this ACC ramp data structure.
*/
-void acc_ramp_init(struct acc_ramp *acc_ramp, bool enable, struct gsm_bts *bts)
+void acc_ramp_init(struct acc_ramp *acc_ramp, struct gsm_bts *bts)
{
acc_ramp->bts = bts;
- acc_ramp->acc_ramping_enabled = enable;
+ acc_ramp_set_enabled(acc_ramp, false);
acc_ramp->step_size = ACC_RAMP_STEP_SIZE_DEFAULT;
acc_ramp->step_interval_sec = ACC_RAMP_STEP_INTERVAL_MIN;
acc_ramp->step_interval_is_fixed = false;
+ allow_all_enabled_accs(acc_ramp);
osmo_timer_setup(&acc_ramp->step_timer, do_acc_ramping_step, acc_ramp);
-
- if (acc_ramp->acc_ramping_enabled)
- barr_all_enabled_accs(acc_ramp);
- else
- allow_all_enabled_accs(acc_ramp);
}
/*!
@@ -211,28 +203,34 @@ void acc_ramp_set_step_interval_dynamic(struct acc_ramp *acc_ramp)
}
/*!
- * Begin the ramping process. Perform at least one ramping step to allow 'step_size' ACCs.
- * If 'step_size' is ACC_RAMP_STEP_SIZE_MAX, all ACCs will be allowed immediately.
+ * Determine if ACC ramping should be started according to configuration, and
+ * if ACC ramping is enabled, begin the ramping process.
+ * Perform at least one ramping step to allow 'step_size' ACCs.
+ * If 'step_size' is ACC_RAMP_STEP_SIZE_MAX, or if ACC ramping is disabled,
+ * all ACCs will be allowed immediately.
* \param[in] acc_ramp Pointer to acc_ramp structure.
*/
-void acc_ramp_start(struct acc_ramp *acc_ramp)
+void acc_ramp_trigger(struct acc_ramp *acc_ramp)
{
- /* Abort any previously running ramping process. */
+ /* Abort any previously running ramping process and allow all available ACCs. */
acc_ramp_abort(acc_ramp);
- /* Set all availble ACCs to barred and start ramping up. */
- barr_all_enabled_accs(acc_ramp);
- do_acc_ramping_step(acc_ramp);
+ if (acc_ramp_is_enabled(acc_ramp)) {
+ /* Set all available ACCs to barred and start ramping up. */
+ barr_all_enabled_accs(acc_ramp);
+ do_acc_ramping_step(acc_ramp);
+ }
}
/*!
- * Abort the ramping process. If ramping is disabled or has already finished,
- * then this function has no effect.
+ * Abort the ramping process and allow all available ACCs immediately.
* \param[in] acc_ramp Pointer to acc_ramp structure.
*/
void acc_ramp_abort(struct acc_ramp *acc_ramp)
{
if (osmo_timer_pending(&acc_ramp->step_timer))
osmo_timer_del(&acc_ramp->step_timer);
+
+ allow_all_enabled_accs(acc_ramp);
}
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 6147257c4..120955b53 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -311,19 +311,16 @@ static void bootstrap_rsl(struct gsm_bts_trx *trx)
trx->bts->location_area_code,
trx->bts->cell_identity, trx->bts->bsic);
- /*
- * Re-initialize ACC ramping to ensure ACCs are barred/allowed
- * according to our current VTY configuration.
- */
- acc_ramp_init(&trx->bts->acc_ramp, acc_ramp_is_enabled(&trx->bts->acc_ramp), trx->bts);
-
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
rsl_nokia_si_begin(trx);
}
- /* Configure ACC ramping before sending system information to BTS. */
- if (acc_ramp_is_enabled(&trx->bts->acc_ramp))
- acc_ramp_start(&trx->bts->acc_ramp);
+ /*
+ * Trigger ACC ramping before sending system information to BTS.
+ * This ensures that RACH control in system information is configured correctly.
+ */
+ acc_ramp_trigger(&trx->bts->acc_ramp);
+
gsm_bts_trx_set_system_infos(trx);
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index f78247bda..a076397d0 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -1655,7 +1655,7 @@ DEFUN(cfg_bts,
* Initalize bts->acc_ramp here. Else we could segfault while
* processing a configuration file with ACC ramping settings.
*/
- acc_ramp_init(&bts->acc_ramp, false, bts);
+ acc_ramp_init(&bts->acc_ramp, bts);
} else
bts = gsm_bts_num(gsmnet, bts_nr);
@@ -3042,7 +3042,8 @@ DEFUN(cfg_bts_acc_ramping,
{
struct gsm_bts *bts = vty->index;
- acc_ramp_init(&bts->acc_ramp, true, bts);
+ if (!acc_ramp_is_enabled(&bts->acc_ramp))
+ acc_ramp_set_enabled(&bts->acc_ramp, true);
/* ACC ramping takes effect when the BTS reconnects. */
return CMD_SUCCESS;
@@ -3057,7 +3058,7 @@ DEFUN(cfg_bts_no_acc_ramping, cfg_bts_no_acc_ramping_cmd,
if (acc_ramp_is_enabled(&bts->acc_ramp)) {
acc_ramp_abort(&bts->acc_ramp);
- acc_ramp_init(&bts->acc_ramp, false, bts);
+ acc_ramp_set_enabled(&bts->acc_ramp, false);
gsm_bts_set_system_infos(bts);
}