aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
AgeCommit message (Collapse)AuthorFilesLines
2021-10-14Move lchan_deactivate() to lchan.cPau Espin Pedrol2-8/+9
Change-Id: If75ed432fa9dcb10159a0dac9b8ba7efe6958b35
2021-10-14lchan: Avoid applying transition changes if state new==oldPau Espin Pedrol1-0/+2
Let's avoid running over state change conditions or even printing log lines if there's no state change. Change-Id: I1ca86aa846084f53751076643665cb6dabc26a06
2021-10-14lchan: Update log line level to use macro and level INFOPau Espin Pedrol1-4/+2
Change-Id: Idd48fd8fbb13b715096a4765dcb08a18d85098a7
2021-10-14Move lchan related code to lchan.{c,h}Pau Espin Pedrol3-76/+76
Change-Id: I17ebe6af69e31d1b4dbad7656bbf043f4c9243c1
2021-10-14lchan: Setup early_rr_ia timer only once during initPau Espin Pedrol1-28/+29
There's no need to re-setup it every time. Mark the cb as static since its private to the module, and move it above its use point so it can be referenced. Change-Id: I90324f26d8ca09d425c7523a25b3e6c951fa49d6
2021-10-11rsl: Fix all shadow TS being Chan Act NACKedPau Espin Pedrol1-2/+5
The OML NM Channel FSM state only apply to primary timeslots, hence we need to make sure we pick the primary TS (the non-shadow one). Due to this bug, all channels on shadow TS where NACKed because the related state was never "Enabled Ok". Fixes: c97a7f51e1b15d40e39df4b7d07b3c6534540186 Related: OS#5249 Related: OS#5251 Change-Id: If47e4bdd45a05ed1b5709b6e3d541f2830723e37
2021-10-11Make sure lchan allocated memory from shadow_ts is properly freedPau Espin Pedrol1-0/+7
Since non-shadow TS are currently not allocated as talloc contexts, lchan objects tend to allocate their own memory on trx talloc ctx instead. That's fine for non-shadow TS, since the TS follow trx lifecycle since they are part of the same talloc context. However, shadow TS are recreated (re-allocated) each time the BTS reconnects, hence when htey are freed we need to free substructs (lchan) memory in order to avoid it being kept in trx talloc ctx. Related: OS#5248 Change-Id: I73742535eb3c40a6866731acbff782940dab06c3
2021-10-11Add new gsm_bts_trx_free_shadow_ts() functionPau Espin Pedrol2-3/+17
Use it as a counterpart of gsm_bts_trx_init_shadow_ts() Change-Id: I38baa2b2cfcf6221325d45860b3c7dd53235b8ff
2021-10-11trx_sched_clean(): also free() the shadow timeslotVadim Yanitskiy1-0/+3
Change-Id: Ic14e9de7487ba8152ffb1aa1bab508a2b9a11ea0 Related: OS#5248
2021-10-11trx_sched_clean_ts(): also free() the associated 'struct l1sched_ts'Vadim Yanitskiy1-0/+3
Change-Id: I44a8f18c81dd8bc76ca07dfaae7bcdb2fedc9261 Related: OS#5248
2021-10-08nm_*_fsm: reset mo.nm_attr from previous runs when entering state NOT_INSTALLEDPau Espin Pedrol4-0/+8
Code in oml.c, upon receiving net attributes, merges the new attributes with old ones (for some reason I don't really know). Hence, if we disconnect from a BSC and go to NOT_INSTALLED state, we must free previous nm_attr in order to avoid mixing them once we connect to a new (potentially different) BSC upon reconnect. Related: OS#5248 Change-Id: I45cc22dd68121a7930301581bfd0a8db37879c77
2021-10-08nm_*_fsm: Move reset state code to st_op_disabled_notinstalled_on_enterPau Espin Pedrol2-5/+8
Let's rather put it there instead of the shutdown code path, since we'll be adding more and more reset coe there. Change-Id: I43a136ade731a2c58c0a29d97875088e9b6d4414
2021-10-08vty: show interference level / band in 'show lchan'Vadim Yanitskiy1-0/+8
Change-Id: Ide45a0f7836bf35ffbe88070fa8367022311ca44 Related: SYS#5313
2021-10-08l1sap: check if BTS model supports interference reportingVadim Yanitskiy1-1/+2
Currently, only osmo-bts-trx is capable of reporting the interference levels to L1SAP. Thus it does not make sense to trigger the averaging logic and send empty reports over the A-bis/RSL and the PCUIF. Change-Id: Ic17eb46bdca3c33ac4d6e560a093b635b75424a5 Related: SYS#5313
2021-10-08osmo-bts-trx: report PDCH interference levels to L1SAPVadim Yanitskiy2-6/+16
Starting from [1], interference levels on PDCH timeslots are also reported over the A-bis/RSL. They may be useful for the BSC to determine whether dynamic PDCH timeslots might be better used for new circuit switched connections, or whether alternative PDCH slots should be allocated for interference reasons. * Handle GSM_LCHAN_PDTCH in lchan_report_interf_meas(). * Rework pcu_tx_interf_ind() to accept 'struct gsm_bts_trx'. * Call pcu_tx_interf_ind() from l1sap_interf_meas_report(). Regarding pcu_tx_interf_ind(), it's better to call this function from the upper layers once, rather than calling it from various places in the model specific code. [1] I5b4d1da0920e788ac8063cc765fe5b0223c76758 Change-Id: I3fbaad5dbc3bbd305b3ad4cb4bfb431a42cfbffc Related: SYS#5313
2021-10-08rsl_tx_rf_res(): also report noise levels for PDTCHVadim Yanitskiy1-6/+13
This information may be useful for the BSC to determine whether dynamic PDCH timeslots might be better used for new circuit switched connections, or whether alternative PDCH slots should be allocated for interference reasons. Change-Id: I5b4d1da0920e788ac8063cc765fe5b0223c76758 Related: SYS#5313
2021-10-08rsl_tx_rf_res(): separate interference AVG / band calculationVadim Yanitskiy3-17/+40
It's cleaner from the architectural point of view to have the interference measurements processed in a separate function. Change-Id: I3981608e01a50585359cad673c38c8a305027d30 Related: SYS#5313
2021-10-08rsl: prevent race condition during timeslot re-configurationVadim Yanitskiy1-18/+20
It may happen that the BSC requests logical channel activation on a dynamic timeslot, which is in a process of switching from one pchan type to another due to a preceding channel activation request. In this case 'struct gsm_bts_trx_ts' already holds an msgb with the preceding RSL CHANnel ACTIVation message, that is normally handled once the PHY completes the process of timeslot re-configuration. On receipt of subsequent RSL CHANnel ACTIVation messages, in function dyn_ts_l1_reconnect() we overwrite the preceeding msgb (memleak), by the most recent one. And once the timeslot re-configuration is done, only the most recent CHANnel ACTIVation message gets ACKed. In order to avoid this, let's move the msgb ownership to 'struct gsm_lchan', so it cannot be overwritten by the CHANnel ACTIVation message that is related to a different lchan on the same timeslot. Change-Id: Ia625c2827fca883ea712076706d5ef21ed793ba6 Related: I3b602ac9dbe0ab3e80eb30de573c9b48a79872d8 Fixes: OS#5245
2021-10-07nm_bts_fsm: Reset si_valid bitmask when BTS is shut downPau Espin Pedrol1-0/+2
Otherwise after reconnecting some SI are still marked as valid despite the new BSC conn didn't set them. Change-Id: I71e2a5cdf4e2e287db7b05df1a165a1e32c958ca
2021-10-07nm_channel_fsm: Release lchans after BTS shutdownPau Espin Pedrol2-0/+13
This fixes some TTCN3 tests where some lchan resources were kept from previous tests. Change-Id: I78dca32cd061fba86cc88c4c4f323b33d51c58d0
2021-10-07Introduce gsm_lchan_release function helperPau Espin Pedrol2-60/+76
Change-Id: I0525beaba3c833f8d7adf9701fe373761a7720d3
2021-10-07Move lchan,power_control related code from gsm_data.c to their own filesPau Espin Pedrol3-403/+404
We already have similar classification in osmo-bsc. Change-Id: I1493f40d99f88a565f15d3e0943a512fb9b8719a
2021-10-07Move lchan,power_ctrl specific code from gsm_data.h to their own filesPau Espin Pedrol1-1/+1
Let's split all lchan and power_control specific stuff into their own headers, it helps finding out data and operations available related to them. We already have similar classification in osmo-bsc. Change-Id: I6424dcbd2e329fc1a516f8886359554ed7e9487e
2021-10-07load_indication.c: Avoid sending if CCCH is still not operationalPau Espin Pedrol1-0/+5
It makes no sense to transmit load information if the channel is still not operational. This solves errors messages seen in osmo-bsc. Related: OS#4872 Change-Id: I7ddda9776158eed0694df9e458f3f91df90bf674
2021-10-07MS Power Control Loop: Use P_CON_INTERVAL=2 by defaultPau Espin Pedrol3-4/+14
Have a more stable loop with less temporary oscillations at the expense of increased reaction time. 4 SACCH blocks (P_CON_INTERVAL=2) is the minimum interval to get stable measurements for the last requested MS Power level. With P_CON_INTERVAL=1, are also made during a period with stable power being use to transmit, but the MS Power level used (and announced in MR) is not the last one requested by the BTS, but the one requested in the previous loop iteration. This can make the MS and BTS bounce 2 values forth and back, and create some temporary oscillation. See osmo-bsc User manual section "Power Control" for more information. Related: SYS#5371 Change-Id: I91c505447f68714239a4f033d4f06e91893df201
2021-10-07Introduce gsm_lchan_init() function helperPau Espin Pedrol2-8/+12
Let's move lchan specific struct stuff into lchan.c Change-Id: I9cb96707c63b8b7d76591d25fe906f02e34bb76b
2021-10-07rsl: NACK Chan Activation for lchans on disabled TSPau Espin Pedrol1-0/+7
A broken BSC could send a Chan Activation on a TS which has not yet been enabled (or even configured). This is the case with our TTCN3 tests, where OML side is currently handled in parallel by an osmo-bsc while TTCN3 takes care of the RSL side. This can actually be seen as a malfunctioning BSC, but it was spotted that given this sequence of events osmo-bts can crash (see ticket below). Hence, let's NACK any attempt from a BSC to activate an lchan on a disabled TS. Related: OS#5249 Change-Id: I9c3b68487c12efc412a057728a561e061560c544
2021-10-04rsl: remove redundant logging in rsl_rx_chan_activ()Vadim Yanitskiy1-3/+0
The first check in this function ensures that the state is NONE. Therefore it does not make sense to print it below.. Change-Id: I62ea4117dd5e1eebb8774809134e5cb73774945c
2021-10-04abis: fix memory leak in abis_oml_sendmsg()Vadim Yanitskiy1-0/+1
Change-Id: Ifc46b94b4540705f7d9b4678a7398158f3aaf7c5 Fixes: Iecd3c7cb96f5fff3b4c7e04c74e031df0f7a6987
2021-09-30fix handle_ms_meas_report(): properly count measurement reportsVadim Yanitskiy1-1/+2
Each RSL MEASurement RESult message contains a Measurement Number IE, which is basically a monolithically increasing number. We shall not increase this counter if for whatever reason the report has not been sent to the BSC. Change-Id: I441adb4b202e94ddee8c0b6777849e36ea644b1d Fixes: Id67259ec9ac4c2c33bd0eef3f64450affbe3fb9f Fixes: OS#5243
2021-09-30Delay abis reconnect while bts is shutting downPau Espin Pedrol2-1/+14
Avoid re-connecting to a new BSC while BTS is in shutting down. All the FSMs are complex enough to even try to re-start when stopping has not yet finished... Change-Id: I1727828a16f4ec8043b00cc6b2e02a4c35f71377
2021-09-30bts-trx: Delay power ramp up until RCARRIER is ENABLEDPau Espin Pedrol1-1/+5
Prior to this patch, the power ramping started when the PHY is available, but that doesn't necessarily mean the RCARRIER is enabled. Due to this, it was spotted a situation where BTS bootstrap failed after PHY turning up, when RSL connection establishment failed. Hence bts_shutdown_fsm triggered a shutdown while an active power ramping up was ongoing... Change-Id: I17208b74ea2649b1bbb717aee0aa355e42b7e860
2021-09-30abis: Fix line leaked & recreated upon every reconnectPau Espin Pedrol1-12/+5
Previous code creating a new line was really a workaround to have it working while previous lines were being stacked internally inside libosmo-abis. Let's handle reference counts for the line properly and keep using the same line always (since it can be further configured by libosmo-abis' VTY). Recent patches to libosmo-abis fixed a bug where e1inp_line_update() would only work the first time it was called on a e1np_line, and follow up calls would be no-ops. This fix allows re-configuring and hence reusing the same line to reconnect to BSC. Depends: libosmo-abis Change-Id: Iff8092f88726cf238dac2abb99e135ac5864272d Change-Id: Id7fd3ef81bbc517821def31f1a60f905a0e2fb52
2021-09-30scheduler: fix comments explaining the interleaving of TCH/HVadim Yanitskiy1-4/+5
Change-Id: I2820e42ae10f05ba1ca956b948ea0d77e6abeb3d
2021-09-29rsl: parse temporary overpower value RSL CHAN ACT / MODIFYPhilipp Maier1-0/+26
The temporary overpower value that is to be used with FACCH and SACCH is transferred using a proprietary RSL IE (RSL_IE_OSMO_TOP_ACCH_CAP). The parsed value is then stored in lchan->bs_acch_overpower_db so that it can be used. Change-Id: I426c2510865c4a986c68f2027cc676aaac0d8a4c Related: SYS#5319
2021-09-28scheduler: Fix lqual_cb not populated for TCH.indPau Espin Pedrol1-1/+2
Change-Id: I79c83b974149b1e94155bc61172b57de8003891e
2021-09-28Move TA & Power Loops further up the stack, take DTXu flag into accountPau Espin Pedrol2-34/+50
Only once we receive the Measurement Result on L3 from MS we are able to find out whether DTXu was used, and hence whether SUB or FULL measurement set should be used. Let's move all control loops there to have them in one place together, and have it at a similar level where it would lay if it was to be implemented in the BSC. Related: SYS#4917 Change-Id: Ic152473577ff7c33d30b3f4ee7e321fcb523f723
2021-09-28Decouple handling of Measurement Report from lapdmPau Espin Pedrol3-27/+41
This is a preparation commit in order to move power loops up in the stack in order to have DTXu information available, in order to decide whether SUB or FULL ul measurements should be used in the MS Power Control Loop. Function rsl_tx_meas_res() is stripped from code changing state, and it simply encodes content and transmits the message. Change-Id: Id67259ec9ac4c2c33bd0eef3f64450affbe3fb9f
2021-09-27osmo-bts-trx: implement Temporary Overpower for SACCH/FACCHVadim Yanitskiy1-1/+21
GSM/EDGE Evolution and Performance, Section 12.3 suggests Temporary Overpower as another solution to improve SACCH/FACCH performance in case of bad C/I. The idea here is that you increment the DL transmit power by 2..4dB only for FACCH/SACCH bursts, while keeping all voice bursts at the lower (normal) level as determined by BS power control. SACCH blocks can be recognized by the channel type, since they're always transmitted in specific frames of a multiframe. FACCH blocks, however, are not predictable and can substitute voice blocks at (almost) any time. Thus we need to mark FACCH bursts as such in the logical channel handlers (using TRX_BR_F_FACCH). Change-Id: Ie8a626fefccf1eb07271058e5126ec106cb1abcf Related: SYS#5319
2021-09-27osmo-bts-trx: remove an 'else' branch in _sched_dl_burst()Vadim Yanitskiy1-2/+0
When I introduced this branch in change [1], I was under assumption that PDCHs never have an associated 'struct gsm_lchan'. This is incorrect: the association actually happens during PDCH activation, i.e. when osmo-pcu establishes connection over the PCUIF. Enforcing attenuation of 0 dB for other channel types makes no sense. [1] I3dcee6e910ccc61c5c63c728db9ea04327e2fc98 Change-Id: I77a839725f22be1be4a025f579c4c9ccdfb53460
2021-09-26trx_sched_set_lchan(): use LOGL_INFO for logging messagesVadim Yanitskiy1-1/+1
There is no need to log channel activation / deactivation messages as LOGL_NOTICE - this is a normal event requiring no attention. Change-Id: I7765fecb7f7ec67c8f96e91c378626e21e48c71d
2021-09-26gsm_lchan2chan_nr(): separate RSL specific variant of this APIVadim Yanitskiy2-21/+36
The ip.access style dynamic timeslots are a bit special in a way that on the A-bis/RSL we always use the Channel Number value of TCH/F, even in PDCH mode. This is why gsm_lchan2chan_nr() would always return values corresponding to TCH/F for TCH/F_PDCH. This behavior is only acceptable in the context of RSL messages, while other parts of the code base may not work properly due to this trick. A good example is the scheduler in osmo-bts-trx, where we have to patch Channel Number value to make channel activation work. DPCU INFO pcu_sock.c:853 Activate request received: TRX=0 TS=5 DL1C INFO l1sap.c:2043 (bts=0,trx=0,ts=5,ss=0) Activating channel TCH/F on TS5 DL1C NOTICE scheduler.c:1097 (bts=0,trx=0,ts=5,ss=0) Activating PDTCH DL1C NOTICE scheduler.c:1097 (bts=0,trx=0,ts=5,ss=0) Activating PTCCH In the code branch responsible for channel deactivation, we somehow forgot to add the same workaround, so deactivation does not work: DL1C INFO l1sap.c:2076 (bts=0,trx=0,ts=5,ss=0) Deactivating channel TCH/F on TS5 DTRX INFO trx_if.c:255 phy0.0: Enqueuing TRX control command 'CMD NOHANDOVER 5 0' DRSL NOTICE rsl.c:1286 (bts=0,trx=0,ts=5,ss=0) (bts=0,trx=0,ts=5,ss=0) not sending REL ACK Because of that, TCH/F_PDCH timeslots actually remain active after deactivation, so the scheduler keeps producing L1SAP DATA.ind. DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE DL1P ERROR l1sap.c:732 1583426/1194/00/29/14 No lchan for DATA MEAS IND (chan_nr=PDCH on TS5) DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE DL1P ERROR l1sap.c:732 1583430/1194/04/33/18 No lchan for DATA MEAS IND (chan_nr=PDCH on TS5) DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message DL1P NOTICE l1sap.c:126 (bts=0,trx=0,ts=5,ss=0) assuming active lchan, but state is NONE DPCU NOTICE pcu_sock.c:973 PCU socket not connected, dropping message Instead of patching Channel Number in various places, let's rather make the RSL specific behavior configurable by having two variants of gsm_lchan2chan_nr(). Change-Id: I01680140c7201bf5284b278bceaea8ae01c122b2 Fixes: OS#5238
2021-09-26l1sap: unify channel (de)activation/modification messagesVadim Yanitskiy1-7/+9
LOGPLCHAN() prepends the contextual information for us, there is no need to print trx->nr again. Take a chance to apply some additional cosmetic changes, like fixing capital letter. Change-Id: Ia199d584c937eef4118c99af4523fd91b2e46107
2021-09-23osmo-bts-omldummy: Fix crash accessing null phyPau Espin Pedrol1-0/+2
osmo-bts-omldummy is known to be specially in the sense that it has no phy. This should ideally be changed to have some dummy object, but so far that's how it is. A recent commit checking the phy's forgot about the fact that BTS model has no phy. Let's fix it. Fixes: 4ddc37ce7140e5ce6ca6cce5aeeefedc0d395d22 Change-Id: Iba7873530aac74b3bf799819890641196dacf170
2021-09-23Revert "abis: Fix line leaked & recreated upon every reconnect"Pau Espin Pedrol1-11/+11
This reverts commit bc6d35f52d4d3abd650afb05475ad5a818737fe2. Change-Id: I15063f0156ed8910795cd5ffe045e2d0cbca6276
2021-09-23abis: Fix line leaked & recreated upon every reconnectPau Espin Pedrol1-11/+11
Previous code creating a new line was really a workaroudn to have it working while previous lines were being stacked internally inside libosmo-abis. Let's handle reference counts for the line properly and erase + re-create it every time. Recent patches to libosmo-abis fixed a crash happening when refcount being 0 and destroying the object (object was not removed from a global llist). Depends: libosmo-abis Change-Id I1314d6b917ecb622994507475eb894e649a1a2ad Change-Id: Ic37ae5bf657247e8cce99182c40d9adf890a5e41
2021-09-23abis: Fix memory leak of bts->osmo_link upon link going downPau Espin Pedrol1-0/+7
Commit below (see "Fixes" section) wrongly erased the code re-introduced in this commit, due to not spotting different between "oml_link" and "osmo_link". This commit is hence a revert of such commit, updated to current code. Fixes: c2ba34d9c13d309926c760943a9531fd3b236189 Change-Id: Id436116e5cd0bec024b2f9943fbff8d0bdc956ac
2021-09-23Avoid sending Load Indications when BTS is not RSL-connectedPau Espin Pedrol5-2/+14
Change-Id: I97e8dd7dd58ee2ec90c3a38d45dfd944db44c412
2021-09-23bts_trx: Drop non-executed path in trx_link_estab()Pau Espin Pedrol2-14/+13
This function is only called during sign_link_up() e1inp callback, hence only the link!=NULL condition (UP) is ever executed. Let's drop the DOWN path and make it a function only used to trigger events when link becomes up, similar to what bts_link_estab() does with OML. Here it becomes clear the NM_EV_RSL_DOWN was never sent. It's not much of an issue though since it would only make transition RCARRIER/BBTRANSC Enabled->DisabledOffline. However, since due to libosmo-abis limitation we receive a sign_link_down() for the entire line when 1 of its links goes down, we don't care much since we go for shutdown of the entire BTS anyway. Ideally, libosmo-abis would support simply telling us 1 of the links in the line went down and if it was not OML and not RSL TRX==C0, then we could keep on running and simply disable the related TRX. Change-Id: Iac553c68339c0da32fd313676995747eb4344087
2021-09-23abis: Call bts_model_abis_close() when Abis link goes downPau Espin Pedrol1-7/+3
This way based on BTS model features it can attempt to reconnect or simply exit the process. Change-Id: I42b43a0128bd4b579d9695e6dd2bccf6dc7e1d41