aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-06-16 18:08:11 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-06-18 04:00:47 +0700
commit5070516fb80b63a10a0eedabc753ab8d7a5fafff (patch)
tree9c4029a16c401f81953f76f664bcf1e817104a2a
parentb55f2bb829287accb5e7f60f1dcf45b34316d129 (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
-rw-r--r--include/osmocom/bsc/bts_trx.h1
-rw-r--r--src/osmo-bsc/bts_trx_vty.c5
-rw-r--r--src/osmo-bsc/chan_alloc.c8
3 files changed, 14 insertions, 0 deletions
diff --git a/include/osmocom/bsc/bts_trx.h b/include/osmocom/bsc/bts_trx.h
index eab5fecd5..8d2493fb5 100644
--- a/include/osmocom/bsc/bts_trx.h
+++ b/include/osmocom/bsc/bts_trx.h
@@ -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) {
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;
}