<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/23110">View Change</a></p><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, 16 insertions(+), 4 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/10/23110/1</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..52c3856 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 (ALL)"},</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>@@ -580,7 +584,7 @@</span><br><span>  * that is currently not used in any PDCH of a the TRX with least TFIs currently</span><br><span>  * assigned. Negative values indicate errors.</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-int bts_tfi_find_free(const struct gprs_rlcmac_bts *bts, enum gprs_rlcmac_tbf_direction dir,</span><br><span style="color: hsl(120, 100%, 40%);">+int bts_tfi_find_free(struct gprs_rlcmac_bts *bts, enum gprs_rlcmac_tbf_direction dir,</span><br><span>                  uint8_t *_trx, int8_t use_trx)</span><br><span> {</span><br><span>    uint8_t trx_from, trx_to, trx;</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..f780f43 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>@@ -284,7 +288,7 @@</span><br><span>     return bts->cur_fn;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-int bts_tfi_find_free(const struct gprs_rlcmac_bts *bts, enum gprs_rlcmac_tbf_direction dir,</span><br><span style="color: hsl(120, 100%, 40%);">+int bts_tfi_find_free(struct gprs_rlcmac_bts *bts, enum gprs_rlcmac_tbf_direction dir,</span><br><span>                uint8_t *_trx, int8_t use_trx);</span><br><span> </span><br><span> int bts_rcv_rach(struct gprs_rlcmac_bts *bts, const struct rach_ind_params *rip);</span><br><span>diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp</span><br><span>index 1dc31f6..cb49848 100644</span><br><span>--- a/src/gprs_rlcmac_ts_alloc.cpp</span><br><span>+++ b/src/gprs_rlcmac_ts_alloc.cpp</span><br><span>@@ -305,7 +305,7 @@</span><br><span>  *  \param[out] trx_no_ TRX number on which TFI was found</span><br><span>  *  \returns negative error code or 0 on success</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-static int tfi_find_free(const struct gprs_rlcmac_bts *bts, const gprs_rlcmac_trx *trx, const GprsMs *ms,</span><br><span style="color: hsl(120, 100%, 40%);">+static int tfi_find_free(struct gprs_rlcmac_bts *bts, const gprs_rlcmac_trx *trx, const GprsMs *ms,</span><br><span>                       enum gprs_rlcmac_tbf_direction dir, int8_t use_trx, uint8_t *trx_no_)</span><br><span> {</span><br><span>  int tfi;</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: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>