aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-03-30 15:59:41 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-03-31 12:12:21 +0200
commitd38ccedad764ecf0ce12e278756d57d4bbfd5fc8 (patch)
treeca02701f2736c7b7c61a44495becdfb12a5d75e3
parent4de07697203804f188f01002bfc5c113d2950ac3 (diff)
Move paging queue specific handling to signal callback outside RSL code
The signal is already there but not being used. Let's further split generic paging code from RSL specificites. Change-Id: Iabc1c29908a5136501d6dc6e60f8777dab511b86
-rw-r--r--include/osmocom/bsc/paging.h3
-rw-r--r--src/osmo-bsc/abis_rsl.c3
-rw-r--r--src/osmo-bsc/paging.c18
3 files changed, 18 insertions, 6 deletions
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);
}