<p>pespin <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/23110">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  fixeria: Looks good to me, approved
  osmith: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bts: Add new stats to detect TBF allocation failure reasons<br><br>This is specially useful to detect for instance if a cell is handling<br>too many users, ending up in TFI or USF exhaustions. This information<br>can be later in the future used to tune TBF allocation algorithm behavior<br>(either manually/statially through config file, or<br>automatically/dynamically in code based on some thresholds).<br><br>Related: OS#5042<br>Change-Id: I5402e937ff8d800684655e500ef8e5c867141dc3<br>---<br>M src/bts.cpp<br>M src/bts.h<br>M src/gprs_rlcmac_ts_alloc.cpp<br>3 files changed, 15 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/bts.cpp b/src/bts.cpp</span><br><span>index 8d1fb3f..55d45b8 100644</span><br><span>--- a/src/bts.cpp</span><br><span>+++ b/src/bts.cpp</span><br><span>@@ -100,7 +100,11 @@</span><br><span>      { "tbf:reused",                       "TBF Reused           "},</span><br><span>  { "tbf:alloc:algo-a",         "TBF Alloc Algo A     "},</span><br><span>  { "tbf:alloc:algo-b",         "TBF Alloc Algo B     "},</span><br><span style="color: hsl(0, 100%, 40%);">-     { "tbf:alloc:failed",         "TBF Alloc Failure    "},</span><br><span style="color: hsl(120, 100%, 40%);">+   { "tbf:alloc:failed",         "TBF Alloc Failure (any reason)"},</span><br><span style="color: hsl(120, 100%, 40%);">+  { "tbf:alloc:failed:no_tfi",  "TBF Alloc Failure (TFIs exhausted)"},</span><br><span style="color: hsl(120, 100%, 40%);">+      { "tbf:alloc:failed:no_usf",  "TBF Alloc Failure (USFs exhausted)"},</span><br><span style="color: hsl(120, 100%, 40%);">+      { "tbf:alloc:failed:no_slot_combi", "TBF Alloc Failure (No valid UL/DL slot combination found)"},</span><br><span style="color: hsl(120, 100%, 40%);">+ { "tbf:alloc:failed:no_slot_avail", "TBF Alloc Failure (No slot available)"},</span><br><span>    { "rlc:sent",                 "RLC Sent             "},</span><br><span>  { "rlc:resent",                       "RLC Resent           "},</span><br><span>  { "rlc:restarted",            "RLC Restarted        "},</span><br><span>@@ -609,6 +613,7 @@</span><br><span> </span><br><span>        if (best_trx_nr == 0xff || best_cnt == 0) {</span><br><span>          LOGP(DRLCMAC, LOGL_NOTICE, "No TFI available (suggested TRX: %d).\n", use_trx);</span><br><span style="color: hsl(120, 100%, 40%);">+             bts_do_rate_ctr_inc(bts, CTR_TBF_ALLOC_FAIL_NO_TFI);</span><br><span>                 return -EBUSY;</span><br><span>       }</span><br><span> </span><br><span>diff --git a/src/bts.h b/src/bts.h</span><br><span>index d321b8d..15a72bd 100644</span><br><span>--- a/src/bts.h</span><br><span>+++ b/src/bts.h</span><br><span>@@ -88,6 +88,10 @@</span><br><span>  CTR_TBF_ALLOC_ALGO_A,</span><br><span>        CTR_TBF_ALLOC_ALGO_B,</span><br><span>        CTR_TBF_ALLOC_FAIL,</span><br><span style="color: hsl(120, 100%, 40%);">+   CTR_TBF_ALLOC_FAIL_NO_TFI,</span><br><span style="color: hsl(120, 100%, 40%);">+    CTR_TBF_ALLOC_FAIL_NO_USF,</span><br><span style="color: hsl(120, 100%, 40%);">+    CTR_TBF_ALLOC_FAIL_NO_SLOT_COMBI,</span><br><span style="color: hsl(120, 100%, 40%);">+     CTR_TBF_ALLOC_FAIL_NO_SLOT_AVAIL,</span><br><span>    CTR_RLC_SENT,</span><br><span>        CTR_RLC_RESENT,</span><br><span>      CTR_RLC_RESTARTED,</span><br><span>@@ -319,11 +323,11 @@</span><br><span>   return bts->statg;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static inline void bts_do_rate_ctr_inc(struct gprs_rlcmac_bts *bts, unsigned int ctr_id) {</span><br><span style="color: hsl(120, 100%, 40%);">+static inline void bts_do_rate_ctr_inc(const struct gprs_rlcmac_bts *bts, unsigned int ctr_id) {</span><br><span>   rate_ctr_inc(&bts->ratectrs->ctr[ctr_id]);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static inline void bts_do_rate_ctr_add(struct gprs_rlcmac_bts *bts, unsigned int ctr_id, int inc) {</span><br><span style="color: hsl(120, 100%, 40%);">+static inline void bts_do_rate_ctr_add(const struct gprs_rlcmac_bts *bts, unsigned int ctr_id, int inc) {</span><br><span>  rate_ctr_add(&bts->ratectrs->ctr[ctr_id], inc);</span><br><span> }</span><br><span> </span><br><span>diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp</span><br><span>index 1dc31f6..dd921e7 100644</span><br><span>--- a/src/gprs_rlcmac_ts_alloc.cpp</span><br><span>+++ b/src/gprs_rlcmac_ts_alloc.cpp</span><br><span>@@ -647,6 +647,7 @@</span><br><span>        if (!max_ul_slots || !max_dl_slots) {</span><br><span>                LOGP(DRLCMAC, LOGL_NOTICE,</span><br><span>                   "No valid UL/DL slot combination found\n");</span><br><span style="color: hsl(120, 100%, 40%);">+         bts_do_rate_ctr_inc(trx->bts, CTR_TBF_ALLOC_FAIL_NO_SLOT_COMBI);</span><br><span>          return -EINVAL;</span><br><span>      }</span><br><span> </span><br><span>@@ -719,6 +720,7 @@</span><br><span>  if (!sl) {</span><br><span>           LOGP(DRLCMAC, LOGL_NOTICE, "No %s slots available\n",</span><br><span>                   tbf->direction != GPRS_RLCMAC_DL_TBF ? "uplink" : "downlink");</span><br><span style="color: hsl(120, 100%, 40%);">+            bts_do_rate_ctr_inc(trx->bts, CTR_TBF_ALLOC_FAIL_NO_SLOT_AVAIL);</span><br><span>          return -EINVAL;</span><br><span>      }</span><br><span> </span><br><span>@@ -771,6 +773,7 @@</span><br><span> </span><br><span>      if (!ul_slots) {</span><br><span>             LOGP(DRLCMAC, LOGL_NOTICE, "No USF available\n");</span><br><span style="color: hsl(120, 100%, 40%);">+           bts_do_rate_ctr_inc(trx->bts, CTR_TBF_ALLOC_FAIL_NO_USF);</span><br><span>                 return -EBUSY;</span><br><span>       }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/23110">change 23110</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/+/23110"/><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: I5402e937ff8d800684655e500ef8e5c867141dc3 </div>
<div style="display:none"> Gerrit-Change-Number: 23110 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>