aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-06-16 18:08:11 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-06-22 05:49:20 +0700
commit1f6a0deceeef25fef5bab92776b3a292d0f66736 (patch)
tree0412e5b39b8ac100227937b66d9cd7a4f0c82b88 /src
parentfa3f91d2dbb72456683e139eca00a062259f1506 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bsc/bts_trx_vty.c5
-rw-r--r--src/osmo-bsc/chan_alloc.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/src/osmo-bsc/bts_trx_vty.c b/src/osmo-bsc/bts_trx_vty.c
index 9cf128e25..bd13a0529 100644
--- a/src/osmo-bsc/bts_trx_vty.c
+++ b/src/osmo-bsc/bts_trx_vty.c
@@ -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,
diff --git a/src/osmo-bsc/chan_alloc.c b/src/osmo-bsc/chan_alloc.c
index fea4efd9f..4fbf8be0b 100644
--- a/src/osmo-bsc/chan_alloc.c
+++ b/src/osmo-bsc/chan_alloc.c
@@ -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;
}