diff options
author | Stefan Sperling <ssperling@sysmocom.de> | 2018-04-10 16:36:54 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-04-11 16:53:05 +0000 |
commit | ea33341cf7b52d432be98f2280b4a5f3129ef667 (patch) | |
tree | 702489b4448a1dab018cc3f7990aef415fdb06de /include/osmocom/bsc/acc_ramp.h | |
parent | 881836a7707a05b0871c73c50ad48f591043d07e (diff) |
ensure that acc_ramp_init() is only called once
There are plans to register signal handlers in acc_ramp_init(). Once we
do that, the acc_ramp_init() function should only be called once to
avoid duplicate signal handlers on the handler list.
However, the acc_ramp_init() function currently serves a dual-purpose:
1) Initialize the acc_ramp structure for a bts
2) Enable or disable ACC ramping
Add new functions to support use case 2, and call acc_ramp_init()
just once while reading the configuration file. The VTY commands
which enable/disable ACC ramping use the new APIs instead.
Also, rename acc_ramp_start() to acc_ramp_trigger() and tweak its
semantics so that it can always be called regardless of what the
current configuration settings are. This prepares us for triggering
ACC ramping upon events other than "RSL link-up".
Change-Id: Ia25bff85d9e5c277da76bffa11d31972e9fdc323
Related: OS2591
Diffstat (limited to 'include/osmocom/bsc/acc_ramp.h')
-rw-r--r-- | include/osmocom/bsc/acc_ramp.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/osmocom/bsc/acc_ramp.h b/include/osmocom/bsc/acc_ramp.h index cb063bf53..efb12b088 100644 --- a/include/osmocom/bsc/acc_ramp.h +++ b/include/osmocom/bsc/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); |