diff options
Diffstat (limited to 'src/osmo-bsc/chan_alloc.c')
-rw-r--r-- | src/osmo-bsc/chan_alloc.c | 63 |
1 files changed, 59 insertions, 4 deletions
diff --git a/src/osmo-bsc/chan_alloc.c b/src/osmo-bsc/chan_alloc.c index 9c5d0dd44..bea16201c 100644 --- a/src/osmo-bsc/chan_alloc.c +++ b/src/osmo-bsc/chan_alloc.c @@ -51,22 +51,27 @@ void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts) for (i = 0; i < ARRAY_SIZE(trx->ts); i++) { struct gsm_bts_trx_ts *ts = &trx->ts[i]; -// enum gsm_phys_chan_config pchan = ts->pchan_on_init; - enum gsm_phys_chan_config pchan = ts->pchan_is; - struct load_counter *pl = &cl->pchan[pchan]; + struct load_counter *pl = &cl->pchan[ts->pchan_on_init]; struct gsm_lchan *lchan; /* skip administratively deactivated timeslots */ if (!nm_is_running(&ts->mo.nm_state)) continue; + /* dynamic timeslots have to be counted separately + * when not in TCH/F or TCH/H mode because they don't + * have an lchan's allocated to them */ if ( ( ts->pchan_on_init == GSM_PCHAN_TCH_F_TCH_H_PDCH || ts->pchan_on_init == GSM_PCHAN_TCH_F_PDCH) && ( ts->pchan_is == GSM_PCHAN_NONE || ts->pchan_is == GSM_PCHAN_PDCH)) { - cl->pchan[GSM_PCHAN_TCH_F].total++; + pl->total++; } + /* count allocated logical channels. + * Note: When GSM_PCHAN_TCH_F_TCH_H_PDCH is allocation + * in TCH/H mode, this leads to changing the total + * count vs the TCH/F allocation */ ts_for_each_lchan(lchan, ts) { /* don't even count CBCH slots in total */ if (lchan->type == GSM_LCHAN_CBCH) @@ -96,6 +101,53 @@ void network_chan_load(struct pchan_load *pl, struct gsm_network *net) bts_chan_load(pl, bts); } +static void chan_load_stat_set(enum gsm_phys_chan_config pchan, + struct gsm_bts *bts, + struct load_counter *lc) +{ + switch (pchan) { + case GSM_PCHAN_NONE: + case GSM_PCHAN_CCCH: + case GSM_PCHAN_PDCH: + case GSM_PCHAN_UNKNOWN: + break; + case GSM_PCHAN_CCCH_SDCCH4: + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_CCCH_SDCCH4_USED], lc->used); + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_CCCH_SDCCH4_TOTAL], lc->total); + break; + case GSM_PCHAN_TCH_F: + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_USED], lc->used); + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_TOTAL], lc->total); + break; + case GSM_PCHAN_TCH_H: + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_H_USED], lc->used); + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_H_TOTAL], lc->total); + break; + case GSM_PCHAN_SDCCH8_SACCH8C: + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_SDCCH8_USED], lc->used); + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_SDCCH8_TOTAL], lc->total); + break; + case GSM_PCHAN_TCH_F_PDCH: + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_PDCH_USED], lc->used); + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_PDCH_TOTAL], lc->total); + break; + case GSM_PCHAN_CCCH_SDCCH4_CBCH: + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_CCCH_SDCCH4_CBCH_USED], lc->used); + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_CCCH_SDCCH4_CBCH_TOTAL], lc->total); + break; + case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_SDCCH8_CBCH_USED], lc->used); + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_SDCCH8_CBCH_TOTAL], lc->total); + break; + case GSM_PCHAN_TCH_F_TCH_H_PDCH: + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_TCH_H_PDCH_USED], lc->used); + osmo_stat_item_set(bts->bts_statg->items[BTS_STAT_CHAN_TCH_F_TCH_H_PDCH_TOTAL], lc->total); + break; + default: + LOG_BTS(bts, DRLL, LOGL_NOTICE, "Unknown channel type %d\n", pchan); + } +} + /* Update T3122 wait indicator based on samples of BTS channel load. */ void bts_update_t3122_chan_load(struct gsm_bts *bts) @@ -120,6 +172,9 @@ bts_update_t3122_chan_load(struct gsm_bts *bts) for (i = 0; i < ARRAY_SIZE(pl.pchan); i++) { struct load_counter *lc = &pl.pchan[i]; + /* Export channel load to stats gauges */ + chan_load_stat_set(i, bts, lc); + /* Ignore samples too large for fixed-point calculations (shouldn't happen). */ if (lc->used > UINT16_MAX || lc->total > UINT16_MAX) { LOG_BTS(bts, DRLL, LOGL_NOTICE, "numbers in channel load sample " |