osmo-bsc/src/osmo-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.c add stat items bsc.0.num_msc:connected, .num_msc:total 2021-08-30 18:21:50 +02:00
abis_bs11.c dissolve libbsc: move all to src/osmo-bsc, link .o files 2018-06-07 19:09:06 +02:00
abis_nm.c Rename osmo dyn ts enums to contain SDCCH8 2021-07-06 07:16:15 +00:00
abis_nm_ipaccess.c dissolve libbsc: move all to src/osmo-bsc, link .o files 2018-06-07 19:09:06 +02:00
abis_nm_vty.c Split bsc_vty.c creating bts_vty.c 2021-07-22 17:26:56 +00:00
abis_om2000.c Rename osmo dyn ts enums to contain SDCCH8 2021-07-06 07:16:15 +00:00
abis_om2000_vty.c Split bsc_vty.c creating bts_vty.c 2021-07-22 17:26:56 +00:00
abis_osmo.c Support Neighbor Address Resolution over PCUIF IPA multiplex 2021-09-13 16:04:05 +02:00
abis_rsl.c refactor lchan counting 2021-11-10 13:27:43 +00:00
acc.c RSL link: explicitly select rsl_link based on lchan 2021-05-28 17:22:59 +00:00
assignment_fsm.c for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
bsc_ctrl_commands.c bsc_ctrl_commands: fix uninitialized value (mode) 2021-11-04 09:51:26 +01:00
bsc_ctrl_lookup.c bts: Drop duplicated function to get trx by number 2020-07-18 21:45:32 +00:00
bsc_init.c Move global var bsc_gsmnet into libbsc [2/4] 2021-10-07 14:08:15 +02:00
bsc_rf_ctrl.c fixup comments for 'rf_states' CTRL command 2021-09-15 18:05:20 +00:00
bsc_rll.c dissolve libbsc: move all to src/osmo-bsc, link .o files 2018-06-07 19:09:06 +02:00
bsc_sccp.c LCS: implement the bulk of Location Services 2020-10-09 00:26:02 +02:00
bsc_stats.c tweak intra-bsc ho counter descriptions 2021-11-06 17:02:38 +01:00
bsc_subscr_conn_fsm.c bsc_subscr_conn_fsm: fix mgw-pool ref counting 2021-10-29 05:48:43 +00:00
bsc_subscriber.c bsc_subscr_name: print both IMSI and TMSI 2020-10-07 11:40:12 +00:00
bsc_vty.c Implement MS Uplink Power Control Loop 2021-10-05 04:32:33 +00:00
bssmap_reset.c vty: add "msc N bssmap reset" command 2021-08-30 16:18:12 +00:00
bts.c refactor lchan counting 2021-11-10 13:27:43 +00:00
bts_ericsson_rbs2000.c bts: Clear BTS_STAT_CHAN_*_{TOTAL,USED} on bts disconnect 2021-07-22 15:45:24 +00:00
bts_init.c Replace all references to 'sysmobts' with 'osmo-bts' 2021-04-12 18:54:40 +00:00
bts_ipaccess_nanobts.c MS Power Control Loop: Support set up of C/I parameters for osmo-bts 2021-09-06 12:07:20 +02:00
bts_ipaccess_nanobts_omlattr.c separate 'interference-meas level-bounds' cfg and used 2021-07-16 16:04:18 +00:00
bts_nokia_site.c bts: Clear BTS_STAT_CHAN_*_{TOTAL,USED} on bts disconnect 2021-07-22 15:45:24 +00:00
bts_osmobts.c MS Power Control Loop: Allow Turn off/on C/I independent from value setting 2021-09-29 15:39:17 +02:00
bts_siemens_bs11.c bts: Clear BTS_STAT_CHAN_*_{TOTAL,USED} on bts disconnect 2021-07-22 15:45:24 +00:00
bts_sm.c Introduce NM GPRS NSVC FSM 2020-12-04 14:44:40 +01:00
bts_trx.c refactor lchan counting 2021-11-10 13:27:43 +00:00
bts_trx_vty.c Split bts_vty.c creating bts_trx_vty.c 2021-07-23 13:35:04 +02:00
bts_unknown.c Move struct gsm_bts: gsm_data.* => bts.* 2020-07-18 21:45:32 +00:00
bts_vty.c [overpower] VTY: add more ACCH overpower related parameters 2021-10-24 13:55:51 +03:00
cbch_scheduler.c smscb: Avoid scheduler array overflow 2021-01-03 22:09:40 +00:00
cbsp_link.c CBSP VTY: re-add legacy cbc config for backwards compat 2020-09-03 15:04:29 +02:00
chan_alloc.c Rename osmo dyn ts enums to contain SDCCH8 2021-07-06 07:16:15 +00:00
chan_counts.c refactor lchan counting 2021-11-10 13:27:43 +00:00
codec_pref.c Rename osmo dyn ts enums to contain SDCCH8 2021-07-06 07:16:15 +00:00
e1_config.c RSL link: explicitly select rsl_link based on lchan 2021-05-28 17:22:59 +00:00
gsm_04_08_rr.c gsm_04_08_rr: silently ignore RR UTRAN Classmark Change 2021-08-29 17:50:05 +06:00
gsm_08_08.c drop unused gsm48_tx_mm_serv_ack() 2021-11-05 12:01:27 +01:00
gsm_data.c gsm_data: use ascending order for interference boundaries 2021-11-10 14:45:12 +03:00
handover_cfg.c dissolve libbsc: move all to src/osmo-bsc, link .o files 2018-06-07 19:09:06 +02:00
handover_ctrl.c handover_ctrl: add control interface for handover settings 2021-07-19 10:44:05 +02:00
handover_decision.c hodec1: use same automatic FULL/SUBSET choice as in hodec2 2021-07-09 11:51:40 +00:00
handover_decision_2.c refactor lchan counting 2021-11-10 13:27:43 +00:00
handover_fsm.c implement incoming_intra_bsc_ho:* rate counters 2021-11-06 17:02:38 +01:00
handover_logic.c replace ts_*_for_each_lchan() with ts_for_n_lchans() 2021-05-31 05:20:03 +00:00
handover_vty.c vty: add attributes to VTY commands indicating when they apply 2020-10-08 07:18:12 +00:00
lb.c Use new stat item/ctr getter APIs 2021-06-04 17:48:43 +02:00
lchan_fsm.c for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
lchan_rtp_fsm.c for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
lchan_select.c log: fix missing newline in lchan_select.c 2021-07-24 00:02:00 +02:00
lcs_loc_req.c for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
lcs_ta_req.c for linter: s/while(0)/while (0) 2021-11-06 17:01:58 +01:00
meas_feed.c Use osmo_fd_*_{disable,enable} 2020-11-11 20:15:22 +00:00
meas_rep.c hodec2: [2/2] implement automatic choice between FULL and SUBSET measurements 2021-07-09 11:51:40 +00:00
neighbor_ident.c neighbor_ident: add comment about Neighbor Address Resolution Service 2021-11-01 11:30:03 +01:00
neighbor_ident_ctrl.c heighbor_ident: add/del neighbor cells via ctrl interface 2021-11-03 17:25:28 +00:00
neighbor_ident_vty.c heighbor_ident: add/del neighbor cells via ctrl interface 2021-11-03 17:25:28 +00:00
net_init.c lchan_fsm: mode modify: fix missing timeouts and error transitions 2021-04-28 16:32:19 +02:00
nm_bb_transc_fsm.c RSL link: explicitly select rsl_link based on lchan 2021-05-28 17:22:59 +00:00
nm_bts_fsm.c separate 'interference-meas level-bounds' cfg and used 2021-07-16 16:04:18 +00:00
nm_bts_sm_fsm.c NM FSMs: fix DISABLED_NOTINSTALLED -> DISABLED_NOTINSTALLED 2020-12-13 12:08:45 +00:00
nm_channel_fsm.c nm_channel_fsm: drop ipa link if SetChannelAttr fails 2021-10-07 14:08:37 +02:00
nm_common_fsm.c oml: Delay configuring NSVC until BTS features are negotiated 2020-12-04 15:54:34 +01:00
nm_gprs_cell_fsm.c NM FSMs: fix DISABLED_NOTINSTALLED -> DISABLED_NOTINSTALLED 2020-12-13 12:08:45 +00:00
nm_gprs_nse_fsm.c NM FSMs: fix DISABLED_NOTINSTALLED -> DISABLED_NOTINSTALLED 2020-12-13 12:08:45 +00:00
nm_gprs_nsvc_fsm.c NM FSMs: fix DISABLED_NOTINSTALLED -> DISABLED_NOTINSTALLED 2020-12-13 12:08:45 +00:00
nm_rcarrier_fsm.c cosmetic: Fix typo in comment 2021-10-05 18:24:12 +02:00
osmo_bsc_bssap.c fix TSC / TSC Set used for Handover 2021-10-04 11:04:21 +00:00
osmo_bsc_ctrl.c handover_ctrl: add control interface for handover settings 2021-07-19 10:44:05 +02:00
osmo_bsc_filter.c Use new stat item/ctr getter APIs 2021-06-04 17:48:43 +02:00
osmo_bsc_grace.c dissolve bsc_grace_paging_request() 2020-09-16 21:54:52 +00:00
osmo_bsc_lcls.c RSL chan_nr: replace OSMO_ASSERT with error handling 2021-06-10 16:15:35 +02:00
osmo_bsc_main.c osmo_bsc_main: remove unused option -t --testmode 2021-10-28 12:10:38 +02:00
osmo_bsc_mgcp.c Use OSMO_FD_* instead of deprecated BSC_FD_* 2020-07-15 18:38:11 +02:00
osmo_bsc_msc.c osmo_bsc_msc: do not initalize MGCP proxy for AoIP MSCs 2021-09-04 19:41:17 +00:00
osmo_bsc_sigtran.c Get rid of lots of stubs [4/4] 2021-10-07 14:08:29 +02:00
paging.c move BSC level stats and rate counters to new bsc_stats.[hc] 2021-08-30 16:18:52 +00:00
pcu_sock.c Get rid of lots of stubs [4/4] 2021-10-07 14:08:29 +02:00
penalty_timers.c switch handover penalty timers to CLOCK_MONOTONIC 2021-07-15 09:28:18 +00:00
power_control.c Implement MS Uplink Power Control Loop 2021-10-05 04:32:33 +00:00
smscb.c smscb: Fix adding of SMSCB messages when no message with lower period exists 2021-01-04 21:48:03 +00:00
system_information.c introduce gsm48_lchan_and_pchan2chan_desc() 2021-08-16 00:12:12 +00:00
timeslot_fsm.c timeslot_fsm: Add assert to make sure we never go out of bounds in ts->lchan array 2021-10-25 19:17:40 +02:00