aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/bts_trx.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-31timeslot_fsm: Warn in case Ercisson RBS uses static PDCHPhilipp Maier1-0/+17
The Ericsson RBS is a BTS that natively works with dynamic timeslots. This colides with the current understanding of static PDCH channels because the BTSs we support so far get thier static PDCH information on startup and then handle everything related internally. The BSC does not actively manage the channel in those cases. In the case of Ericsson we have to activate the PDCH via RSL like any other channel and the timeslot FSM has to manage it. Lets not add work arouds for this, lets just print and error message and use the BTS in the dynamic scheme as intended by the manufacturer. Change-Id: Icc7c2956fc934691e3bfacb283d896a8767baf27 Related: OS#5198
2023-01-23SI: set type 10 length properlyMax1-0/+3
According to 3GPP TS 44.018 ยง9.1.50 SI10 is 168 bits long. Related: OS#5783 Change-Id: Ifd76ebb10029b95a80a85bea4d102d5e100c182c
2023-01-23SI: use defined constant instead of magic numberMax1-1/+1
Related: OS#5783 Change-Id: I2ecac86fb860241bccf56c03d0454f07552fdc9d
2022-08-09lchan: Move init logic to a specific functionPau Espin Pedrol1-8/+2
This way it is a lot easier to find out how and when is an lchan initialized, simply by looking at the lchan.h header, then seeing the init function and grepping for it. Change-Id: I043d1c2ee75d4d2a8b323b7960ee490e567f3865
2022-08-09split lchan specific defines and code to its own filePau Espin Pedrol1-0/+1
It is really difficult right now to find out where all the different stuff relative to operation and lifecycle of an lchan is. Let's move everything to its own file to have all the related defines and logic together. Change-Id: Idd855d126c43ac6576c5f3ba7e0b8014127a65e1
2022-05-02Check VTY config against features reported by BTSOliver Smith1-0/+14
* Don't copy features for osmo-bts and nanobts initially, wait until BTS reported its features * Checks for BTS features in VTY cmds: pass if features are not known (not yet reported by the BTS), fail if the feature is missing * Once BTS reports its features, check relevant VTY config parts again Related: SYS#5922, OS#5538 Change-Id: I7fca42a39a4bc98a6ea8b9cfab28c4bad3a6a0aa
2022-03-16gsm_bts_trx_set_system_infos(): cosmetic: improve readabilityVadim Yanitskiy1-18/+25
Change-Id: Ic63ee79c7509ec57ad72f85442b5756ae31c0a52 Related: SYS#5888
2021-11-10refactor lchan countingNeels Hofmeyr1-48/+0
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-10-08rsl_lchan_lookup(): fix handling of ABIS_RSL_CHAN_NR_CBITS_OSMO_PDCHVadim Yanitskiy1-2/+2
If an RF Resource Indication message includes interference band(s) for 'pure' PDCH (i.e. not dynamic) timeslot(s), osmo-bsc logs: DRSL DEBUG abis_rsl.c:1515 (bts=0,trx=0) Rx Resource Indication DRSL ERROR bts_trx.c:236 (bts=0,trx=0) chan_nr 0xc7 cbits 0x18: (bts=0,trx=0,ts=7,pchan=PDCH,state=UNUSED) is not GSM_PCHAN_OSMO_DYN DRSL ERROR abis_rsl.c:141 (bts=0,trx=0,ts=7,pchan=PDCH,state=UNUSED) Abis RSL Rx Resource Indication: mismatching chan_nr=0xc7 Let's better check if a timeslot is capable of GSM_PCHAN_PDCH, rather than checking if it's GSM_PCHAN_OSMO_DYN. Change-Id: I2cac4acd4c5145c5c525c9952fdc754477ce0942 Related: SYS#5313
2021-10-07bts_trx: Fix timeslot_fsm not properly freed during trx free() [1/4]Pau Espin Pedrol1-0/+1
osmo_fsm_inst_free() must be called explicitly, otherwise the instance is kept in the llist of instances and produces heap-use-after-free. Note: This fix is required by follow-up patches where some stubs are removed and hence some tests start using FSMs internally. Due to this bug, tests will crash due to reason explain in previous paragraph. This patch itself may introduced failures to build due to some new interdependencies being introduced in same follow-up patches mentioned above, which are in turn fixed by this present patch. So they are expected to be merged together. Change-Id: Ib0e5560efe518833f76f846d7269e82d85c186a1
2021-08-16error log: improve lchan lookup error msgNeels Hofmeyr1-0/+18
Looking for a bug, I spread this logging to understand what was happening. Might as well keep it. Related: SYS#5559 Change-Id: I46b660cd51a41e561712a0bd849ce0ee8d1a9588
2021-07-06Rename osmo dyn ts enums to contain SDCCH8Pau Espin Pedrol1-2/+2
They will gain support to be activated as SDCCH/8 soon too. Related: OS#5309 Depends: libosmocore.git I56dcfe4d17899630b17f80145c3ced72f1e91e68 Change-Id: Id5b89fe589a52ff88486435ac43809edb4b80f98
2021-06-18rsl_lchan_lookup: drop redundant conditionNeels Hofmeyr1-1/+1
'vamos' is only set to true for osmobts types, hence no need to check that condition again. fixup for commit d37dcb9f6854a4d15dd2ba098fcbaa212251684f 'RSL: rx and tx VAMOS Channel Number cbits for VAMOS lchans' I957eff0d2c33ec795eda75a4bff21965b0179f73 Related: CID#236318 Related: SYS#5315 OS#4940 Change-Id: I4d9afc2996d95fdc15ee1a04e31d781b595023e3
2021-06-15fixup for vamos: fix wrong cbits in rsl_lchan_lookup()Neels Hofmeyr1-1/+1
The RSL_CHAN_OSMO_VAMOS_MASK mask applies to the chan_nr, but the cbits variable in rsl_lchan_lookup() is chan_nr >> 3. So the mask didn't do its job. Now it does. A bit embarrassing how i took the suggestion to use this mask and put it into code without testing it. It looked good enough... Change-Id: I005c5f319bb6f14651aeb613cdff52e79f761913
2021-06-10RSL: set default TEI according to TRX numberNeels Hofmeyr1-0/+2
Change-Id: I3c500f7a5afc9143d4ea7102ab96e52aeb67b4b6
2021-06-10RSL: rx and tx VAMOS Channel Number cbits for VAMOS lchansNeels Hofmeyr1-0/+18
Add the Osmocom-specific extension to indicate VAMOS shadow lchans in RSL, in lchan lookup and RSL message transmission. Note that RR messages containing cbits (Assignment Command, Handover Command, ...) must *not* send Osmocom specific cbits to the MS. Only the RSL messages directed to the BTS send Osmocom specific bits. Related: SYS#5315 OS#4940 Depends: If33c1695922d110c0d2c60d5c0136caf2587194e (libosmocore) Change-Id: I957eff0d2c33ec795eda75a4bff21965b0179f73
2021-06-10rsl_lchan_lookup(): add comment explaining ts_is_capable_of_pchan()Neels Hofmeyr1-0/+4
Change-Id: Ie3699db496cfb690ac9302ccd177cdd77dc57ebb
2021-06-10rsl_lchan_lookup(): turn cbits if-cascade into a switch()Neels Hofmeyr1-7/+28
There is some odd repetition of macros with all possible subslot indexes, but now we are using the defined macros instead of magic numbers, making it easier to see that it is correct. Also this allows trivially adding VAMOS cbits cases to the existing switch() in a subsequent patch. Change-Id: I4c6ce2f4ca999c19a58909b9adb849a3b8b6ffc8
2021-06-10update the lchan name to always reflect VAMOS shadownessNeels Hofmeyr1-1/+1
Change gsm_lchan_name_compute() to a function that in-place updates the lchan->name. That allows calling it numerous times with the talloc handled internally. Rename it to lchan_update_name(). Add 'shadow' to lchan_update_name() and lchan_fsm_update_id() for VAMOS shadow lchans, and also print the lchan index that it is a shadow for, instead of the index in the lchan array. When set_pchan_is() updates the VAMOSness of the lchans, call lchan_fsm_update_id(). From lchan_fsm_update_id() also call lchan_update_name(). This is a bit convoluted for legacy reasons. There are utility programs and C tests using bts_trx.c but not lchan_fsm.c. lchan_update_name() lives in gsm_data.c for that reason. This patch calls lchan_update_name() from lchan_fsm_update_id() and not vice versa to avoid having to add stubbed lchan_fsm_update_id() functions to all utility programs and C tests. We can't easily unify the lchan->name and lchan->fi->id without lots of refactoring rippling through all those little utility programs and C tests. Change-Id: I7c2bae3b895a91f1b99b4147ecc0e3009cb7439a
2021-05-31replace ts_*_for_each_lchan() with ts_for_n_lchans()Neels Hofmeyr1-1/+1
So far we have a couple of macros iterating a specific number of lchans, depending on dynamic timeslot state etc. With addition of VAMOS lchans, this would become more complex and bloated. Instead of separate iteration macros for each situation, only have one that takes a number of lchans as argument. That allows to more clearly pick the number of lchans, especially for non-trivial VAMOS scenarios. Related: SYS#5315 OS#4940 Change-Id: Ib2c6baf73a81ba371143ba5adc912aef6f79238d
2021-04-28gsm_lchan_name_compute with ctxNeels Hofmeyr1-3/+1
Use a talloc ctx directly without an intermediate static buffer. A subsequent patch will add a name tweak for VAMOS secondary lchans, so it felt appropriate to first clean this. Change-Id: Idb922605c15242a2cdc7c34668c845a179a15660
2021-04-23Revert "update neighbor ARFCNs on startup and config changes"Pau Espin Pedrol1-4/+0
This patch caused major breakage in my setup, with BSC printing at startup: "(bts=0,trx=0) Failed to generate System Information". And bts-trx printing all the time: "sysinfo.c:162 PH-RTS-IND: Unable to determine actual BS_AG_BLKS_RES value as SI3 is not available yet, fallback to 1" This reverts commit c1a5310a3ed75ff24dc2d6a48c09d8dfc89d944c. Change-Id: I5da365c93aedc6668a77b82ee9b68cbec64967e3
2021-04-22update neighbor ARFCNs on startup and config changesNeels Hofmeyr1-0/+4
The effects of the neighbor configuration depend on the LAC, Cell Identity, ARFCN, BSIC configuration of neighbor cells. Make sure that the neighbor ARFCN list in the System Information is updated. This may seem rather aggressive: updating the SI of all BTS if only one config item changed. But indeed even modifying one config item of one BTS may cause a change in the neighbor relations that many other BTS may have to the changed BTS. For example, if many BTS configure a 'neighbor lac-ci 42 23', and this cell's config changes to LAC 43, all of those other BTS need to update their neighbor ARFCNs. Also update the system information even before the BTS are connected and started up. The main benefit here is that the VTY 'show bts N' command then already lists the correct neighbor ARFCNs. In gsm_bts_trx_set_system_infos(), make sure that the updated SI is only sent to TRXes that are actually usable, otherwise abis_rsl_sendmsg() spams the log with complaints that a message's dst == NULL. Still return an error rc in case a TRX is not connected, so that the CTRL command bts.N.send-new-system-informations accurately returns whether SI were actually sent to all TRXes. The desire to have the ARFCNs listed in the VTY before starting up BTSes came during analysis for Ifb54d9a91e9bca032c721f12c873c6216733e7b1, which fixes a bug that is now much easier to verify being fixed. Change-Id: I2222e029fc225152e124ed1e8887f1ffd4a107ef
2020-12-29Add a bts_model->bts_init() and trx_init() call-back functionHarald Welte1-0/+7
This allows a given BTS model driver to initialize data structures specific cor this BTS instance (or a TRX for this BTS instance). Change-Id: Icbad9cdc12221c9ad997267d77e5414edcbac538
2020-10-15Introduce Radio Channel FSMPau Espin Pedrol1-0/+13
Change-Id: Iddc008c5737afb2fddd32c628bc5278056a64d89
2020-10-15Introduce NM RadioCarrier FSMPau Espin Pedrol1-6/+10
Change-Id: Ieed61d1fb1e896db42545c2c3421b20cb41ad549
2020-10-15Introduce NM BaseBand Transceiver FSMPau Espin Pedrol1-0/+16
Change-Id: Ib4d35316c52eb4c71ea0d352a1e06fd5e600fe08
2020-10-15Set all NM OML objects to Locked by defaultPau Espin Pedrol1-1/+0
Before they were set with a value of 0, which had no related enum field, but since in general all comparsions are done against NM_STATE_UNLOCKED they also hold valid. The major change in behavior with this patch is upon OML link down, where gsm_bts_mo_reset() is called on all objects. This way, upon OML re-establishment we have again all objects as Locked again, which is the expected default value as per TS 12.21. Change-Id: I68ae0bc51a565f903b47cf72f3e3dd6f1a2d2651
2020-07-18Move gsm_bts_{trx_}set_system_infos APIs to bts{_trx}.*Pau Espin Pedrol1-0/+132
Change-Id: I2aa83b499d6e5d06a0fa1001fee3111f7e639c94
2020-07-18Move struct gsm_bts_trx: gsm-data.* => bts_trx.*Pau Espin Pedrol1-0/+288
See rant fro similar recent commit moving stuff to bts.*. Change-Id: I11758ca3d255d849d77bd068f24bb68bde1f89a5