<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/24658">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">paging: prioritize ps related paging over cs related pagings.<br><br>When the paging queue is filled up to a critical level, pagings from the<br>PCU should be dropped as each immediate assignment paging from the PCU<br>is worth 4 CS pagings. Also the PCU may still issue pagings if the<br>paginging queue is already full and CS pagings are dropped. In a<br>congestion situation it is more important to get the CS rather than PS<br>pagings through.<br><br>Change-Id: I30f97672d7a0c369c4a656e878ab8cbbd83e31ea<br>Related: SYS#5306<br>---<br>M src/common/paging.c<br>1 file changed, 41 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/58/24658/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/common/paging.c b/src/common/paging.c</span><br><span>index 2973141..8924471 100644</span><br><span>--- a/src/common/paging.c</span><br><span>+++ b/src/common/paging.c</span><br><span>@@ -80,8 +80,33 @@</span><br><span>   /* total number of currently active paging records in queue */</span><br><span>       unsigned int num_paging;</span><br><span>     struct llist_head paging_queue[MAX_PAGING_BLOCKS_CCCH*MAX_BS_PA_MFRMS];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* prioritization of cs pagings will automatically become</span><br><span style="color: hsl(120, 100%, 40%);">+      * active on congestions (queue almost full) */</span><br><span style="color: hsl(120, 100%, 40%);">+       bool cs_priority_active;</span><br><span> };</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Upper queue fill level in %, when execeeed prioritization is turned on */</span><br><span style="color: hsl(120, 100%, 40%);">+#define THRESHOLD_CONGESTED 66</span><br><span style="color: hsl(120, 100%, 40%);">+/* Lower queue fill level in %, when reached prioritization is turned off again */</span><br><span style="color: hsl(120, 100%, 40%);">+#define THRESHOLD_CLEAR 50</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Check the queue fill status and decide if prioritization of CS pagings</span><br><span style="color: hsl(120, 100%, 40%);">+ * must be turned on to flatten the negative effects of the congestion</span><br><span style="color: hsl(120, 100%, 40%);">+ * situation on the CS domain. */</span><br><span style="color: hsl(120, 100%, 40%);">+static void check_congestion(struct paging_state *ps)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    int pag_queue_len = paging_queue_length(ps);</span><br><span style="color: hsl(120, 100%, 40%);">+  int pag_queue_max = paging_get_queue_max(ps);</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int treshold_upper = pag_queue_max * THRESHOLD_CONGESTED / 100;</span><br><span style="color: hsl(120, 100%, 40%);">+      unsigned int treshold_lower = pag_queue_max * THRESHOLD_CLEAR / 100;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        if (pag_queue_len > treshold_upper)</span><br><span style="color: hsl(120, 100%, 40%);">+                ps->cs_priority_active = true;</span><br><span style="color: hsl(120, 100%, 40%);">+     else if (pag_queue_len < treshold_lower)</span><br><span style="color: hsl(120, 100%, 40%);">+           ps->cs_priority_active = false;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> unsigned int paging_get_lifetime(struct paging_state *ps)</span><br><span> {</span><br><span>    return ps->paging_lifetime;</span><br><span>@@ -181,6 +206,8 @@</span><br><span>         int blocks = gsm48_number_of_paging_subchannels(&ps->chan_desc);</span><br><span>      struct paging_record *pr;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ check_congestion(ps);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>      rate_ctr_inc2(ps->bts->ctrs, BTS_CTR_PAGING_RCVD);</span><br><span> </span><br><span>         if (paging_group >= blocks) {</span><br><span>@@ -244,6 +271,15 @@</span><br><span>      struct paging_record *pr;</span><br><span>    uint16_t imsi, paging_group;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+      check_congestion(ps);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       if (ps->cs_priority_active) {</span><br><span style="color: hsl(120, 100%, 40%);">+              LOGP(DPAG, LOGL_NOTICE, "Dropping paging for PS, queue congested (%u)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                   ps->num_paging);</span><br><span style="color: hsl(120, 100%, 40%);">+           rate_ctr_inc2(ps->bts->ctrs, BTS_CTR_PAGING_DROP);</span><br><span style="color: hsl(120, 100%, 40%);">+              return -ENOSPC;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  if (len != GSM_MACBLOCK_LEN + 3) {</span><br><span>           LOGP(DPAG, LOGL_ERROR, "IMM.ASS invalid length %d\n", len);</span><br><span>                return -EINVAL;</span><br><span>@@ -530,6 +566,10 @@</span><br><span>       int group;</span><br><span>   int len;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+  /* This will have no effect on behavior of this function, we just need</span><br><span style="color: hsl(120, 100%, 40%);">+         * need to check the congestion status of the queue from time to time. */</span><br><span style="color: hsl(120, 100%, 40%);">+     check_congestion(ps);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>      *is_empty = 0;</span><br><span>       bts->load.ccch.pch_total += 1;</span><br><span> </span><br><span>@@ -711,6 +751,7 @@</span><br><span>  ps->bts = bts;</span><br><span>    ps->paging_lifetime = paging_lifetime;</span><br><span>    ps->num_paging_max = num_paging_max;</span><br><span style="color: hsl(120, 100%, 40%);">+       ps->cs_priority_active = false;</span><br><span> </span><br><span>       for (i = 0; i < ARRAY_SIZE(ps->paging_queue); i++)</span><br><span>             INIT_LLIST_HEAD(&ps->paging_queue[i]);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/24658">change 24658</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bts/+/24658"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I30f97672d7a0c369c4a656e878ab8cbbd83e31ea </div>
<div style="display:none"> Gerrit-Change-Number: 24658 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>