From ad1f436512670b5b54cee7de1b6b93209998d1ba Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 29 Apr 2022 17:10:57 +0200 Subject: [PATCH] paging: Document 'ccch_load_ind_period * 2' value Change-Id: Ie88bb0f9859bcf4b3b4a07ccf3b1791cb50163f1 --- src/osmo-bsc/paging.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c index 1430c225b..2ba0fcbc7 100644 --- a/src/osmo-bsc/paging.c +++ b/src/osmo-bsc/paging.c @@ -73,6 +73,11 @@ static const struct timespec retrans_period = { .tv_nsec = 500 * 1000 * 1000, }; +/* If no CCCH Lod Ind is received before this time period, the BTS is considered + * to have stopped sending CCCH Load Indication, probaby due to being under Load + * Threshold: */ +#define bts_no_ccch_load_ind_timeout_sec(bts) ((bts)->ccch_load_ind_period * 2) + /* * Kill one paging request update the internal list... */ @@ -132,13 +137,14 @@ static void paging_give_credit(void *data) { struct gsm_bts_paging_state *paging_bts_st = data; struct gsm_bts *bts = paging_bts_st->bts; - uint16_t estimated_slots = paging_estimate_available_slots(bts, bts->ccch_load_ind_period * 2); + unsigned int load_ind_timeout = bts_no_ccch_load_ind_timeout_sec(bts); + uint16_t estimated_slots = paging_estimate_available_slots(bts, load_ind_timeout); LOG_BTS(bts, DPAG, LOGL_INFO, "Timeout waiting for CCCH Load Indication, assuming BTS is below Load Threshold (available_slots %u -> %u)\n", paging_bts_st->available_slots, estimated_slots); paging_bts_st->available_slots = estimated_slots; paging_schedule_if_needed(paging_bts_st); - osmo_timer_schedule(&bts->paging.credit_timer, bts->ccch_load_ind_period * 2, 0); + osmo_timer_schedule(&bts->paging.credit_timer, load_ind_timeout, 0); } /*! count the number of free channels for given RSL channel type required @@ -294,11 +300,12 @@ void paging_init(struct gsm_bts *bts) { bts->paging.bts = bts; bts->paging.free_chans_need = -1; - bts->paging.available_slots = paging_estimate_available_slots(bts, bts->ccch_load_ind_period * 2); + unsigned int load_ind_timeout = bts_no_ccch_load_ind_timeout_sec(bts); + bts->paging.available_slots = paging_estimate_available_slots(bts, load_ind_timeout); INIT_LLIST_HEAD(&bts->paging.pending_requests); osmo_timer_setup(&bts->paging.work_timer, paging_worker, &bts->paging); osmo_timer_setup(&bts->paging.credit_timer, paging_give_credit, &bts->paging); - osmo_timer_schedule(&bts->paging.credit_timer, bts->ccch_load_ind_period * 2, 0); + osmo_timer_schedule(&bts->paging.credit_timer, load_ind_timeout, 0); } /* Called upon the bts struct being freed */ @@ -583,7 +590,8 @@ void paging_update_buffer_space(struct gsm_bts *bts, uint16_t free_slots) bts->paging.available_slots = free_slots; paging_schedule_if_needed(&bts->paging); /* Re-arm credit_timer */ - osmo_timer_schedule(&bts->paging.credit_timer, bts->ccch_load_ind_period * 2, 0); + osmo_timer_schedule(&bts->paging.credit_timer, + bts_no_ccch_load_ind_timeout_sec(bts), 0); } /*! Count the number of pending paging requests on given BTS */