Change in osmo-bsc[master]: LCS: add paging reason, return in paging_request_stop()

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/.

neels gerrit-no-reply at lists.osmocom.org
Thu Oct 1 04:11:10 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/20350 )


Change subject: LCS: add paging reason, return in paging_request_stop()
......................................................................

LCS: add paging reason, return in paging_request_stop()

To distinguish between the CN requiring a Complete Layer 3 response, or just
the BSC requiring a TA, allow recording a separate for-LCS paging reason.

Change-Id: Ib28d1599ae4e483727398859d07de4490fbc31f0
---
M include/osmocom/bsc/paging.h
M src/osmo-bsc/gsm_08_08.c
M src/osmo-bsc/osmo_bsc_bssap.c
M src/osmo-bsc/paging.c
4 files changed, 63 insertions(+), 28 deletions(-)



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

diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h
index 88027f3..ad99f90 100644
--- a/include/osmocom/bsc/paging.h
+++ b/include/osmocom/bsc/paging.h
@@ -33,7 +33,8 @@
 struct bsc_msc_data;
 
 #define LOG_PAGING(PARAMS, SUBSYS, LEVEL, fmt, args...) \
-	LOGP(SUBSYS, LEVEL, "Paging: msc%d %s: " fmt, \
+	LOGP(SUBSYS, LEVEL, "Paging%s: msc%d %s: " fmt, \
+	     (PARAMS)->reason == BSC_PAGING_FOR_LCS ? " for LCS" : "", \
 	     (PARAMS)->msc ? (PARAMS)->msc->nr : -1, \
 	     bsc_subscr_name((PARAMS)->bsub), \
 	     ##args)
@@ -41,7 +42,16 @@
 #define LOG_PAGING_BTS(PARAMS, BTS, SUBSYS, LEVEL, fmt, args...) \
 	LOG_PAGING(PARAMS, SUBSYS, LEVEL, "(bts%u) " fmt, (BTS) ? (BTS)->nr : 255, ##args)
 
+/* Bitmask of reasons for Paging. Each individual Paging via bsc_paging_start() typically has only one of these reasons
+ * set, but when a subscriber responds, we need to aggregate all pending Paging reasons (by bitwise-OR). */
+enum bsc_paging_reason {
+	BSC_PAGING_NONE = 0,
+	BSC_PAGING_FROM_CN = 0x1,
+	BSC_PAGING_FOR_LCS = 0x2,
+};
+
 struct bsc_paging_params {
+	enum bsc_paging_reason reason;
 	struct bsc_msc_data *msc;
 	struct bsc_subscr *bsub;
 	uint32_t tmsi;
@@ -72,12 +82,15 @@
 
 	/* MSC that has issued this paging */
 	struct bsc_msc_data *msc;
+
+	enum bsc_paging_reason reason;
 };
 
 /* schedule paging request */
 int paging_request_bts(const struct bsc_paging_params *params, struct gsm_bts *bts);
 
-struct bsc_msc_data *paging_request_stop(struct gsm_bts *bts, struct bsc_subscr *bsub);
+int paging_request_stop(struct bsc_msc_data **msc_p, enum bsc_paging_reason *reasons_p,
+			struct gsm_bts *bts, struct bsc_subscr *bsub);
 
 /* update paging load */
 void paging_update_buffer_space(struct gsm_bts *bts, uint16_t);
diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index 3af0f52..2d3a0d4 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -366,6 +366,7 @@
 	struct gsm_subscriber_connection *conn;
 	struct bsc_subscr *bsub = NULL;
 	struct bsc_msc_data *paged_from_msc;
+	enum bsc_paging_reason paging_reasons;
 	struct bsc_msc_data *msc;
 	struct msgb *create_l3;
 	struct gsm0808_speech_codec_list scl;
@@ -424,8 +425,9 @@
 	/* When receiving a Paging Response, stop Paging for this subscriber on all cells, and figure out which MSC
 	 * sent the Paging Request, if any. */
 	paged_from_msc = NULL;
+	paging_reasons = BSC_PAGING_NONE;
 	if (pdisc == GSM48_PDISC_RR && mtype == GSM48_MT_RR_PAG_RESP) {
-		paged_from_msc = paging_request_stop(bts, conn->bsub);
+		paging_request_stop(&paged_from_msc, &paging_reasons, bts, conn->bsub);
 		if (!paged_from_msc) {
 			/* This looks like an unsolicited Paging Response. It is required to pick any MSC, because any
 			 * MT-CSFB calls were Paged by the MSC via SGs, and hence are not listed in the BSC. */
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 2665a9b..023929c 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -272,6 +272,7 @@
 	int remain;
 	const uint8_t *data;
 	struct bsc_paging_params paging = {
+		.reason = BSC_PAGING_FROM_CN,
 		.msc = msc,
 		.tmsi = GSM_RESERVED_TMSI,
 	};
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index d026a20..54a5fd7 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -342,6 +342,7 @@
 	LOG_PAGING_BTS(params, bts, DPAG, LOGL_DEBUG, "Start paging\n");
 	req = talloc_zero(tall_paging_ctx, struct gsm_paging_request);
 	OSMO_ASSERT(req);
+	req->reason = params->reason;
 	req->bsub = bsc_subscr_get(params->bsub);
 	req->bts = bts;
 	req->chan_type = params->chan_needed;
@@ -380,61 +381,79 @@
 }
 
 /*! Stop paging a given subscriber on a given BTS.
- *  If \a conn is non-NULL, we also call the paging call-back function
- *  to notify the paging originator that paging has completed.
- * \param[in] bts BTS on which we shall stop paging
- * \param[in] bsub subscriber which we shall stop paging
- * \returns the MSC that paged the subscriber, if there was a pending request.
+ * \param[out] returns the MSC that paged the subscriber, if any.
+ * \param[out] returns the reason for a pending paging, if any.
+ * \param[in] bts BTS which has received a paging response.
+ * \param[in] bsub subscriber.
+ * \returns number of pending pagings.
  */
-static struct bsc_msc_data *paging_request_stop_bts(struct gsm_bts *bts, struct bsc_subscr *bsub)
+static int paging_request_stop_bts(struct bsc_msc_data **msc_p, enum bsc_paging_reason *reason_p,
+				   struct gsm_bts *bts, struct bsc_subscr *bsub)
 {
 	struct gsm_bts_paging_state *bts_entry = &bts->paging;
 	struct gsm_paging_request *req, *req2;
 
+	*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) {
-			struct bsc_msc_data *from_msc = req->msc;
-			/* now give up the data structure */
-			paging_remove_request(&bts->paging, req);
-			LOG_BTS(bts, DPAG, LOGL_DEBUG, "Stop paging %s\n", bsc_subscr_name(bsub));
-			return from_msc;
-		}
+		if (req->bsub != bsub)
+			continue;
+		*msc_p = req->msc;
+		*reason_p = req->reason;
+		LOG_BTS(bts, DPAG, LOGL_DEBUG, "Stop paging %s\n", bsc_subscr_name(bsub));
+		paging_remove_request(&bts->paging, req);
+		return 1;
 	}
 
-	return NULL;
+	return 0;
 }
 
-/*! Stop paging on all other bts'
+/*! Stop paging on all cells and return the MSC that paged (if any) and all pending paging reasons.
+ * \param[out] returns the MSC that paged the subscriber, if there was a pending request.
+ * \param[out] returns the ORed bitmask of all reasons of pending pagings.
  * \param[in] bts BTS which has received a paging response
  * \param[in] bsub subscriber
- * \returns the MSC that paged the subscriber, if there was a pending request.
+ * \returns number of pending pagings.
  */
-struct bsc_msc_data *paging_request_stop(struct gsm_bts *bts, struct bsc_subscr *bsub)
+int paging_request_stop(struct bsc_msc_data **msc_p, enum bsc_paging_reason *reasons_p,
+			struct gsm_bts *bts, struct bsc_subscr *bsub)
 {
 	struct gsm_bts *bts_i;
 	struct bsc_msc_data *paged_from_msc;
+	int count;
+	enum bsc_paging_reason reasons;
 	OSMO_ASSERT(bts);
 
-	paged_from_msc = paging_request_stop_bts(bts, bsub);
+	count = paging_request_stop_bts(&paged_from_msc, &reasons, bts, bsub);
 	if (paged_from_msc) {
+		count++;
 		rate_ctr_inc(&bts->bts_ctrs->ctr[BTS_CTR_PAGING_RESPONDED]);
 		rate_ctr_inc(&bts->network->bsc_ctrs->ctr[BSC_CTR_PAGING_RESPONDED]);
 	}
 
 	llist_for_each_entry(bts_i, &bsc_gsmnet->bts_list, list) {
-		struct bsc_msc_data *paged_from_msc2 = paging_request_stop_bts(bts_i, bsub);
-		if (!paged_from_msc && paged_from_msc2) {
-			/* If this happened, it would be a bit weird: it means there was no Paging Request
-			 * pending on the BTS that sent the Paging Reponse, but there *is* a Paging Request
-			 * pending on a different BTS. But why not return an MSC when we found one. */
-			paged_from_msc = paged_from_msc2;
+		struct bsc_msc_data *paged_from_msc2;
+		enum bsc_paging_reason reason2;
+		count += paging_request_stop_bts(&paged_from_msc2, &reason2, bts_i, bsub);
+		if (paged_from_msc2) {
+			reasons |= reason2;
+			if (!paged_from_msc) {
+				/* If this happened, it would be a bit weird: it means there was no Paging Request
+				 * pending on the BTS that sent the Paging Reponse, but there *is* a Paging Request
+				 * pending on a different BTS. But why not return an MSC when we found one. */
+				paged_from_msc = paged_from_msc2;
+			}
 		}
 	}
 
-	return paged_from_msc;
+	*msc_p = paged_from_msc;
+	*reasons_p = reasons;
+
+	return count;
 }
 
 /*! Update the BTS paging buffer slots on given BTS */

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/20350
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ib28d1599ae4e483727398859d07de4490fbc31f0
Gerrit-Change-Number: 20350
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201001/7fac8197/attachment.htm>


More information about the gerrit-log mailing list