diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h index 15eb49e43..054e5c78d 100644 --- a/include/osmocom/bsc/paging.h +++ b/include/osmocom/bsc/paging.h @@ -150,9 +150,6 @@ void paging_request_stop(struct bsc_msc_data **msc_p, enum bsc_paging_reason *re struct gsm_bts *bts, struct bsc_subscr *bsub); void paging_request_cancel(struct bsc_subscr *bsub, enum bsc_paging_reason reasons); -/* update paging load */ -void paging_update_buffer_space(struct gsm_bts *bts, uint16_t); - /* pending paging requests */ unsigned int paging_pending_requests_nr(const struct gsm_bts *bts); diff --git a/src/osmo-bsc/abis_rsl.c b/src/osmo-bsc/abis_rsl.c index 6a9712ecb..dfe7da91d 100644 --- a/src/osmo-bsc/abis_rsl.c +++ b/src/osmo-bsc/abis_rsl.c @@ -2311,10 +2311,9 @@ static int rsl_rx_ccch_load(struct msgb *msg) switch (rslh->data[0]) { case RSL_IE_PAGING_LOAD: sd.pg_buf_space = rslh->data[1] << 8 | rslh->data[2]; - if (is_ipaccess_bts(sign_link->trx->bts) && sd.pg_buf_space == UINT16_MAX) { + if (is_ipaccess_bts(sd.bts) && sd.pg_buf_space == UINT16_MAX) { sd.pg_buf_space = paging_estimate_available_slots(sd.bts, sd.bts->ccch_load_ind_period); } - paging_update_buffer_space(sign_link->trx->bts, sd.pg_buf_space); osmo_signal_dispatch(SS_CCCH, S_CCCH_PAGING_LOAD, &sd); break; case RSL_IE_RACH_LOAD: diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c index e6f6fe4ef..1cee16431 100644 --- a/src/osmo-bsc/paging.c +++ b/src/osmo-bsc/paging.c @@ -684,7 +684,7 @@ void paging_request_cancel(struct bsc_subscr *bsub, enum bsc_paging_reason reaso } /*! Update the BTS paging buffer slots on given BTS */ -void paging_update_buffer_space(struct gsm_bts *bts, uint16_t free_slots) +static void paging_update_buffer_space(struct gsm_bts *bts, uint16_t free_slots) { LOG_BTS(bts, DPAG, LOGL_DEBUG, "Rx CCCH Load Indication from BTS (available_slots %u -> %u)\n", bts->paging.available_slots, free_slots); @@ -841,8 +841,24 @@ static int nm_sig_cb(unsigned int subsys, unsigned int signal, return 0; } +/* Callback function to be called every time we receive a signal from CCCH */ +static int ccch_sig_cb(unsigned int subsys, unsigned int signal, + void *handler_data, void *signal_data) +{ + struct ccch_signal_data *sd; + + if (signal != S_CCCH_PAGING_LOAD) + return 0; + + sd = signal_data; + + paging_update_buffer_space(sd->bts, sd->pg_buf_space); + return 0; +} + /* To be called once at startup of the process: */ void paging_global_init(void) { osmo_signal_register_handler(SS_NM, nm_sig_cb, NULL); + osmo_signal_register_handler(SS_CCCH, ccch_sig_cb, NULL); }