[MERGED] openbsc[master]: bsc: Improve handling of paging_request return value

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
Tue Mar 27 13:17:28 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: bsc: Improve handling of paging_request return value
......................................................................


bsc: Improve handling of paging_request return value

Detail better in the API documentation what's the expected return value
for paging_request.

Change-Id: I17fa3b549bff297531b2777d658b0e0112a3031f
---
M openbsc/src/libbsc/paging.c
M openbsc/src/osmo-bsc/osmo_bsc_bssap.c
M openbsc/src/osmo-bsc/osmo_bsc_grace.c
3 files changed, 23 insertions(+), 6 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c
index 78e39c5..22c676f 100644
--- a/openbsc/src/libbsc/paging.c
+++ b/openbsc/src/libbsc/paging.c
@@ -326,6 +326,9 @@
 	return 1;
 }
 
+/*! Page a request on all BTS within Location Area
+ *  \returns Amount of BTS to which the paging request was sent, negative on error.
+ */
 int paging_request(struct gsm_network *network, struct bsc_subscr *bsub,
 		   int type, gsm_cbfn *cbfn, void *data)
 {
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c
index 349c98f..26278d9 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c
@@ -138,6 +138,7 @@
 	uint8_t data_length;
 	const uint8_t *data;
 	uint8_t chan_needed = RSL_CHANNEED_ANY;
+	int rc;
 
 	tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l4h + 1, payload_length - 1, 0, 0);
 
@@ -199,8 +200,14 @@
 	subscr->tmsi = tmsi;
 
 	LOGP(DMSC, LOGL_INFO, "Paging request from MSC IMSI: '%s' TMSI: '0x%x/%u' LAC: 0x%x\n", mi_string, tmsi, tmsi, lac);
-	bsc_grace_paging_request(msc->network->bsc_data->rf_ctrl->policy,
+	rc = bsc_grace_paging_request(msc->network->bsc_data->rf_ctrl->policy,
 				 subscr, chan_needed, msc);
+	if (rc <= 0) {
+		LOGP(DMSC, LOGL_ERROR, "Paging request failed (%d): IMSI: '%s' TMSI: '0x%x/%u' LAC: 0x%x\n",
+			rc, mi_string, tmsi, tmsi, lac);
+		return -1;
+	}
+
 	return 0;
 }
 
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_grace.c b/openbsc/src/osmo-bsc/osmo_bsc_grace.c
index 63afa20..bb2634f 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_grace.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_grace.c
@@ -37,14 +37,18 @@
 static int normal_paging(struct bsc_subscr *subscr, int chan_needed,
 			 struct bsc_msc_data *msc)
 {
+	int rc, num_pages = 0;
 	/* we can't page by lac.. we need to page everything */
 	if (msc->core_lac != -1) {
 		struct gsm_bts *bts;
 
-		llist_for_each_entry(bts, &msc->network->bts_list, list)
-			paging_request_bts(bts, subscr, chan_needed, NULL, msc);
+		llist_for_each_entry(bts, &msc->network->bts_list, list) {
+			rc = paging_request_bts(bts, subscr, chan_needed, NULL, msc);
+			if (rc > 0)
+				num_pages += rc;
+		}
 
-		return 0;
+		return num_pages;
 	}
 
 	return paging_request(msc->network, subscr, chan_needed, NULL, msc);
@@ -54,6 +58,7 @@
 			 struct bsc_msc_data *msc)
 {
 	struct gsm_bts *bts = NULL;
+	int rc, num_pages = 0;
 
 	/*
 	 * Check if there is any BTS that is on for the given lac. Start
@@ -73,11 +78,13 @@
 		/*
 		 * now page on this bts
 		 */
-		paging_request_bts(bts, subscr, chan_needed, NULL, msc);
+		rc = paging_request_bts(bts, subscr, chan_needed, NULL, msc);
+		if (rc > 0)
+			num_pages += rc;
 	};
 
 	/* All bts are either off or in the grace period */
-	return 0;
+	return num_pages;
 }
 
 /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I17fa3b549bff297531b2777d658b0e0112a3031f
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling <ssperling at sysmocom.de>



More information about the gerrit-log mailing list