bts: Add new stats to detect TBF allocation failure reasons

This is specially useful to detect for instance if a cell is handling
too many users, ending up in TFI or USF exhaustions. This information
can be later in the future used to tune TBF allocation algorithm behavior
(either manually/statially through config file, or
automatically/dynamically in code based on some thresholds).

Related: OS#5042
Change-Id: I5402e937ff8d800684655e500ef8e5c867141dc3
This commit is contained in:
Pau Espin 2021-02-25 18:30:33 +01:00
parent c85e093969
commit 9688dc9aca
3 changed files with 15 additions and 3 deletions

View File

@ -100,7 +100,11 @@ static const struct rate_ctr_desc bts_ctr_description[] = {
{ "tbf:reused", "TBF Reused "},
{ "tbf:alloc:algo-a", "TBF Alloc Algo A "},
{ "tbf:alloc:algo-b", "TBF Alloc Algo B "},
{ "tbf:alloc:failed", "TBF Alloc Failure "},
{ "tbf:alloc:failed", "TBF Alloc Failure (any reason)"},
{ "tbf:alloc:failed:no_tfi", "TBF Alloc Failure (TFIs exhausted)"},
{ "tbf:alloc:failed:no_usf", "TBF Alloc Failure (USFs exhausted)"},
{ "tbf:alloc:failed:no_slot_combi", "TBF Alloc Failure (No valid UL/DL slot combination found)"},
{ "tbf:alloc:failed:no_slot_avail", "TBF Alloc Failure (No slot available)"},
{ "rlc:sent", "RLC Sent "},
{ "rlc:resent", "RLC Resent "},
{ "rlc:restarted", "RLC Restarted "},
@ -609,6 +613,7 @@ int bts_tfi_find_free(const struct gprs_rlcmac_bts *bts, enum gprs_rlcmac_tbf_di
if (best_trx_nr == 0xff || best_cnt == 0) {
LOGP(DRLCMAC, LOGL_NOTICE, "No TFI available (suggested TRX: %d).\n", use_trx);
bts_do_rate_ctr_inc(bts, CTR_TBF_ALLOC_FAIL_NO_TFI);
return -EBUSY;
}

View File

@ -88,6 +88,10 @@ enum {
CTR_TBF_ALLOC_ALGO_A,
CTR_TBF_ALLOC_ALGO_B,
CTR_TBF_ALLOC_FAIL,
CTR_TBF_ALLOC_FAIL_NO_TFI,
CTR_TBF_ALLOC_FAIL_NO_USF,
CTR_TBF_ALLOC_FAIL_NO_SLOT_COMBI,
CTR_TBF_ALLOC_FAIL_NO_SLOT_AVAIL,
CTR_RLC_SENT,
CTR_RLC_RESENT,
CTR_RLC_RESTARTED,
@ -319,11 +323,11 @@ static inline struct osmo_stat_item_group *bts_stat_items(struct gprs_rlcmac_bts
return bts->statg;
}
static inline void bts_do_rate_ctr_inc(struct gprs_rlcmac_bts *bts, unsigned int ctr_id) {
static inline void bts_do_rate_ctr_inc(const struct gprs_rlcmac_bts *bts, unsigned int ctr_id) {
rate_ctr_inc(&bts->ratectrs->ctr[ctr_id]);
}
static inline void bts_do_rate_ctr_add(struct gprs_rlcmac_bts *bts, unsigned int ctr_id, int inc) {
static inline void bts_do_rate_ctr_add(const struct gprs_rlcmac_bts *bts, unsigned int ctr_id, int inc) {
rate_ctr_add(&bts->ratectrs->ctr[ctr_id], inc);
}

View File

@ -647,6 +647,7 @@ int find_multi_slots(struct gprs_rlcmac_trx *trx, uint8_t mslot_class, uint8_t *
if (!max_ul_slots || !max_dl_slots) {
LOGP(DRLCMAC, LOGL_NOTICE,
"No valid UL/DL slot combination found\n");
bts_do_rate_ctr_inc(trx->bts, CTR_TBF_ALLOC_FAIL_NO_SLOT_COMBI);
return -EINVAL;
}
@ -719,6 +720,7 @@ static int tbf_select_slot_set(const gprs_rlcmac_tbf *tbf, const gprs_rlcmac_trx
if (!sl) {
LOGP(DRLCMAC, LOGL_NOTICE, "No %s slots available\n",
tbf->direction != GPRS_RLCMAC_DL_TBF ? "uplink" : "downlink");
bts_do_rate_ctr_inc(trx->bts, CTR_TBF_ALLOC_FAIL_NO_SLOT_AVAIL);
return -EINVAL;
}
@ -771,6 +773,7 @@ static int allocate_usf(const gprs_rlcmac_trx *trx, uint8_t selected_ul_slots, u
if (!ul_slots) {
LOGP(DRLCMAC, LOGL_NOTICE, "No USF available\n");
bts_do_rate_ctr_inc(trx->bts, CTR_TBF_ALLOC_FAIL_NO_USF);
return -EBUSY;
}