osmo-bsc/include/osmocom/bsc
Neels Hofmeyr e455f0ab02 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
2021-11-10 13:27:43 +00:00
..
Makefile.am refactor lchan counting 2021-11-10 13:27:43 +00:00
a_reset.h BSSMAP RESET: generalize a_reset FSM 2020-10-15 05:28:24 +02:00
abis_nm.h ipa: Fix use of null pointer in log macro 2020-10-17 13:56:16 +00:00
abis_om2000.h Add command to enable RX diversity to RBS2000 2021-03-15 18:50:32 +00:00
abis_osmo.h Support proto IPAC_PROTO_EXT_PCU BSC<->PCU 2021-06-30 08:13:37 +00:00
abis_rsl.h RSL link: explicitly select rsl_link based on lchan 2021-05-28 17:22:59 +00:00
acc.h Introduce support for ACC ramping during whole BTS life cycle 2020-07-31 09:56:46 +00:00
assignment_fsm.h for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
bsc_msc_data.h drop features 'core-location-area-code' and 'core-cell-identity' 2020-10-16 13:51:48 +00:00
bsc_rll.h move include/openbsc to include/osmocom/bsc 2017-09-06 16:26:13 +02:00
bsc_stats.h add stat_items for BTS and TRX connection stati 2021-09-05 16:24:18 +02:00
bsc_subscr_conn_fsm.h Introduce VTY command to disable srvcc fast-return on target BTS 2021-06-17 14:05:40 +00:00
bsc_subscriber.h introduce osmo_use_count for bsc_subscr 2020-10-07 11:40:12 +00:00
bss.h Replace all references to 'sysmobts' with 'osmo-bts' 2021-04-12 18:54:40 +00:00
bssmap_reset.h vty: add "msc N bssmap reset" command 2021-08-30 16:18:12 +00:00
bts.h refactor lchan counting 2021-11-10 13:27:43 +00:00
bts_ipaccess_nanobts_omlattr.h Fix typo in function nanobts_attr_nsvc_get 2020-12-04 14:44:43 +01:00
bts_sm.h Introduce NM GPRS NSVC FSM 2020-12-04 14:44:40 +01:00
bts_trx.h refactor lchan counting 2021-11-10 13:27:43 +00:00
chan_alloc.h chan_alloc: remove references to lchan_alloc() 2019-01-17 15:52:25 +01:00
chan_counts.h refactor lchan counting 2021-11-10 13:27:43 +00:00
codec_pref.h assignment_fsm: fix channel allocator preferences 2019-02-21 10:17:37 +01:00
ctrl.h Support control connection status query for a particular MSC. 2018-01-09 11:18:10 +00:00
debug.h Implement MS Uplink Power Control Loop 2021-10-05 04:32:33 +00:00
e1_config.h libcommon: join gsm_data_shared.* into gsm_data.* 2018-02-14 12:15:40 +01:00
gsm_04_08_rr.h drop unused gsm48_tx_mm_serv_ack() 2021-11-05 12:01:27 +01:00
gsm_08_08.h compl l3: allocate conn in gsm_08_08.c, not gsm_04_08_rr.c 2020-10-07 10:19:58 +00:00
gsm_data.h add chreq:successful_<reason> rate counters 2021-11-05 12:01:27 +01:00
handover.h for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
handover_cfg.h hodec2: add low-rxqual-assignment penalty timer (2/2) 2021-07-15 09:28:18 +00:00
handover_ctrl.h handover_ctrl: add control interface for handover settings 2021-07-19 10:44:05 +02:00
handover_decision.h HO: make bts_by_arfcn_bsic() public 2018-01-19 22:09:19 +00:00
handover_decision_2.h HO: Implement load based handover, as handover_decision_2.c 2018-02-19 17:11:47 +01:00
handover_fsm.h ensure trigger_ho() returns zero only when HO or AS was indeed triggered 2021-07-15 09:28:18 +00:00
handover_vty.h HO: cfg: tweak vty write 2018-02-16 16:11:16 +01:00
ipaccess.h IPA: log OML/RSL link drop reason 2019-01-03 19:10:58 +00:00
lb.h LCS: add proper BSSMAP-LE RESET re-using new generalized reset FSM 2020-10-15 05:39:09 +02:00
lchan_fsm.h for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
lchan_rtp_fsm.h for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
lchan_select.h Add new lchan_select_set_type() API helper 2021-07-20 10:07:03 +00:00
lcs_loc_req.h for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
lcs_ta_req.h for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
meas_feed.h Fix some typos 2019-11-13 22:10:41 +01:00
meas_rep.h hodec2: [2/2] implement automatic choice between FULL and SUBSET measurements 2021-07-09 11:51:40 +00:00
misdn.h move include/openbsc to include/osmocom/bsc 2017-09-06 16:26:13 +02:00
neighbor_ident.h heighbor_ident: add/del neighbor cells via ctrl interface 2021-11-03 17:25:28 +00:00
network_listen.h move include/openbsc to include/osmocom/bsc 2017-09-06 16:26:13 +02:00
nm_common_fsm.h oml: Delay configuring NSVC until BTS features are negotiated 2020-12-04 15:54:34 +01:00
openbscdefines.h move include/openbsc to include/osmocom/bsc 2017-09-06 16:26:13 +02:00
osmo_bsc.h drop some unused members and function decls 2020-09-03 01:07:15 +02:00
osmo_bsc_grace.h dissolve bsc_grace_paging_request() 2020-09-16 21:54:52 +00:00
osmo_bsc_lcls.h Move LCLS references from gsm_data to osmo_bsc_lcls 2019-03-14 13:21:19 +00:00
osmo_bsc_rf.h add CTRL 'rf_states' and 'bts.N.rf_states' 2021-09-14 08:44:45 +00:00
osmo_bsc_sigtran.h BSSMAP RESET: move cancel-paging call to osmo_bsc_sigtran_reset() 2020-10-15 05:28:44 +02:00
osmux.h vty: Add option to enable osmux towards MSC 2019-05-19 07:26:28 +00:00
paging.h LCS: implement the bulk of Location Services 2020-10-09 00:26:02 +02:00
pcu_if.h move include/openbsc to include/osmocom/bsc 2017-09-06 16:26:13 +02:00
pcuif_proto.h Support Neighbor Address Resolution over PCUIF IPA multiplex 2021-09-13 16:04:05 +02:00
penalty_timers.h refactor handover penalty timers 2021-03-24 10:02:29 +01:00
power_control.h Implement MS Uplink Power Control Loop 2021-10-05 04:32:33 +00:00
rs232.h move include/openbsc to include/osmocom/bsc 2017-09-06 16:26:13 +02:00
signal.h cosmetic: fix comment typos in signal.h 2021-09-29 19:02:12 +02:00
smscb.h CBSP: add local bind to client mode 2020-08-29 07:57:59 +00:00
system_information.h Drop duplicated arfcn_range_encode.c available in libosmocore 2021-06-01 20:00:51 +02:00
timeslot_fsm.h for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
vty.h osmo_bsc_main: integrate MGW pooling into osmo-bsc 2021-09-03 15:03:38 +00:00