diff options
author | Harald Welte <laforge@gnumonks.org> | 2018-02-24 04:10:57 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-02-24 04:14:03 +0100 |
commit | 6e92255cc7694ad02094036a87aba46c6d8ec950 (patch) | |
tree | 62ae500c61fcca169a2ac9e5913bf28c99514b7c | |
parent | fc169ba7bba831f00de3490c49d0e2583c29db8a (diff) |
load_indication: Fix start of load indication timer
Starting the timer in bts_init() may result in it expiring already
before the load indication period is set via OML. Let's make
load_timer_start() safe to call several times and call it from OML
code.
Change-Id: I295d91413542014aa2507d5f09e01243fc3916fa
Fixes: OS#2991
-rw-r--r-- | src/common/load_indication.c | 11 | ||||
-rw-r--r-- | src/common/oml.c | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/common/load_indication.c b/src/common/load_indication.c index a445ecb1..4756d5ad 100644 --- a/src/common/load_indication.c +++ b/src/common/load_indication.c @@ -85,11 +85,12 @@ void load_timer_start(struct gsm_bts *bts) { struct gsm_bts_role_bts *btsb = bts_role_bts(bts); - btsb->load.ccch.timer.data = bts; - btsb->load.ccch.timer.cb = load_timer_cb; - reset_load_counters(bts); - osmo_timer_schedule(&btsb->load.ccch.timer, - btsb->load.ccch.load_ind_period, 0); + if (!btsb->load.ccch.timer.data) { + btsb->load.ccch.timer.data = bts; + btsb->load.ccch.timer.cb = load_timer_cb; + reset_load_counters(bts); + } + osmo_timer_schedule(&btsb->load.ccch.timer, btsb->load.ccch.load_ind_period, 0); } void load_timer_stop(struct gsm_bts *bts) diff --git a/src/common/oml.c b/src/common/oml.c index 00b85f1c..75c23477 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -695,8 +695,10 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg) btsb->load.ccch.load_ind_thresh = *TLVP_VAL(&tp, NM_ATT_CCCH_L_T); /* 9.4.11 CCCH Load Indication Period */ - if (TLVP_PRES_LEN(&tp, NM_ATT_CCCH_L_I_P, 1)) + if (TLVP_PRES_LEN(&tp, NM_ATT_CCCH_L_I_P, 1)) { btsb->load.ccch.load_ind_period = *TLVP_VAL(&tp, NM_ATT_CCCH_L_I_P); + load_timer_start(bts); + } /* 9.4.44 RACH Busy Threshold */ if (TLVP_PRES_LEN(&tp, NM_ATT_RACH_B_THRESH, 1)) { |