aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/bts.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2021-09-27 10:50:37 +0200
committerneels <nhofmeyr@sysmocom.de>2021-11-10 13:27:43 +0000
commite455f0ab02a130795e4d2869355624d88064b6d9 (patch)
tree77eeb59df0d0b12397eb3ba1aba58d23cca04b8f /src/osmo-bsc/bts.c
parent5944ff07a8bb0d6e6f86677b2a3265b2939ba69f (diff)
refactor lchan counting
Add chan_counts_for_trx() and chan_counts_for_bts(). Drop bts_count_free_ts() and trx_count_free_ts(). Rationale: The bts_count_free_ts() and trx_count_free_ts() always returned the number of free lchans, not timeslots. Hence, passing the pchan type as argument never really matched the semantics. Especially, when looking for free SDCCH, there is no clear match on a gsm_phys_chan_config enum value: SDCCH8_SACCH8C, CCCH_SDCCH4, CCCH_SDCCH4_CBCH, SDCCH8_SACCH8C_CBCH? -- GSM_LCHAN_SDCCH is clear. ==> Rather count free lchans by enum gsm_chan_t. Counting lchans of distinct types required separate iterations for each lchan type. ==> Rather compose an array of counts for all types, in one go. I need to count the amount of free SDCCH lchans in an upcoming patch to implement the performance indicator allAvailableAllocatedSDCCH (cumulate time for which no SDCCH are available). To implement allAvailableAllocated{SDCCH,TCH}, I need a count of both the used as well as the total lchans for a type: it does not make sense to flag "all available allocated" if none are ever available. To properly count dynamic ts, I need the maximum total that can be possible at any time. And to count currently free lchans, I need the current total. This may seem counter intuitive, but consider, e.g.: - Obviously, if a cell has only static TCH/F timeslots, it does not make sense to flag that all available TCH/H are occupied, because no TCH/H are available ever. Just stating this as contrast to dyn TS. - If a cell has OSMO_DYN timeslots, I *do* want to flag that all TCH/H are occupied when all dyn timeslots are fully occupied. - If those OSMO_DYN however are all used as TCH/F, the current total of TCH/H becomes zero, and it seems like TCH/H should not be considered. - To count the nr of currently free lchans, I need the currently possible total of lchans and the nr of occupied lchans. So return both a maximum total and a current total of lchans. In above example, the maximum total shows that there would be TCH/H possible. BTW, it would be nice to keep a chan_counts array on trx, bts and bsc level and update as channels are allocated and released, instead of counting them all over periodically. But it's less error prone this way. Related: SYS#4878 Change-Id: I2fb48c549186db812b1e9d6b735a92e80f27b8d3
Diffstat (limited to 'src/osmo-bsc/bts.c')
-rw-r--r--src/osmo-bsc/bts.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 83adcc469..570195778 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -719,19 +719,6 @@ void gsm_bts_all_ts_dispatch(struct gsm_bts *bts, uint32_t ts_ev, void *data)
gsm_trx_all_ts_dispatch(trx, ts_ev, data);
}
-
-/* Count number of free TS of given pchan type */
-int bts_count_free_ts(struct gsm_bts *bts, enum gsm_phys_chan_config pchan)
-{
- struct gsm_bts_trx *trx;
- int count = 0;
-
- llist_for_each_entry(trx, &bts->trx_list, list)
- count += trx_count_free_ts(trx, pchan);
-
- return count;
-}
-
/* set all system information types for a BTS */
int gsm_bts_set_system_infos(struct gsm_bts *bts)
{