bts_chan_load(): also calculate per-TRX channel load

This is required for the upcoming dynamic channel allocation mode.

Change-Id: I220145238c23135f7e68ca2d474764312ffb66c5
Related: SYS#5460
This commit is contained in:
Vadim Yanitskiy 2022-06-16 18:08:11 +07:00
parent fa3f91d2db
commit 1f6a0decee
3 changed files with 14 additions and 0 deletions

View File

@ -81,6 +81,7 @@ struct gsm_bts_trx {
struct gsm_bts_trx_ts ts[TRX_NR_TS];
struct chan_counts chan_counts;
struct load_counter lchan_load;
};
static inline struct gsm_bts_trx *gsm_bts_bb_trx_get_trx(struct gsm_bts_bb_trx *bb_transc) {

View File

@ -747,6 +747,11 @@ void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx, bool print_rsl, bool
vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
e1isl_dump_vty(vty, trx->rsl_link_primary);
}
const struct load_counter *ll = &trx->lchan_load;
vty_out(vty, " Channel load: %u%%%s",
ll->total ? ll->used * 100 / ll->total : 0,
VTY_NEWLINE);
}
void config_write_e1_link(struct vty *vty, struct gsm_e1_subslot *e1_link,

View File

@ -44,8 +44,12 @@ void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts)
struct gsm_bts_trx *trx;
llist_for_each_entry(trx, &bts->trx_list, list) {
struct load_counter *ll = &trx->lchan_load;
int i;
/* init per-TRX load counters */
memset(ll, 0, sizeof(*ll));
/* skip administratively deactivated transceivers */
if (!trx_is_usable(trx))
continue;
@ -66,6 +70,7 @@ void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts)
ts->pchan_on_init == GSM_PCHAN_TCH_F_PDCH) &&
(ts->pchan_is == GSM_PCHAN_NONE ||
ts->pchan_is == GSM_PCHAN_PDCH)) {
ll->total++;
pl->total++;
/* Below loop would not count this timeslot, since in PDCH mode it has no usable
* timeslots. But let's make it clear that the timeslot must not be counted again: */
@ -77,11 +82,13 @@ void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts)
if (lchan->type == GSM_LCHAN_CBCH)
continue;
ll->total++;
pl->total++;
/* lchans under a BORKEN TS should be counted
* as used just as BORKEN lchans under a normal TS */
if (ts->fi->state == TS_ST_BORKEN) {
ll->used++;
pl->used++;
continue;
}
@ -90,6 +97,7 @@ void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts)
case LCHAN_ST_UNUSED:
break;
default:
ll->used++;
pl->used++;
break;
}