aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2022-05-04 19:27:34 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2022-05-13 14:06:37 +0200
commit9f8137dc735d6da5be642ccbe90827de59841ac1 (patch)
tree59c01447bd738ab3d9aa9876cbf4d4f483a0b3db /src
parent50a42e7436db6e675d7e27b6fb1565d8f71ad03a (diff)
paging: start/stop credit_timer based on C0 running
This way we avoid triggering timers and doing extra poll loops for each BTS which is configured but not up. It also has the effect of removing logging about estimating paging buffers for BTS which are down, which can be confusing. Furthermore, since work is delayed until the TRX and cell in general is configured, the first estimation is properly done now since the correct configuration is in place at that time. Related: SYS#5922 Change-Id: I1b5b1a98115b4e9d821eb3330fc5b970a0e78a44
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c1
-rw-r--r--src/osmo-bsc/paging.c77
2 files changed, 67 insertions, 11 deletions
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index c6f8b13f9..c78bb45ef 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -934,6 +934,7 @@ int main(int argc, char **argv)
handover_fsm_init();
lb_init();
acc_ramp_global_init();
+ paging_global_init();
/* Read the config */
rc = bsc_network_configure(config_file);
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index 11071ecad..a0e306764 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -223,10 +223,6 @@ static void paging_handle_pending_requests(struct gsm_bts_paging_state *paging_b
return;
}
- /* Skip paging if the bts is down. */
- if (!bts->c0->rsl_link_primary)
- goto sched_next_iter;
-
osmo_clock_gettime(CLOCK_MONOTONIC, &now);
paging_bts->last_sched_ts = now;
@@ -307,12 +303,10 @@ void paging_init(struct gsm_bts *bts)
{
bts->paging.bts = bts;
bts->paging.free_chans_need = -1;
- 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);
+ bts->paging.available_slots = 0;
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, load_ind_timeout, 0);
}
/* Called upon the bts struct being freed */
@@ -625,10 +619,12 @@ 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);
bts->paging.available_slots = free_slots;
- paging_schedule_if_needed(&bts->paging);
- /* Re-arm credit_timer */
- osmo_timer_schedule(&bts->paging.credit_timer,
- bts_no_ccch_load_ind_timeout_sec(bts), 0);
+ /* Re-arm credit_timer if needed */
+ if (trx_is_usable(bts->c0)) {
+ paging_schedule_if_needed(&bts->paging);
+ 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 */
@@ -706,3 +702,62 @@ static unsigned int paging_estimate_delay_us(struct gsm_bts *bts, unsigned int n
}
return time_us;
}
+
+/* Callback function to be called every time we receive a signal from NM */
+static int nm_sig_cb(unsigned int subsys, unsigned int signal,
+ void *handler_data, void *signal_data)
+{
+ struct nm_running_chg_signal_data *nsd;
+ struct gsm_bts *bts;
+ struct gsm_bts_trx *trx;
+ unsigned int load_ind_timeout;
+
+ if (signal != S_NM_RUNNING_CHG)
+ return 0;
+
+ nsd = signal_data;
+ bts = nsd->bts;
+
+ switch (nsd->obj_class) {
+ case NM_OC_RADIO_CARRIER:
+ trx = (struct gsm_bts_trx *)nsd->obj;
+ break;
+ case NM_OC_BASEB_TRANSC:
+ trx = gsm_bts_bb_trx_get_trx((struct gsm_bts_bb_trx *)nsd->obj);
+ break;
+ default:
+ return 0;
+ }
+
+ /* We only care about state changes of C0. */
+ if (trx != trx->bts->c0)
+ return 0;
+
+ if (nsd->running) {
+ if (trx_is_usable(trx)) {
+ LOG_BTS(bts, DPAG, LOGL_INFO, "C0 becomes available for paging\n");
+ /* Fill in initial credit */
+ load_ind_timeout = bts_no_ccch_load_ind_timeout_sec(bts);
+ bts->paging.available_slots = paging_estimate_available_slots(bts, load_ind_timeout);
+ /* Start scheduling credit_timer */
+ osmo_timer_schedule(&bts->paging.credit_timer,
+ bts_no_ccch_load_ind_timeout_sec(bts), 0);
+ /* work_timer will be started when new paging requests arrive. */
+ }
+ } else {
+ /* If credit timer was not pending it means C0 was already unavailable before (rcarrier||bbtransc) */
+ if (osmo_timer_pending(&bts->paging.credit_timer)) {
+ LOG_BTS(bts, DPAG, LOGL_INFO, "C0 becomes unavailable for paging\n");
+ /* Note: flushing will osmo_timer_del(&bts->paging.work_timer) when queue becomes empty */
+ paging_flush_bts(bts, NULL);
+ osmo_timer_del(&bts->paging.credit_timer);
+ }
+ }
+ 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);
+}