<p>osmith has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/25155">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Add counters: pcu.bts.N.pch.requests.timeout<br><br>Implement T3113 for paging over PCH with default value of 7s (same as<br>T3113 in OsmoBSC). Increase the new counter on timeout.<br><br>Related: SYS#4878<br>Change-Id: I97475c3dbe2cf00b9cbfec39e93a3c65cb7f749f<br>---<br>M src/Makefile.am<br>M src/bts.cpp<br>M src/bts.h<br>A src/bts_pch_timer.c<br>A src/bts_pch_timer.h<br>M src/gprs_pcu.c<br>M src/gprs_rlcmac.cpp<br>M src/tbf_ul.cpp<br>8 files changed, 139 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/55/25155/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/Makefile.am b/src/Makefile.am</span><br><span>index 8070fda..d603f2d 100644</span><br><span>--- a/src/Makefile.am</span><br><span>+++ b/src/Makefile.am</span><br><span>@@ -62,6 +62,7 @@</span><br><span>    tbf_ul.cpp \</span><br><span>         tbf_dl.cpp \</span><br><span>         bts.cpp \</span><br><span style="color: hsl(120, 100%, 40%);">+     bts_pch_timer.c \</span><br><span>    pdch.cpp \</span><br><span>   pdch_ul_controller.c \</span><br><span>       encoding.cpp \</span><br><span>diff --git a/src/bts.cpp b/src/bts.cpp</span><br><span>index 4e3b770..a96fe24 100644</span><br><span>--- a/src/bts.cpp</span><br><span>+++ b/src/bts.cpp</span><br><span>@@ -133,6 +133,7 @@</span><br><span>        { "llc:dl_bytes",               "RLC encapsulated PDUs"},</span><br><span>        { "llc:ul_bytes",               "full PDUs received   "},</span><br><span>        { "pch:requests",             "PCH requests sent    "},</span><br><span style="color: hsl(120, 100%, 40%);">+   { "pch:requests:timeout",     "PCH requests timeout "},</span><br><span>  { "rach:requests",            "RACH requests received"},</span><br><span>         { "11bit_rach:requests",      "11BIT_RACH requests received"},</span><br><span>   { "spb:uplink_first_segment",   "First seg of UL SPB  "},</span><br><span>@@ -283,6 +284,8 @@</span><br><span> </span><br><span>      llist_add_tail(&bts->list, &pcu->bts_list);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ INIT_LLIST_HEAD(&bts->pch_timer);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>   return bts;</span><br><span> }</span><br><span> </span><br><span>diff --git a/src/bts.h b/src/bts.h</span><br><span>index c28bd97..5e45527 100644</span><br><span>--- a/src/bts.h</span><br><span>+++ b/src/bts.h</span><br><span>@@ -126,6 +126,7 @@</span><br><span>  CTR_LLC_DL_BYTES,</span><br><span>    CTR_LLC_UL_BYTES,</span><br><span>    CTR_PCH_REQUESTS,</span><br><span style="color: hsl(120, 100%, 40%);">+     CTR_PCH_REQUESTS_TIMEDOUT,</span><br><span>   CTR_RACH_REQUESTS,</span><br><span>   CTR_11BIT_RACH_REQUESTS,</span><br><span>     CTR_SPB_UL_FIRST_SEGMENT,</span><br><span>@@ -263,6 +264,9 @@</span><br><span>      struct osmo_stat_item_group *statg;</span><br><span> </span><br><span>      struct GprsMsStorage *ms_store;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* List of struct bts_pch_timer for active PCH pagings */</span><br><span style="color: hsl(120, 100%, 40%);">+     struct llist_head pch_timer;</span><br><span> };</span><br><span> </span><br><span> #ifdef __cplusplus</span><br><span>diff --git a/src/bts_pch_timer.c b/src/bts_pch_timer.c</span><br><span>new file mode 100644</span><br><span>index 0000000..c496072</span><br><span>--- /dev/null</span><br><span>+++ b/src/bts_pch_timer.c</span><br><span>@@ -0,0 +1,84 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de></span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU Affero General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; either version 3 of the License, or</span><br><span style="color: hsl(120, 100%, 40%);">+ * (at your option) any later version.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * You should have received a copy of the GNU Affero General Public License</span><br><span style="color: hsl(120, 100%, 40%);">+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+#include <string.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/core/logging.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/core/talloc.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/core/tdef.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/core/utils.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <gprs_debug.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <gprs_pcu.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <bts_pch_timer.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static struct bts_pch_timer *bts_pch_timer_get(struct gprs_rlcmac_bts *bts, const char *imsi)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        struct bts_pch_timer *p;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    llist_for_each_entry(p, &bts->pch_timer, entry) {</span><br><span style="color: hsl(120, 100%, 40%);">+              if (strcmp(p->imsi, imsi) == 0)</span><br><span style="color: hsl(120, 100%, 40%);">+                    return p;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static void bts_pch_timer_remove(struct bts_pch_timer *p)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       osmo_timer_del(&p->T3113);</span><br><span style="color: hsl(120, 100%, 40%);">+     llist_del(&p->entry);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        LOGP(DPCU, LOGL_DEBUG, "PCH paging timer stopped for IMSI=%s\n", p->imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+       talloc_free(p);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static void T3113_callback(void *data)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       struct bts_pch_timer *p = data;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     LOGP(DPCU, LOGL_INFO, "PCH paging timeout for IMSI=%s\n", p->imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+      bts_do_rate_ctr_inc(p->bts, CTR_PCH_REQUESTS_TIMEDOUT);</span><br><span style="color: hsl(120, 100%, 40%);">+    bts_pch_timer_remove(p);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void bts_pch_timer_start(struct gprs_rlcmac_bts *bts, const char *imsi)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     if (bts_pch_timer_get(bts, imsi))</span><br><span style="color: hsl(120, 100%, 40%);">+             return;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     struct bts_pch_timer *p;</span><br><span style="color: hsl(120, 100%, 40%);">+      p = talloc_zero(bts, struct bts_pch_timer);</span><br><span style="color: hsl(120, 100%, 40%);">+   llist_add_tail(&p->entry, &bts->pch_timer);</span><br><span style="color: hsl(120, 100%, 40%);">+     osmo_strlcpy(p->imsi, imsi, sizeof(p->imsi));</span><br><span style="color: hsl(120, 100%, 40%);">+   p->bts = bts;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    struct osmo_tdef *tdef = osmo_tdef_get_entry(the_pcu->T_defs, 3113);</span><br><span style="color: hsl(120, 100%, 40%);">+       OSMO_ASSERT(tdef);</span><br><span style="color: hsl(120, 100%, 40%);">+    osmo_timer_setup(&p->T3113, T3113_callback, p);</span><br><span style="color: hsl(120, 100%, 40%);">+        osmo_timer_schedule(&p->T3113, tdef->val, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     LOGP(DPCU, LOGL_DEBUG, "PCH paging timer started for IMSI=%s\n", p->imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void bts_pch_timer_stop(struct gprs_rlcmac_bts *bts, const char *imsi)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       struct bts_pch_timer *p = bts_pch_timer_get(bts, imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     if (p)</span><br><span style="color: hsl(120, 100%, 40%);">+                bts_pch_timer_remove(p);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/src/bts_pch_timer.h b/src/bts_pch_timer.h</span><br><span>new file mode 100644</span><br><span>index 0000000..eff6237</span><br><span>--- /dev/null</span><br><span>+++ b/src/bts_pch_timer.h</span><br><span>@@ -0,0 +1,42 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de></span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or</span><br><span style="color: hsl(120, 100%, 40%);">+ * modify it under the terms of the GNU General Public License</span><br><span style="color: hsl(120, 100%, 40%);">+ * as published by the Free Software Foundation; either version 2</span><br><span style="color: hsl(120, 100%, 40%);">+ * of the License, or (at your option) any later version.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * You should have received a copy of the GNU Affero General Public License</span><br><span style="color: hsl(120, 100%, 40%);">+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#pragma once</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/core/linuxlist.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/core/timer.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/gsm/protocol/gsm_23_003.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <bts.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#ifdef __cplusplus</span><br><span style="color: hsl(120, 100%, 40%);">+extern "C" {</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+struct bts_pch_timer {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct llist_head entry;</span><br><span style="color: hsl(120, 100%, 40%);">+      struct gprs_rlcmac_bts *bts;</span><br><span style="color: hsl(120, 100%, 40%);">+  struct osmo_timer_list T3113;</span><br><span style="color: hsl(120, 100%, 40%);">+ char imsi[OSMO_IMSI_BUF_SIZE];</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void bts_pch_timer_start(struct gprs_rlcmac_bts *bts, const char *imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+void bts_pch_timer_stop(struct gprs_rlcmac_bts *bts, const char *imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#ifdef __cplusplus</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span>diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c</span><br><span>index 37563ec..a7bab8d 100644</span><br><span>--- a/src/gprs_pcu.c</span><br><span>+++ b/src/gprs_pcu.c</span><br><span>@@ -30,6 +30,7 @@</span><br><span> struct gprs_pcu *the_pcu;</span><br><span> </span><br><span> static struct osmo_tdef T_defs_pcu[] = {</span><br><span style="color: hsl(120, 100%, 40%);">+        { .T=3113,  .default_val=7, .unit=OSMO_TDEF_S, .desc="Timeout for paging", .val=0 },</span><br><span>       { .T=3190,  .default_val=5,   .unit=OSMO_TDEF_S,  .desc="Return to packet idle mode after Packet DL Assignment on CCCH (s)", .val=0},</span><br><span>      { .T=3141,  .default_val=10, .unit=OSMO_TDEF_S, .desc="Timeout for contention resolution procedure (s)", .val=0 },</span><br><span>         { .T=PCU_TDEF_NEIGH_RESOLVE_TO,    .default_val=1000,  .unit=OSMO_TDEF_MS,   .desc="[ARFCN+BSIC]->[RAC+CI] resolution timeout (ms)", .val=0 },</span><br><span>diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp</span><br><span>index ffa656c..22b12df 100644</span><br><span>--- a/src/gprs_rlcmac.cpp</span><br><span>+++ b/src/gprs_rlcmac.cpp</span><br><span>@@ -26,6 +26,7 @@</span><br><span> #include <pcu_l1_if.h></span><br><span> #include <gprs_rlcmac.h></span><br><span> #include <bts.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <bts_pch_timer.h></span><br><span> #include <encoding.h></span><br><span> #include <tbf.h></span><br><span> #include <gprs_debug.h></span><br><span>@@ -48,6 +49,7 @@</span><br><span>                 return -1;</span><br><span>   }</span><br><span>    bts_do_rate_ctr_inc(bts, CTR_PCH_REQUESTS);</span><br><span style="color: hsl(120, 100%, 40%);">+   bts_pch_timer_start(bts, mi->imsi);</span><br><span>       pcu_l1if_tx_pch(bts, paging_request, plen, pgroup);</span><br><span>  bitvec_free(paging_request);</span><br><span> </span><br><span>diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp</span><br><span>index b5f9f01..5ca02d9 100644</span><br><span>--- a/src/tbf_ul.cpp</span><br><span>+++ b/src/tbf_ul.cpp</span><br><span>@@ -20,6 +20,7 @@</span><br><span>  */</span><br><span> </span><br><span> #include <bts.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <bts_pch_timer.h></span><br><span> #include <tbf.h></span><br><span> #include <tbf_ul.h></span><br><span> #include <rlc.h></span><br><span>@@ -494,6 +495,7 @@</span><br><span>                                        "Decoded premier TLLI=0x%08x of UL DATA TFI=%d.\n",</span><br><span>                                        new_tlli, rlc->tfi);</span><br><span>                            update_ms(new_tlli, GPRS_RLCMAC_UL_TBF);</span><br><span style="color: hsl(120, 100%, 40%);">+                              bts_pch_timer_stop(bts, ms_imsi(ms()));</span><br><span>                      } else if (new_tlli != GSM_RESERVED_TMSI && new_tlli != tlli()) {</span><br><span>                            LOGPTBFUL(this, LOGL_NOTICE,</span><br><span>                                           "Decoded TLLI=%08x mismatch on UL DATA TFI=%d. (Ignoring due to contention resolution)\n",</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/25155">change 25155</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-pcu/+/25155"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I97475c3dbe2cf00b9cbfec39e93a3c65cb7f749f </div>
<div style="display:none"> Gerrit-Change-Number: 25155 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>