[PATCH] osmo-bsc[master]: paging: Remove obsolete paging call-back support

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Dec 11 15:21:16 UTC 2017


Review at  https://gerrit.osmocom.org/5285

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
---
M include/osmocom/bsc/paging.h
M src/libbsc/paging.c
M src/osmo-bsc/osmo_bsc_filter.c
M src/osmo-bsc/osmo_bsc_grace.c
4 files changed, 28 insertions(+), 54 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/85/5285/1

diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h
index e917772..533f366 100644
--- a/include/osmocom/bsc/paging.h
+++ b/include/osmocom/bsc/paging.h
@@ -29,6 +29,8 @@
 #include <osmocom/bsc/gsm_data.h>
 #include <osmocom/bsc/bsc_subscriber.h>
 
+struct bsc_msc_data;
+
 /**
  * A pending paging request
  */
@@ -49,16 +51,15 @@
 	/* 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 @@
 /* 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 41e134d..f4679de 100644
--- a/src/libbsc/paging.c
+++ b/src/libbsc/paging.c
@@ -266,9 +266,6 @@
 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 @@
 
 	/* 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 @@
 	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 @@
  * \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 @@
 	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 @@
  * \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 @@
 		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 @@
 	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 @@
 }
 
 /*! 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 7f9671a..2b71b85 100644
--- a/src/osmo-bsc/osmo_bsc_filter.c
+++ b/src/osmo-bsc/osmo_bsc_filter.c
@@ -186,7 +186,7 @@
 		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 a310079..f16a19a 100644
--- a/src/osmo-bsc/osmo_bsc_grace.c
+++ b/src/osmo-bsc/osmo_bsc_grace.c
@@ -42,12 +42,12 @@
 		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 @@
 		/*
 		 * 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 */

-- 
To view, visit https://gerrit.osmocom.org/5285
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8839e8338d3ad1a91b41e687e8412fcdca3fd9ab
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list