Change in osmo-bts[master]: paging: prioritize ps related paging over cs related pagings.

dexter gerrit-no-reply at lists.osmocom.org
Mon Jun 14 15:59:22 UTC 2021


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/24658 )


Change subject: paging: prioritize ps related paging over cs related pagings.
......................................................................

paging: prioritize ps related paging over cs related pagings.

When the paging queue is filled up to a critical level, pagings from the
PCU should be dropped as each immediate assignment paging from the PCU
is worth 4 CS pagings. Also the PCU may still issue pagings if the
paginging queue is already full and CS pagings are dropped. In a
congestion situation it is more important to get the CS rather than PS
pagings through.

Change-Id: I30f97672d7a0c369c4a656e878ab8cbbd83e31ea
Related: SYS#5306
---
M src/common/paging.c
1 file changed, 41 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/58/24658/1

diff --git a/src/common/paging.c b/src/common/paging.c
index 2973141..8924471 100644
--- a/src/common/paging.c
+++ b/src/common/paging.c
@@ -80,8 +80,33 @@
 	/* total number of currently active paging records in queue */
 	unsigned int num_paging;
 	struct llist_head paging_queue[MAX_PAGING_BLOCKS_CCCH*MAX_BS_PA_MFRMS];
+
+	/* prioritization of cs pagings will automatically become
+	 * active on congestions (queue almost full) */
+	bool cs_priority_active;
 };
 
+/* Upper queue fill level in %, when execeeed prioritization is turned on */
+#define THRESHOLD_CONGESTED 66
+/* Lower queue fill level in %, when reached prioritization is turned off again */
+#define THRESHOLD_CLEAR 50
+
+/* Check the queue fill status and decide if prioritization of CS pagings
+ * must be turned on to flatten the negative effects of the congestion
+ * situation on the CS domain. */
+static void check_congestion(struct paging_state *ps)
+{
+	int pag_queue_len = paging_queue_length(ps);
+	int pag_queue_max = paging_get_queue_max(ps);
+	unsigned int treshold_upper = pag_queue_max * THRESHOLD_CONGESTED / 100;
+	unsigned int treshold_lower = pag_queue_max * THRESHOLD_CLEAR / 100;
+
+	if (pag_queue_len > treshold_upper)
+		ps->cs_priority_active = true;
+	else if (pag_queue_len < treshold_lower)
+		ps->cs_priority_active = false;
+}
+
 unsigned int paging_get_lifetime(struct paging_state *ps)
 {
 	return ps->paging_lifetime;
@@ -181,6 +206,8 @@
 	int blocks = gsm48_number_of_paging_subchannels(&ps->chan_desc);
 	struct paging_record *pr;
 
+	check_congestion(ps);
+
 	rate_ctr_inc2(ps->bts->ctrs, BTS_CTR_PAGING_RCVD);
 
 	if (paging_group >= blocks) {
@@ -244,6 +271,15 @@
 	struct paging_record *pr;
 	uint16_t imsi, paging_group;
 
+	check_congestion(ps);
+
+	if (ps->cs_priority_active) {
+		LOGP(DPAG, LOGL_NOTICE, "Dropping paging for PS, queue congested (%u)\n",
+			ps->num_paging);
+		rate_ctr_inc2(ps->bts->ctrs, BTS_CTR_PAGING_DROP);
+		return -ENOSPC;
+	}
+
 	if (len != GSM_MACBLOCK_LEN + 3) {
 		LOGP(DPAG, LOGL_ERROR, "IMM.ASS invalid length %d\n", len);
 		return -EINVAL;
@@ -530,6 +566,10 @@
 	int group;
 	int len;
 
+	/* This will have no effect on behavior of this function, we just need
+	 * need to check the congestion status of the queue from time to time. */
+	check_congestion(ps);
+
 	*is_empty = 0;
 	bts->load.ccch.pch_total += 1;
 
@@ -711,6 +751,7 @@
 	ps->bts = bts;
 	ps->paging_lifetime = paging_lifetime;
 	ps->num_paging_max = num_paging_max;
+	ps->cs_priority_active = false;
 
 	for (i = 0; i < ARRAY_SIZE(ps->paging_queue); i++)
 		INIT_LLIST_HEAD(&ps->paging_queue[i]);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I30f97672d7a0c369c4a656e878ab8cbbd83e31ea
Gerrit-Change-Number: 24658
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210614/7049f6ab/attachment.htm>


More information about the gerrit-log mailing list