pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/27858 )
Change subject: bts: Simplify bts->paging initialization ...................................................................... bts: Simplify bts->paging initialization Related: SYS#5922 Change-Id: Id103d5f3d437065abcd32788caef339343b1e96 --- M include/osmocom/bsc/paging.h M src/osmo-bsc/bsc_vty.c M src/osmo-bsc/bts.c M src/osmo-bsc/paging.c 4 files changed, 8 insertions(+), 29 deletions(-) Approvals: fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h index 2d0f8da..dd3d316 100644 --- a/include/osmocom/bsc/paging.h +++ b/include/osmocom/bsc/paging.h @@ -89,6 +89,8 @@ enum bsc_paging_reason reason; }; +void paging_init(struct gsm_bts *bts); + /* schedule paging request */ int paging_request_bts(const struct bsc_paging_params *params, struct gsm_bts *bts); diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index 6fb78d8..d452a52 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -1044,9 +1044,6 @@ { struct gsm_paging_request *pag; - if (!bts->paging.bts) - return; - llist_for_each_entry(pag, &bts->paging.pending_requests, entry) paging_dump_vty(vty, pag); } diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c index f4c90e0..87ed44f 100644 --- a/src/osmo-bsc/bts.c +++ b/src/osmo-bsc/bts.c @@ -24,6 +24,7 @@ #include <osmocom/bsc/bts.h> #include <osmocom/bsc/debug.h> #include <osmocom/bsc/nm_common_fsm.h> +#include <osmocom/bsc/paging.h> const struct value_string bts_attribute_names[] = { OSMO_VALUE_STRING(BTS_TYPE_VARIANT), @@ -268,8 +269,7 @@ bts->rach_b_thresh = -1; bts->rach_ldavg_slots = -1; - bts->paging.free_chans_need = -1; - INIT_LLIST_HEAD(&bts->paging.pending_requests); + paging_init(bts); bts->features.data = &bts->_features_data[0]; bts->features.data_len = sizeof(bts->_features_data); diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c index 721ea31..512f39c 100644 --- a/src/osmo-bsc/paging.c +++ b/src/osmo-bsc/paging.c @@ -240,22 +240,14 @@ } /*! initialize the bts paging state, if it hasn't been initialized yet */ -static void paging_init_if_needed(struct gsm_bts *bts) +void paging_init(struct gsm_bts *bts) { - if (bts->paging.bts) - return; - bts->paging.bts = bts; - - /* This should be initialized only once. There is currently no code that sets bts->paging.bts - * back to NULL, so let's just assert this one instead of graceful handling. */ - OSMO_ASSERT(llist_empty(&bts->paging.pending_requests)); - - osmo_timer_setup(&bts->paging.work_timer, paging_worker, - &bts->paging); - + bts->paging.free_chans_need = -1; /* Large number, until we get a proper message */ bts->paging.available_slots = 20; + INIT_LLIST_HEAD(&bts->paging.pending_requests); + osmo_timer_setup(&bts->paging.work_timer, paging_worker, &bts->paging); } /*! do we have any pending paging requests for given subscriber? */ @@ -379,9 +371,6 @@ if (!trx_is_usable(bts->c0)) return 0; - /* maybe it is the first time we use it */ - paging_init_if_needed(bts); - /* Trigger paging, pass any error to the caller */ rc = _paging_request(params, bts); if (rc < 0) @@ -405,8 +394,6 @@ *msc_p = NULL; *reason_p = BSC_PAGING_NONE; - paging_init_if_needed(bts); - llist_for_each_entry_safe(req, req2, &bts_entry->pending_requests, entry) { if (req->bsub != bsub) @@ -474,8 +461,6 @@ llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) { struct gsm_paging_request *req, *req2; - paging_init_if_needed(bts); - llist_for_each_entry_safe(req, req2, &bts->paging.pending_requests, entry) { if (req->bsub != bsub) continue; @@ -492,7 +477,6 @@ /*! Update the BTS paging buffer slots on given BTS */ void paging_update_buffer_space(struct gsm_bts *bts, uint16_t free_slots) { - paging_init_if_needed(bts); osmo_timer_del(&bts->paging.credit_timer); bts->paging.available_slots = free_slots; @@ -505,8 +489,6 @@ unsigned int requests = 0; struct gsm_paging_request *req; - paging_init_if_needed(bts); - llist_for_each_entry(req, &bts->paging.pending_requests, entry) ++requests; @@ -519,8 +501,6 @@ struct gsm_paging_request *req, *req2; int num_cancelled = 0; - paging_init_if_needed(bts); - llist_for_each_entry_safe(req, req2, &bts->paging.pending_requests, entry) { if (msc && req->msc != msc) continue; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/27858 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Id103d5f3d437065abcd32788caef339343b1e96a Gerrit-Change-Number: 27858 Gerrit-PatchSet: 7 Gerrit-Owner: pespin <pes...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de> Gerrit-Reviewer: osmith <osm...@sysmocom.de> Gerrit-Reviewer: pespin <pes...@sysmocom.de> Gerrit-MessageType: merged