aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/loops.c
AgeCommit message (Collapse)AuthorFilesLines
2020-01-20ta_control: move timing advance code from osmo-bts-trx to commonPhilipp Maier1-57/+0
The timing advance controller that is implemented in loops.c of osmo-bts-trx only works for osmo-bts-trx and not for any of the phy based bts. Lets move the timing advance controller into the common part and make it available for every bts. Also lets add a unit-test. Change-Id: If7ddf74db3abc9b9872abe620a0aeebe3327e70a Related: SYS#4567
2019-11-30bts-trx: Drop low layer MS Power Control Loop algoPau Espin Pedrol1-177/+2
Let's drop it instead of having code duplication from common code in a lower layer, and maintain only the one in l1sap for all BTS models. As a result, osmo-bts-trx loses feature BTS_FEAT_MS_PWR_CTRL_DSP and will only be able to use "ms-power-control osmo" in VTY, which will be enabled by default (meaning: change of behavior, now MS Power Control is enabled by default in osmo-bts-trx and can only by disabled by BSC). Old bts-trx specific VTY command "(no) osmotrx ms-power-loop" is marked as deprecated but still working for more usual case (1 TRX configured) to avoid breaking backward compatibility. TA low level loop is still kept in loops.c and will be moved to l1sap at some point too. Related: OS#1851 Change-Id: I0d8b0c981d9ead91d93999df6e45fb06e426aeb9
2019-11-20scheduler_trx.c: avoid division by zero when calculating BERPhilipp Maier1-1/+9
There is theoretical risk that when calculating the BER that a division by zero occurrs. Lets add a check to avoid n_errors / n_bits_total when n_bits_total is zero. Change-Id: I1c0731b9a60be4b8c0c84b85b4403168120ceacd Fixes: CID#205696
2019-11-14Introduce BTS feature BTS_FEAT_MS_PWR_CTRL_DSPPau Espin Pedrol1-3/+6
It indicates whether BTS model supports managing an MS Power Control Loop over HW/DSP instead of using the software based osmocom algorithm present in osmo-bts. osmo-bts-trx own loop implementation is considered to be a "DSP/HW" one since it acts on lower layers and interferes with osmocom algorithm since it controls the same end variable "lchan->ms_power_ctrl.current", this way we make sure both aren't enabled at the same time. Old behavior in kept: if common upper-layer algo is not enabled explicitly in VTY (ms-power-control osmo) and bts-trx specific lower layer algo is neither enabled (osmotrx ms-power-loop <xyz>), then no power control is done at all. Related: OS#1851 Change-Id: I49706926b1e962b18791174627bc3cc0cd0cd9d5
2019-11-14bts-trx: loops.c: Avoid always clamping MS power to MS power class 1Pau Espin Pedrol1-10/+1
The affirmation written there is not true, since actually it depends on the band. For instance, for DCS1800 the maximum MS power is provided by class 3. Let ms_pwr_ctl_lvl() take care of campling instead. Change-Id: I744e7c315b818a1e7d3dd2579cd483c693d89b73
2019-11-14Move and rename gsm_lchan.ms_power fieldPau Espin Pedrol1-2/+2
Make it clear that it contains the maximum MS power level (TS 05.05) and not the one to be used. The one aimed at is in ms_power_ctrl.current. Since it's used in related code, move it inside the ms_power_ctrl struct too. Related: OS#1851 Change-Id: Ib264ec7dac87355cef6415461ed74bd8e9c8ca52
2019-11-12bts-trx: Implement MS Power control loop calculations using dBm instead of ↵Pau Espin Pedrol1-29/+56
ctl levels Some bands, such as DCS1800, contain power levels such as 29, 30 and 31 not following same unified sequence other power levels follow regarding conversion to dBm values. This makes extremly complex and prone to error comparing different power levels. Let's instead use dBm values to calculate and crop desired new value, and then convert it back to TS 05.05 ms power control level value. With this commit the control loop should be able to manage correctly the MS power levels explained above. Related: OS#4244 Change-Id: I0160637c5ffa606ee3081ad30be8e6f2a42b725b
2019-10-28bts-trx: loops.c: Take into account RSL CHAN ACT ms power level limitsPau Espin Pedrol1-0/+4
TS 48.058 sec 4.8 MS power control: """ TRX then attempts to keep the power control parameters within the limits set by the MS POWER CONTROL message (or by the CHANNEL ACTIVATION message) by changing the MS Power Level field of the L1 header sent to MS in each SACCH block. """ Fixes TTCN3 BTS_Tests.TC_rsl_ms_pwr_dyn_max Change-Id: Ifda92155bd9c277ac150a327a7ab63c854087788
2019-10-28cosmetic: bts-trx: document variable power levelPau Espin Pedrol1-1/+1
Change-Id: Ia4bc291c8213dd6cfe3b13a99b3108532b6907b1
2019-07-31osmo-bts-trx: Don't attemtp to adjust MS power if fixedHarald Welte1-0/+3
If the BSC has instructed the BTS via RSL to not autonomously perform MS power control, we are storing this in lchan->ms_power_ctrl.fixed. However, osmo-bts-trx would simply ignore that flag in loops.c and continue to compute new MS power values based on measurement results. Change-Id: I628d1f4f1094c22248d372c11c2ecc504135b757
2019-07-31osmo-bts-trx: Don't increment rssi_valid_count twiceHarald Welte1-1/+0
In the ms_power_val() function, don't increment the number of valid RSSI values counter twice. Change-Id: I19d9d933a69f7ad6252cbe51751d5db41790c698
2018-12-23osmo-bts-trx/loops.c: Make code control flow more readableHarald Welte1-20/+9
Use the 'else' construct where applicable to avoid too many return paths from functions Change-Id: I819f0c80e90855e8b3252795c837f8e3053b6e87 Related: OS#1622, OS#1851
2018-12-23osmo-bts-trx/loops.c: Use lchan name based loggingHarald Welte1-56/+36
The loops.c code dates back to ancient times when we printed the TRX number and the raw channel number to identify a logical channel. We meanwhile have gsm_lchan_name() and should use it to log messages related to this lchan in a common format. This commit introduces the LOGPLCHAN() helper macro [similar to osmo-bsc], and uses it from loops.c. As a result, some functions don't need a chan_nr argument anymore, while some need to add a new lchan argument. Change-Id: I6976dd7444c26b1f52741bc367b0311ebbef1718 Related: OS#1622, OS#1851
2018-12-23osmo-bts-trx/loops.[ch]: Make functions "void" if they always return 0Harald Welte1-50/+31
The concept of a return value only makes sense if there's actually ever something non-constant to return, and if the caller actually processes that return value. If we always "return 0" and ignore it on the caller side, functions should be of "void" type. Change-Id: I3575a2cef75f3fd4c3f95eddb40719d28a055b54 Related: OS#1622, OS#1851
2018-12-23osmo-bts-trx/loops.c: Add comments documenting TA + MS power control loopHarald Welte1-0/+30
The loops.c code is not very easily understood, so let's add some comments to it. As can be seen, there are functions of integer type which always return 0, and whose callers don't check for the return value. This will be adressed in subsequent patches. Change-Id: Iafea07eb751ed85d29b214576bb0d31ea919cd72 Related: OS#1622, OS#1851
2018-11-22Fix deprecated gsm_arfcn2band(), use gsm_arfcn2band_rc()Vadim Yanitskiy1-6/+5
Change-Id: I45aae70f4bc3f4f85d267dafb757debdef1bb7d7
2018-02-27trx/scheduler: Use integer math for TOA (Timing of Arrival)Harald Welte1-14/+17
There's no need to express TOA as a float: * We receive it as signed 16bit integer in units 1/256 symbol periods * We pass it to L1SAP as signed integer in 1/4 symbol periods So turn it into an int16_t with 1/256 symbol period accuracy throughout the code to avoid both float arithmetic as well as loosing any precision. Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
2017-08-24osmo-bts-trx: remove global variables from loopsMax1-10/+8
* move TA related globals into phy_link * move power loop related globals into phy_link * prefix corresponding vty vars with osmotrx Change-Id: I01d7c1abad67e51b886a4ecf2de072929d67da27 Related: OS#1848
2017-08-19osmo-bts-trx: Remove an unused variable. Resolves a compiler warning.Alexander Chemeris1-4/+0
Change-Id: I2464e872f81021cbc3ccbc4e2e32c394d6afcf70
2017-08-19osmo-bts-trx: Fix MS power control loop.Alexander Chemeris1-11/+11
The following two commits from 2014-12-06 introduced a new variable to control MS power - ms_power_ctrl, but kept the old ms_power variable in place. They have also changed the meaning of the ms_power variable - it now keeps original RSL configured value. So when much later osmo-trx-bts code was merged to master the code was compiling fine and this change in the meaning was overlooked. In osmo-bts: 579651bf300de002731dfd3bd39985c9fd15616c power/sysmobts: Add a manual ms power level control In OpenBSC: f6f86b0eec18da165db136b14bf2db87fde4b4ac osmo-bts: Introduce new struct for a power loop in the BTS code Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1
2016-02-15TRX: factor out the scheduler from remaining codeHarald Welte1-39/+44
The L1 scheduler is a generally useful component that is unfortunately tied quite a bit into the OsmoTRX support. Let's try to separate it out by having separate per-trx/per-ts/per-chan data structures pre-fixed with l1sched_ Using this patch it should be one step easier to use the scheduler for other BTS models, such as the intended upcoming virtual BTS.
2015-11-05TRX: catch up with trhe amr_mode naming changesHarald Welte1-3/+3
OpenBSC introduced a naming change in 615ed46a6ab25f71a7ab0d8201d33b4dbf8fc5b0 but osmo-bts fixes were only about osmo-bts-sysmo, not osmo-bts-trx. This updates osmo-bts-trx accordingly.
2015-09-22trx: Cleanup unused parts of loops.cAlexander Chemeris1-7/+2
2015-09-22TRX: Support for AMR full speechAndreas Eversberg1-0/+97
2015-09-22TRX: Code cleanup, prepare for other codecs than GSM full rateAndreas Eversberg1-5/+1
2015-09-22TRX: Implementation of MS power and timing advance loopsAndreas Eversberg1-0/+251