Commit Graph

3012 Commits

Author SHA1 Message Date
Pau Espin 137166fd5f bts-trx: Get rid of check_transceiver_availability_trx()
Get rid of this helper function, which is a remain of past epochs
(pre-FSM). In the current uses, there's only 2 real cases: the "if" path
upon SET BTS ATTR received (and even that one should be moved as per
what the code comment states), and the one happening when the TRX is
closed.

it really makes no sense to DISABLE the TRX as a result of SET BTS ATTR.

Change-Id: I48adfeecd722684152c589bcba827079b0a78c3a
2021-09-23 10:00:24 +00:00
Pau Espin 7c466d8cc7 bts-trx: Submit TRX_PROV_EV_CFG_ARFCN for C0 during SetBtsAttr
In oml_rx_set_bts_attr, arfcn for C0 is assigned from NM_ATT_BCCH_ARFCN.
The rest of the TRX get their arfcn from oml_rx_set_radio_attr()
NM_ATT_ARFCN_LIST.

Change-Id: I8aa9652622107fe0a707b2cbcbe8be6c71e19087
2021-09-23 10:00:24 +00:00
Pau Espin 32b51eca7d trx_provision_fsm: Properly reset FSM state upon starting listening for events
Change-Id: If0d078bc0170091efbca351c44ee412dad1e944a
2021-09-23 10:00:24 +00:00
Pau Espin eab7068d58 trx_if: delete retrans timer when flushing the Tx queue
Change-Id: Ic31dc5629ed950f3b4b8feb9917d11779696f6eb
2021-09-23 10:00:24 +00:00
Pau Espin 4444262a6a trx_if: Allow calling trx_if_flush/close from within TRXC callback
Change-Id: Ic3baa95ffe4e6ca95c6d02276ea8eb0cb9fa0064
2021-09-23 09:59:29 +00:00
Philipp Maier 3bf40e4f3a rsl: simplfy parse_repeated_acch_capability
The separate TLVP_PRESENT and TLVP_LEN calls can be replaced by
a single TLVP_PRES_LEN

Change-Id: I6bde1b9df50fdf355e768f5066e86422238b98e9
2021-09-23 08:21:57 +00:00
Pau Espin 03c74baa83 trx_if: Set pointer to null after freeing it
Change-Id: Icd93c9968095a8801aafe9440806cb5786320cbc
2021-09-22 12:57:02 +02:00
Pau Espin 3c56335094 bts_shutdown_fsm: Fix event name
Change-Id: Id042ae37f7c9dbd2edbb76932abb91d605d85e26
2021-09-22 12:57:02 +02:00
Pau Espin 68a39a8617 nm_*fsm: Make FSMs aware of object being properly configured or not
This will allow in the future advertising children objects that the
parent object has been configured. It is useful for instance to let TRX
know that the BTS is configured.

Change-Id: Ie319465fd0e991bab8451ea34ec72ff3702533d2
2021-09-22 12:56:58 +02:00
Pau Espin 5a2d8716ef abis: Drop internal OML msg queue
There's no real use for this queue. If the link is gone, it makes no
sense to keep old messages. Instead, BTS should generate new messages
sharing current state when link becomes established (it actually does
so already).

Change-Id: Iecd3c7cb96f5fff3b4c7e04c74e031df0f7a6987
2021-09-20 16:25:47 +02:00
Pau Espin 92186c672d nm_*_fsm: Move to state Disabled NotInstalled Locked when shtudown proc ends
Change-Id: I5c070adbba6b4abb19467a02d6449a443657ae2b
2021-09-20 16:25:47 +02:00
Pau Espin c56d120b29 MS Power Control Loop: Fix oscillations within good MS Power Levels
Related: SYS#4917
Change-Id: Ib33a94eba92004f9327c91e020a506dfa9a957c3
2021-09-20 14:57:15 +02:00
Pau Espin 43a4a1d5e7 nm_*_fsm: Set adminsitrative state 'shutting down' when shutdown procedure starts
Change-Id: I0d14840a55642812b865687a6cb208e7ffd22829
2021-09-20 12:22:53 +02:00
Pau Espin ea53ad454e Allow setting administrative state through oml_mo_state_chg()
This way it can be changed together with operative/availability state,
and changes announced to the BSC if present.

This commit presents no real change in osmo-bts behavior, since the only
place where adm_state is passed different than -1 is in
st_op_disabled_notinstalled_on_enter(), which is actually never called
(yet) since it's the initial state and no other states transition later
to it.

However, this will change in the future once we support re-connecting to
a (possibly different) BSC, which means objects will need to be moved to
that state to restart the whole OML install procedure on the new BSC.

Change-Id: Ifdc6a1dfb673c0ab915ddf2a9d372928f4f86b4c
2021-09-20 12:22:53 +02:00
Pau Espin 729aff7938 nm_*_fsm: Add missing item in event mask list for state ENABLED
Change-Id: Iebaa7dcfc01978cee2e4b08609503eb4e25598b7
2021-09-20 12:22:53 +02:00
Pau Espin 82275d5eb2 trx_provision_fsm: Add missing state transition OPEN_WAIT_POWEROFF_CNF => OPEN_POWEROFF
Change-Id: I361c1acddfe7ebffb44d886d0545240ef1bbd347
2021-09-20 12:22:53 +02:00
Pau Espin 8dd699e545 abis.c: Loop over list of BSCs until connection succeeds
Do not exit if all BSCs in the list fail to connect, keep trying
forever. This commit still doesn't change the logic after BTS has
successfully connected to a BSC. In that situation, if the link goes
down, BTS will exit in order to reset all state and let the user/system
restart it.

Related: SYS#4971
Change-Id: I67bba3b7e2d9d62b98a59a74987ae55206a3ec51
2021-09-20 12:22:53 +02:00
Pau Espin 3f7bd192a6 abis.c: Fix mess with priv->bsc_oml_host
The pointer was used as "struct bsc_oml_host" sometimes, and other times
as "struct llist_head". It just worked because bsc_oml_host->list is the
first item in the script. The code was really confusing, also because
the bts list of items has a name really similar to the one currently
assigned. Let's rename the currently assigned address to "current_bsc",
store it always as "struct bsc_oml_host*" and finally use llist_entry
helpers when needed.

The related code is also moved to a helper function to enclose there the
logic to get next BSC in list. This change actually changes the logic
where a remote address is removed from VTY, since now the next address
in list is picked at the time, and later when reconnecting the list is
forwarded another time, meaning one address will be skipped.
This could be considered a bug, but this situation is really special
and anyway the entire logic will be changed in new commits where we'll
keep reconnecting in loop without exiting when reaching the end of the
list, so we are fine with it. Think of this commit as a preparation
commit for next ones.

Change-Id: I3cc8a4148b3d63bc185b72dab8108105a6644910
2021-09-20 12:22:53 +02:00
Pau Espin 65c0341f3d abis.c: Transition to CONNECTED state only when OML link is up
This clarifies the different states and transitions between them:
OML LINK UP: CONNECTING->CONNECTED
ANY LINK DOWN: CONNECTING->CONNECTING, CONNECTED->FAILED
In follow up commits, support to reconnect instead of exit after the BTS
has already connected will be added, so only the last transition needs
to be changed.

Related: SYS#4971
Change-Id: I43e83b1b04fbaa1f87818c096e6ad3920801b1f6
2021-09-20 12:22:53 +02:00
Pau Espin 79a92cfc50 abis: Shorten string names of events
Change-Id: I7a5dab3d38e917a8f37c72765e27f263c324ed96
2021-09-20 12:22:53 +02:00
Pau Espin 5831512c2c abis: Move FSM registration to constructor function
We commonly do it this way since there's only need to call it once at
the startup of the program.

Change-Id: I6ee5b89175ee32bc12a8afc9682a8f90d1713291
2021-09-20 12:22:53 +02:00
Pau Espin a09c9a8c32 cosmetic: Fix formatting of conditional operator
Change-Id: Ib0da405d1d9ed30bea97b433b7cf07b1084348ef
2021-09-20 12:20:14 +02:00
Pau Espin 4a1e34c077 tests: MS Power Control Loop: Show oscillation among good power levels
This test showcases the current issue where the loop keeps bouncing
between 2 good MS Power Level values due to the loop "accepting" and
"reporting back" the previously considered good MS Power Level
announced/used by the MS. Hence, upon report back from the network, the
MS will switch to this new MS Power Level, and same thing will ocurr
over and over.

Related: SYS#4917
Change-Id: I16ed7fe8a123b99008e0c041d2f3e4232057d55c
2021-09-17 14:20:46 +02:00
Pau Espin 41fe4089a8 power_control: Drop unused param in function
Change-Id: I6c0c2b983e153b06b84664565bd485e748a8af7d
2021-09-16 13:02:11 +02:00
Pau Espin 3f51571a2f abis.c: Convert early return to assert()
This should simply not happen. If other event is received, something is
terribly wrong, so we should exit immediately instead of silently
failing.

Change-Id: I5f4953be735f526bb8b926979233b3c26ba67ce9
2021-09-15 16:17:37 +02:00
Pau Espin daadbc33aa abis.c: Rearrange code to follow logic state order
CONNECTING state comes first in logical order of states (as properly
seen in enum of states), however, the FSM struct definition and state
action functions are swapped. Let's put them in order.

Change-Id: I0cae561926b460dc5882390db969b7c925903e5d
2021-09-15 16:17:37 +02:00
Pau Espin a17043f2b4 cosmetic: fix typo in comment
Change-Id: I0e4fdad66c0bad849a7b960cf78f9f45b56fcb95
2021-09-15 16:17:37 +02:00
Pau Espin bc7c8a42f3 abis.h: Drop unused state
Change-Id: I11173af3a543f6679ca9d43064bf071c214b1898
2021-09-15 16:17:37 +02:00
Pau Espin c2ba34d9c1 abis: Clear code and drop code not executed
abis_init() sets "g_bts = bts;", hence bts object is the same as g_bts
(since we only have 1 BTS object in osmo-bts). As a result, dropping
checking first bts->... and later g_bts->... makes no sense: the later
condition will always be false.

Change-Id: I5018199221fb3c3329a59d0b91e827f077cef85d
2021-09-15 16:17:37 +02:00
Pau Espin e1dbc616b0 MS Power Control Loop: Fix sub vs full being passed to algo
Fixes: c80abd109b
Change-Id: Ib66ac938e3e71409848927a2972f1f77b9bacde2
2021-09-15 14:30:13 +02:00
Pau Espin c81b41c62e Support configuring TA loop SACCH block rate
Similar to what is already provided for power control loops. However,
there's no existing way to communicate TA control parameters from the
BSC to the BTS, so implement them locally in BTS vty.

Related: SYS#5371
Change-Id: I9fa71f836bb9a79b0ef2567bfcfdf38ff217840b
2021-09-14 11:42:58 +02:00
Pau Espin c85027a510 Power Control Loop: Set P_CON_INTERVAL to 1 by default
TS 45.008 section 4.7.1:
"""
Upon receipt of a command from an SACCH to change its power level on the corresponding uplink channel, the MS
shall change to the new level at a rate of one nominal 2 dB power control step every 60 ms (13 TDMA frames), i.e. a
range change of 15 steps should take about 900 ms. The change shall commence at the first TDMA frame belonging to
the next reporting period (as specified in subclause 8.4). The MS shall change the power one nominal 2 dB step at a
time, at a rate of one step every 60 ms following the initial change, irrespective of whether actual transmission takes
place or not.
"""

Since the reported MS_PWR in L1 SACCH Header is, according to specs, the
one used for the last block of the previous SACCH period, it becomes
clear the first SACCH block after a requested MS Power Level change by
the network may contain mismatches between the announced MS_PWR by the
MS and the measured Rxlev/RxQual. Hence, let's better use a
P_CON_INTERVAL of 1 which retriggers the MS Power Control Loop every second
SACCH block.

Change-Id: If6cb8945645a2031f2b2ee65d9b9f51e75cd9af1
Related: SYS#5371
2021-09-14 11:42:58 +02:00
Pau Espin 132b67a7a0 TA Control Loop: Change toa256 switch threshold to 75% of a symbol
As per 3GPP TS 45.010 sec 5.6.3 Delay assessment error:
"""
the delay shall be assessed in such a way that the assessment error
(due to  noise and interference) is less than 1/2 normal symbol periods
for stationary MS. For MS moving at a speed up to 500  km/h the additional
error shall be less than 1/4 normal symbol period.
"""

Hence, required TA loop calculation should take into account an error of
up to 1/2 + 1/4 = 75% of a symbol. By changing the threshold variable
to that percentage we make sure we take into account bigger deviations
and update TA accordingly.

Related: SYS#5371
Change-Id: I4c5825df4291d3851a113027abf7566de343a190
2021-09-14 11:42:44 +02:00
Pau Espin c80abd109b MS Power Control Loop: Feed UL C/I from correct measurement period
As per 3GPP TS 45.008 sec 4.2, the ms_pwr received in L1 SACCH Header is
the value used over previous measurement period. Hence, we need to feed
the algo with the measurements taken over that same period.

Related: SYS#4917
Change-Id: I13c0014fdd73f823ae5b1256c35bfa7d97cfa334
2021-09-13 17:52:24 +02:00
Pau Espin 8d21891959 MS Power Control Loop: Feed UL RSSI from correct measurement period
As per 3GPP TS 45.008 sec 4.2, the ms_pwr received in L1 SACCH Header is
the value used over previous measurement period. Hence, we need to feed
the algo with the measurements taken over that same period.

Related: SYS#4917
Change-Id: I00852cb37a3613606e37476c169f5a32d6b5d75e
2021-09-13 17:52:24 +02:00
Pau Espin 22a160bd24 lchan: Move TA CTRL param to its own substruct
Field is renamed to look similar to similar fields in power control
loop. This is a preparation commit, next one will add functionality to
skip SACCH blocksi (P_CON_INTERVAL).

Related: SYS#5371
Change-Id: I169ce58ab827e38b64f4b15f935097a9118fa118
2021-09-13 12:53:44 +02:00
Pau Espin f54a7462dd ta_control: Allow switching TA quicker
From TS 45.010 5.6.1 (delay tracking for circuit switched channels):
"""
Restricting the change in timing advance to 1 symbol period at a time
gives the simplest implementation of the BTS.  However the BTS may use
a larger change than this but great care must then be used in the BTS design.
"""

In general 1 TA at a time (every 480ms of SACCH block) should be enough,
since section 5.6.3 states:
"""
The control loop for the timing advance shall be implemented in such a way that it will cope with MSs moving at a
speed up to 500 km/h
"""
Which is ~140 m/s, and 1 TA step around 500m, so most of the time we
should be save and no steps of more than 1 TA should be required.
However, unlikely changes from reflected to direct signal or vice versa
could produce higher increments, so let's increase the maximum step size
allowed to 2 in order to give more room.

Change-Id: I9e48faabf3090588233e274b2b39065cf85fbec7
2021-09-13 12:53:22 +02:00
Pau Espin f21b9231dd TA loop: Take into account UL SACCH 'Actual Timing advance' field
First step improving and reworking TA loop:
Move trigger of the loop to similar place done by BS/MS Power Control
Loop, that is, upon receivial of UL SACCH block, which contains
information about the TA used to transmit the block encode in L1SACCH
Header. Hence, from computed received TOA and TA used when transmitting
from the MS, we can infer the desired TA to be used by the MS, which
will send back to it later during DL SACCH block.

The values taken are actually the ones calculated for the previous SACCH
block and stored in lchan->meas.ms_toa256. That's because L1SACCH
contains the TA used for the previous reporting period, similarly to
what's specified for MS Power Control loop (TS 45.008 sec 4.2):
"""
The MS shall confirm the power control level that it is currently employing
in the SACCH L1 header on each uplink  channel. The indicated value shall
be the power control level actually used by the mobile for the last burst
of the  previous SACCH period.
"""
(The reader may observe that currently this is not properly done for MS
Power Control loop when calling lchan_ms_pwr_ctrl(): this is a bug.)

This new method also permits changing TA quicker, since we have more
confidence that the TA we request is aligned with the one used to
transmit, and we don't simply increment/decrement based on the value we
request to transmit.

Related: SYS#5371
Change-Id: I2d0f128c8dcac93ee382283a1c91fca76623b8fc
2021-09-13 12:25:32 +02:00
Neels Hofmeyr 494b251109 early IA: change default X15 timer to 0 ms
Tests have shown that even a delay of 0, i.e. a simple defer until the
next select() loop, makes the difference from failing to working early
IA. So set the default to 0, achieving such defer.

Related: SYS#5559
Change-Id: I95365649edd51114bcf6028f0dc3bbe4186f96d2
2021-09-11 13:10:33 +00:00
Neels Hofmeyr da7c56ab8e early IMM ASS: add configurable delay for RR IMM ASS
During live testing, it has become apparent that some IMM ASS still fail
when sending the RR IMM ASS directly upon the target channel becoming
active.

Add a bit of delay after activation, to give some time for the channel
to light up for the MS. Default is 50ms.

Related: OS#5559
Change-Id: Ia1e63b98944dc840cde212fc732e20277cdc5585
2021-09-11 13:10:33 +00:00
Pau Espin 314a0db113 l1sap: Take L1SACCH MS_PWR from bitfield instead of manual parsing
Change-Id: Ib2918d5d6b8463c659896f6e535a0c6eaca4bd87
2021-09-06 17:58:38 +02:00
Pau Espin 746d0a7500 comsetic: measurement.c: fix typo in comment
Change-Id: I3ed3486bbc3d55088e3ebe27e4a76f932d6f7a59
2021-09-06 16:19:05 +02:00
Pau Espin 5ed69d0fd5 Power Control Loop: Move skip loop logic to function helper
Let's move duplicate logic to function helper.

Related: SYS#5371
Change-Id: Ic26c17564ec61cdadaab0184c4246b9bf863c69a
2021-09-06 13:17:03 +02:00
Pau Espin e0febb700a MS/BS Power Control Loop: Fix downscaling averaging bug
The bug showed up in previous commit and is fixed in this commit. It can
be seen how rounding error is carried over time in the average
measurement, and affects final values.

Change-Id: I680d1c94bd4bae179b14b26662a819fa1462a5c8
2021-09-03 19:06:22 +02:00
Pau Espin aac12bfd67 MS/BS Power Control Loop: Do RxLEV meas avg & delta calculations directly on RxLevels
Before this comits, averaging and delta calculation was done in RSSI,
but stored the averaging cached state in variables named "rxlev", which
was really confusing. Let's keeping averaging and delta calculations
based on RxLevels.

Some of the tests change results due to test passing RSSI -45, which is
an invalid Rxlev (only up to -47 is supported).
Others fail due to an unrelated bug showing up now. Basically the averaging algo
is doing rounding  the wrong way when downscaling the values. It will be
fixed in a follow-up commit.

Change-Id: I4cff8394f22b5d47789163051364ff594b2bcd74
2021-09-03 19:06:22 +02:00
Pau Espin e2f9abee58 BS Power Control Loop: Increase attenuation if RxQual is better than upper threshold
If RxQual is considered good enough, attenuation can be increased in
order to lower overall cross-channel noise among different MS.

Change-Id: Ie97898980acd152de15f6b4b619d492048855ef4
2021-09-03 19:06:22 +02:00
Pau Espin dd97023388 BS Power Control Loop: Support EWMA average algo for RxQual meas
params->rxqual_meas.upper_thresh is left unchecked in
lchan_bs_pwr_ctrl() on this commit on purpose, to keep this
commit with old behavior wrt to algo logic.

Change-Id: If7e3987df89d680cfa443195ab2f225681d0e6cf
2021-09-03 19:06:14 +02:00
Pau Espin cd11905f64 BS Power Control Loop: refactor lchan_bs_pwr_ctrl() to look similar to lchan_ms_pwr_ctrl()
This commit reworks the code in function lchan_bs_pwr_ctrl()
and logging to look similar to that of lchan_ms_pwr_ctrl(), so that
reader can easily spot similarities between both and add simillar
features more easily.

This commit is also a preparation to add EWMA avg support for RxQual
measurements. Logging is also reworked now to look similar to that of MS
Power Control Loop, because having several parameters driving the algo
(RxLev and RxQual), it becomes more suitable to log all of them together instead
of intermediate info only aplicable to one param such as "delta".

Change-Id: Ida76b55f0da722135eb61ed06ea2b3a1862df600
2021-09-03 19:03:48 +02:00
Pau Espin 160da8ea2b MS Power Control Loop: Improve logging
Change-Id: I8babd42566c41935079fd414d930ebf2d737892e
2021-09-03 19:03:48 +02:00
Pau Espin 085a4cb91e MS Power Control Loop: Support EWMA algorithm for C/I measurements
Change-Id: I52eb0558fd7a215a6ee0b2aced189ae4a37d8a22
Related: SYS#4917
2021-09-03 19:03:48 +02:00