From 565cf0d8ab15282e5f12d74e5e69baff514a6565 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 4 Jun 2012 17:27:13 +0200 Subject: attempt to make CCCH Load Indications for PCH work --- src/common/load_indication.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src/common/load_indication.c') diff --git a/src/common/load_indication.c b/src/common/load_indication.c index 12e41e43..aa2ec9c1 100644 --- a/src/common/load_indication.c +++ b/src/common/load_indication.c @@ -19,12 +19,19 @@ * */ -#include +#include #include +#include -static void reset_load_counters(void) +#include +#include +#include + +static void reset_load_counters(struct gsm_bts *bts) { + struct gsm_bts_role_bts *btsb = bts_role_bts(bts); + /* re-set the counters */ btsb->load.ccch.pch_used = btsb->load.ccch.pch_total = 0; } @@ -32,7 +39,7 @@ static void reset_load_counters(void) static void load_timer_cb(void *data) { struct gsm_bts *bts = data; - struct gsm_bts_role_bts *btsb = FIXME; + struct gsm_bts_role_bts *btsb = bts_role_bts(bts); unsigned int pch_percent; /* compute percentages */ @@ -40,30 +47,31 @@ static void load_timer_cb(void *data) if (pch_percent >= btsb->load.ccch.load_ind_thresh) { /* send RSL load indication message to BSC */ - uint16_t paging_buffer_space = FIXME; - rsl_tx_ccch_load_ind_pch(bts, paging_buffer_space); + uint16_t buffer_space = paging_buffer_space(btsb->paging_state); + rsl_tx_ccch_load_ind_pch(bts, buffer_space); } - reset_load_counters(); + reset_load_counters(bts); /* re-schedule the timer */ osmo_timer_schedule(&btsb->load.ccch.timer, btsb->load.ccch.load_ind_period, 0); } -static void load_timer_start(struct gsm_bts *bts) +void load_timer_start(struct gsm_bts *bts) { - struct gsm_bts_role_bts *btsb = FIXME; + struct gsm_bts_role_bts *btsb = bts_role_bts(bts); btsb->load.ccch.timer.data = bts; - reset_load_counters(); + 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); - - return 0 } -static void load_timer_stop(struct gsm_bts *bts) +void load_timer_stop(struct gsm_bts *bts) { + struct gsm_bts_role_bts *btsb = bts_role_bts(bts); + osmo_timer_del(&btsb->load.ccch.timer); } -- cgit v1.2.3