From f4b66fb2f13b22797d547cc4ce3650a25f3ee3e4 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 11 Dec 2017 15:21:48 +0100 Subject: paging: Remove obsolete paging call-back support The call-back was needed inside the NITB to determine which part (CC, SMS, ...) had triggered a given paging. A pure BSC doesn't need that feature, so let's get rid of it. The 'void *cbfn_data' is replaced with a 'struct bsc_msc_data *', as all callers use it with that type. Change-Id: I8839e8338d3ad1a91b41e687e8412fcdca3fd9ab --- include/osmocom/bsc/paging.h | 17 +++++++------ src/libbsc/paging.c | 57 +++++++++++------------------------------- src/osmo-bsc/osmo_bsc_filter.c | 2 +- src/osmo-bsc/osmo_bsc_grace.c | 6 ++--- 4 files changed, 28 insertions(+), 54 deletions(-) diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h index e917772a7..533f3667a 100644 --- a/include/osmocom/bsc/paging.h +++ b/include/osmocom/bsc/paging.h @@ -29,6 +29,8 @@ #include #include +struct bsc_msc_data; + /** * A pending paging request */ @@ -49,16 +51,15 @@ struct gsm_paging_request { /* How often did we ask the BTS to page? */ int attempts; - /* callback to be called in case paging completes */ - gsm_cbfn *cbfn; - void *cbfn_param; + /* MSC that has issued this paging */ + struct bsc_msc_data *msc; }; /* schedule paging request */ -int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, - int type, gsm_cbfn *cbfn, void *data); -int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, - int type, gsm_cbfn *cbfn, void *data); +int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, int type, + struct bsc_msc_data *msc); +int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, int type, + struct bsc_msc_data *msc); /* stop paging requests */ void paging_request_stop(struct llist_head *bts_list, @@ -72,6 +73,6 @@ void paging_update_buffer_space(struct gsm_bts *bts, uint16_t); /* pending paging requests */ unsigned int paging_pending_requests_nr(struct gsm_bts *bts); -void *paging_get_data(struct gsm_bts *bts, struct bsc_subscr *bsub); +struct bsc_msc_data *paging_get_msc(struct gsm_bts *bts, struct bsc_subscr *bsub); #endif diff --git a/src/libbsc/paging.c b/src/libbsc/paging.c index 41e134de0..f4679de5a 100644 --- a/src/libbsc/paging.c +++ b/src/libbsc/paging.c @@ -266,9 +266,6 @@ static int paging_pending_request(struct gsm_bts_paging_state *bts, static void paging_T3113_expired(void *data) { struct gsm_paging_request *req = (struct gsm_paging_request *)data; - void *cbfn_param; - gsm_cbfn *cbfn; - int msg; log_set_context(LOG_CTX_BSC_SUBSCR, req->bsub); @@ -277,30 +274,19 @@ static void paging_T3113_expired(void *data) /* must be destroyed before calling cbfn, to prevent double free */ rate_ctr_inc(&req->bts->network->bsc_ctrs->ctr[BSC_CTR_PAGING_EXPIRED]); - cbfn_param = req->cbfn_param; - cbfn = req->cbfn; - - /* did we ever manage to page the subscriber */ - msg = req->attempts > 0 ? GSM_PAGING_EXPIRED : GSM_PAGING_BUSY; /* destroy it now. Do not access req afterwards */ paging_remove_request(&req->bts->paging, req); - - if (cbfn) - cbfn(GSM_HOOK_RR_PAGING, msg, NULL, NULL, - cbfn_param); - } /*! Start paging + paging timer for given subscriber on given BTS * \param bts BTS on which to page * \param[in] bsub subscriber we want to page * \param[in] type type of radio channel we're requirign - * \param[in] cbfn call-back function to call once we see paging response - * \param[in] data user-data to pass to \a cbfn on paging response + * \param[in] msc MSC which has issue this paging * \returns 0 on success, negative on error */ -static int _paging_request(struct gsm_bts *bts, struct bsc_subscr *bsub, - int type, gsm_cbfn *cbfn, void *data) +static int _paging_request(struct gsm_bts *bts, struct bsc_subscr *bsub, int type, + struct bsc_msc_data *msc) { struct gsm_bts_paging_state *bts_entry = &bts->paging; struct gsm_paging_request *req; @@ -318,8 +304,7 @@ static int _paging_request(struct gsm_bts *bts, struct bsc_subscr *bsub, req->bsub = bsc_subscr_get(bsub); req->bts = bts; req->chan_type = type; - req->cbfn = cbfn; - req->cbfn_param = data; + req->msc = msc; osmo_timer_setup(&req->T3113, paging_T3113_expired, req); osmo_timer_schedule(&req->T3113, bts->network->T3113, 0); llist_add_tail(&req->entry, &bts_entry->pending_requests); @@ -332,11 +317,10 @@ static int _paging_request(struct gsm_bts *bts, struct bsc_subscr *bsub, * \param bts BTS on which to page * \param[in] bsub subscriber we want to page * \param[in] type type of radio channel we're requirign - * \param[in] cbfn call-back function to call once we see paging response - * \param[in] data user-data to pass to \a cbfn on paging response + * \param[in] msc MSC which has issue this paging * returns 1 on success; 0 in case of error (e.g. TRX down) */ -int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, - int type, gsm_cbfn *cbfn, void *data) +int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, int type, + struct bsc_msc_data *msc) { int rc; @@ -348,7 +332,7 @@ int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, paging_init_if_needed(bts); /* Trigger paging, pass any error to the caller */ - rc = _paging_request(bts, bsub, type, cbfn, data); + rc = _paging_request(bts, bsub, type, msc); if (rc < 0) return rc; return 1; @@ -358,11 +342,10 @@ int paging_request_bts(struct gsm_bts *bts, struct bsc_subscr *bsub, * \param network gsm_network we operate in * \param[in] bsub subscriber we want to page * \param[in] type type of radio channel we're requirign - * \param[in] cbfn call-back function to call once we see paging response - * \param[in] data user-data to pass to \a cbfn on paging response + * \param[in] msc MSC which has issue this paging * \returns number of BTSs on which we issued the paging */ -int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, - int type, gsm_cbfn *cbfn, void *data) +int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, int type, + struct bsc_msc_data *msc) { struct gsm_bts *bts = NULL; int num_pages = 0; @@ -377,7 +360,7 @@ int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, if (!bts) break; - rc = paging_request_bts(bts, bsub, type, cbfn, data); + rc = paging_request_bts(bts, bsub, type, msc); if (rc < 0) { paging_request_stop(&network->bts_list, NULL, bsub, NULL, NULL); @@ -413,19 +396,9 @@ static void _paging_request_stop(struct gsm_bts *bts, struct bsc_subscr *bsub, llist_for_each_entry_safe(req, req2, &bts_entry->pending_requests, entry) { if (req->bsub == bsub) { - gsm_cbfn *cbfn = req->cbfn; - void *param = req->cbfn_param; - /* now give up the data structure */ paging_remove_request(&bts->paging, req); - req = NULL; - - if (conn && cbfn) { - LOGP(DPAG, LOGL_DEBUG, "Stop paging %s on bts %d, calling cbfn.\n", bsub->imsi, bts->nr); - cbfn(GSM_HOOK_RR_PAGING, GSM_PAGING_SUCCEEDED, - msg, conn, param); - } else - LOGP(DPAG, LOGL_DEBUG, "Stop paging %s on bts %d silently.\n", bsub->imsi, bts->nr); + LOGP(DPAG, LOGL_DEBUG, "Stop paging %s on bts %d\n", bsub->imsi, bts->nr); break; } } @@ -484,13 +457,13 @@ unsigned int paging_pending_requests_nr(struct gsm_bts *bts) } /*! Find any paging data for the given subscriber at the given BTS. */ -void *paging_get_data(struct gsm_bts *bts, struct bsc_subscr *bsub) +struct bsc_msc_data *paging_get_msc(struct gsm_bts *bts, struct bsc_subscr *bsub) { struct gsm_paging_request *req; llist_for_each_entry(req, &bts->paging.pending_requests, entry) if (req->bsub == bsub) - return req->cbfn_param; + return req->msc; return NULL; } diff --git a/src/osmo-bsc/osmo_bsc_filter.c b/src/osmo-bsc/osmo_bsc_filter.c index 7f9671ac6..2b71b8508 100644 --- a/src/osmo-bsc/osmo_bsc_filter.c +++ b/src/osmo-bsc/osmo_bsc_filter.c @@ -186,7 +186,7 @@ paging: return NULL; } - pag_msc = paging_get_data(conn->bts, subscr); + pag_msc = paging_get_msc(conn->bts, subscr); bsc_subscr_put(subscr); llist_for_each_entry(msc, &bsc->mscs, entry) { diff --git a/src/osmo-bsc/osmo_bsc_grace.c b/src/osmo-bsc/osmo_bsc_grace.c index a310079f4..f16a19a6d 100644 --- a/src/osmo-bsc/osmo_bsc_grace.c +++ b/src/osmo-bsc/osmo_bsc_grace.c @@ -42,12 +42,12 @@ static int normal_paging(struct bsc_subscr *subscr, int chan_needed, struct gsm_bts *bts; llist_for_each_entry(bts, &msc->network->bts_list, list) - paging_request_bts(bts, subscr, chan_needed, NULL, msc); + paging_request_bts(bts, subscr, chan_needed, msc); return 0; } - return paging_request(msc->network, subscr, chan_needed, NULL, msc); + return paging_request(msc->network, subscr, chan_needed, msc); } static int locked_paging(struct bsc_subscr *subscr, int chan_needed, @@ -73,7 +73,7 @@ static int locked_paging(struct bsc_subscr *subscr, int chan_needed, /* * now page on this bts */ - paging_request_bts(bts, subscr, chan_needed, NULL, msc); + paging_request_bts(bts, subscr, chan_needed, msc); }; /* All bts are either off or in the grace period */ -- cgit v1.2.3