Review at  https://gerrit.osmocom.org/6874

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
---
M src/common/load_indication.c
M src/common/oml.c
2 files changed, 9 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/74/6874/1

diff --git a/src/common/load_indication.c b/src/common/load_indication.c
index a445ecb..4756d5a 100644
--- a/src/common/load_indication.c
+++ b/src/common/load_indication.c
@@ -85,11 +85,12 @@
 {
        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 00b85f1..75c2347 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -695,8 +695,10 @@
                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)) {

-- 
To view, visit https://gerrit.osmocom.org/6874
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I295d91413542014aa2507d5f09e01243fc3916fa
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to