Commit Graph

2843 Commits

Author SHA1 Message Date
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
Pau Espin 0617afdb5f MS Power Control Loop: Take C/I into account
This commit extends existing MS Power Control Loop algorithm to take
into account computed C/I values on the UL, received from MS. The
related C/I parameters used by the algorithm are configured at and
provided by the BSC, which transmits them to the BTS similar to already
existing parameters.

Using C/I instead of existing RxQual is preferred due to extended
granularity of C/I (bigger range than RxQual's 0-7).
Furthermore, existing literature (such as "GSM/EDGE: Evolution and Performance"
Table 10.3) provides detailed information about expected target values,
even different values for different channel types. Hence, it was decided
to support setting different MS Power Parameters for different channel
types.

These MS Power Parameters are Osmocom specific, ie. supported only by
newish versions of osmo-bts. Older versions of osmo-bts should ignore
the new IEs added just fine. The new IEs containing the MS POwer
Parameters are not send for non osmo-bts BTSs, hence this commit is
secure with regards to running  osmo-bsc against an ip.access BTS such
as nanoBTS.

Related: SYS#4917
Depends: libosmocore.git Change-Id Iffef0611430ad6c90606149c398d80158633bbca
Change-Id: I5dfd8ff9ab6b499646498b507624758dcc160fb6
2021-09-03 18:57:13 +02:00
Philipp Maier 7c23017806 sched_lchan_tch_x: use ul_cmr and ul_ft when generating RTP bad frame
All generated RTP that originates from the BTS relates to uplink. When
generating AMR BAD frame RTP packets, we must use ul_cmr/ul_ft and not
dl_cmr/dl_ft.

Change-Id: Ifa009819791cf7df2dd8201f442b0dae06f622a4
Related: SYS#5549
2021-09-02 17:43:15 +00:00
Philipp Maier a65cf63619 sched_lchan_tch_x: use functions to determine AMR tranmssion phase
The AMR transmission phase directly depends on the frame number. The
transmission phase is used to tell if a received AMR frame contains a
CMI (frame type that is currently used) or CMR (frame type that the
receiver should use) codec identifier. The formulas in the present
implementation seem to be correct but they do not reflect the numbers in
the spec very well, nor do they have unit-tests. Lets replace them with
more readble functions and test those functions with unit-tests.

Change-Id: I94a934a6b3b397b4cd0e9da3577325de58814335
Related: SYS#5549
2021-09-02 17:43:15 +00:00
Philipp Maier ca41f091fc sched_lchan_tch_x: do not use cmr as ft
CMR and FT are updated each time an AMR voice frame is received from the
radio interface. The transmission phase decides whether the voice frame
contains CMR or FT. The code follows the transmission phase and keeps
ul_cmr and ul_ft up to date.

In contrast to the AMR frames on the radio interface, an AMR RTP packet
always contains the CMR and the FT value.

When generating the RTP payloed, The present implementation uses the CMR
in the position where the FT should be and the FT is ignored. This is not
correct.

Change-Id: I6bb10ff3c76f67b9830787497653b546cf27fe8e
Related: SYS#5549
2021-09-02 17:43:15 +00:00
Oliver Smith 8f37660fd6 debian/control: remove dh-systemd build-depend
Related: OS#5223
Change-Id: Ieb8669a9a43ea1acc6b2d8d2e363f2466c51697a
2021-09-01 16:07:06 +02:00
Pau Espin 298a259b7c rsl: Support parsing up to 3 RSL_IPAC_EIE_MEAS_AVG_CFG IEs
struct ipac_preproc_cfg seems to suggest that there may be up to 3 IEs
in some cases:
"struct ipac_preproc_ave_cfg ms_ave_cfg[3];"

Change-Id: I02633713eb557ee52e790a239f7b13b8c5b2b3bd
Fixes: 9238c3549d
Related: SYS#4918
2021-08-31 08:14:32 +00:00
Harald Welte 6aa959ecf4 l1sap/gsmtap: Don't log UI fill frames [zero information field]
When generating GSMTAP, we are already suppressing generation for
fill frames on PCH and AGCH.  Let's expand that also to dedicated
channels SDCCH, TCH/F and TCH/H.  The fill frames just clog up the
logs without providing much benefit.

SACCH is still being logged, as it contains SI or MEAS REP, so every
active channel still sees GSMTAP traffic every 480ms (SACCH interval).

Change-Id: I0dd37d8848eb0379f84d15f5f006142b16823c6a
2021-08-31 06:55:56 +00:00
Pau Espin 294fa4e061 rsl: Fix rx of multiple RSL_IPAC_EIE_MEAS_AVG_CFG IEs
So far only the first one was applied.

Fixes: 9238c3549d
Related: SYS#4918
Change-Id: Ib4f3c165a988e77b61a8852b254fc0904aa12482
2021-08-30 12:05:24 +00:00
Vadim Yanitskiy c485901d3d osmo-bts-trx: send dummy FACCH in the absense of RTP frames
If for whatever reason the transmit queue of a TCH/{F,H} contains
neither speech frames nor signalling blocks, osmo-bts-trx would
currently transmit garbage.  Of course, this causes decoding
errors at the MS side.

Ideally, we should employ an ECU (Error Concealment Unit) for the
given codec in use.  However, a simpler solution is to transmit
dummy LAPDm frames over FACCH.  This is what e.g. nanoBTS does.

Change-Id: I868afecbcb6890f40c8f146e3ce00e836b794dd3
Related: OS#4823
2021-08-29 08:21:32 +00:00
Neels Hofmeyr f616294d8c add osmo_tdef groups, exposing T timers on VTY config
We have two osmocom specific timers used in the BTS, X1 and X2. Expose
those on the VTY configuration, as timer group 'bts'.

This prepares for a subsequent patch, where I would like to add another
configurable timer. This provides the basic infrastructure for that.

Related: SYS#5559
Change-Id: I0f56f9425134679219884b0c3c2f29e77aff5e64
2021-08-18 17:27:04 +02:00
Neels Hofmeyr bb840eceb9 jenkins: enable new flag --enable-external-tests
Change-Id: Iac47ce865c833d892c84425b49e9420838e100ca
2021-08-18 17:27:04 +02:00
Neels Hofmeyr 9eb8c9f0d7 add VTY transcript testing
This is not as trivial as with OsmoBSC or OsmoMSC, because normally the
osmo-bts process exits right away when there is no BSC. Hence add
--vty-test option to main.

Use 'osmo-bts-virtual --vty-test' for testing. The other BTS models
require dependencies / configure switches to be built.

Essentially copied from osmo-bsc.git:
configure.ac: add --enable-external-tests
tests/Makefile.am: add 'vty-test' target

Add osmo-bts.vty, some trivial VTY node testing.

This prepares for adding VTY tests for T timer configuration added in a
subsequent patch.

Related: SYS#5559
Change-Id: I730daf548a3a9bb116aa8b6d5772ca9af0ada08f
2021-08-18 17:27:04 +02:00
Neels Hofmeyr f1312f9818 enable Early Immediate Assignment
When an Immediate Assignment comes in targeting an lchan that is not yet
active, then hold back the RR Immediate Assignment until the channel
becomes active.

This allows the BSC to send the Immediate Assignment before first
waiting for the Channel Activation ACK, saving one Abis roundtrip, and
helping avoid double allocation on high latency Abis links.

Related: SYS#5559
Related: I56c25cde152040fb66bdba44399bd37671ae3df2 (osmo-bsc)
Related: Ifb2c62431a91dafa6116b5d6b9410930f00a6e18 (osmo-ttcn3-hacks)
Change-Id: Ie52765b238b01f22fb327fe12327fbf10abcad4c
2021-08-18 17:27:04 +02:00
Neels Hofmeyr 30c838fdfa remove unused LCHAN_S_INACTIVE
Change-Id: Ia738eaa796264fe0a97a2c86d6bbd37eaffe0a59
2021-08-16 20:40:20 +02:00
Philipp Maier 6611e7f305 allow to configure multiple oml remote-ip addresses
At the moment we can only configure a single BSC in the BTS
configuration. This also means that if this single BSC fails for some
reason the BTS has no alternate BSC to connect to. Lets extend the
remote-ip parameter so that it can be used multiple times so that an
operater can configure any number of BSCs that are tried one after
another during BTS startup.

Change-Id: I205f68a3a7f35fee4c38a7cfba2b014237df2727
Related: SYS#4971
2021-07-19 10:39:06 +02:00
Pau Espin ace4e500ed Make gcc 11.1.0 false positivies happy
Make gcc 11.1.0 false positivies happy

After my system's gcc was upgraded, I get false positivies in a couple
places. Let's initialize those to make gcc happy.

"""
//git/osmo-bts/src/common/vty.c: In function ‘lchan_summary’:
//git/osmo-bts/src/common/vty.c:1881:23: error: ‘ts’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1881 |                 lchan = &ts->lchan[lchan_nr];
      |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
//git/osmo-bts/src/common/vty.c:1869:20: error: ‘trx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1869 |                 ts = &trx->ts[ts_nr];
      |                 ~~~^~~~~~~~~~~~~~~~~
//git/osmo-bts/src/common/vty.c:1852:34: error: ‘bts’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1852 |                 if (trx_nr >= bts->num_trx) {
"""

Change-Id: I93477142a5a4b3f3829b7398d6e564c127263596
2021-07-15 13:51:38 +02:00
Philipp Maier dda5cf4bb7 paging: prioritize CS related paging over PS related pagings.
When the paging queue is filled up to a critical level, pagings from the
PCU should be dropped as each immediate assignment paging from the PCU
is worth 4 normal CS pagings. Also the PCU may still issue pagings if the
paginging queue is already full and CS pagings are dropped. In a
congestion situation it is more important to get the CS rather than PS
pagings through.

Change-Id: I30f97672d7a0c369c4a656e878ab8cbbd83e31ea
Related: SYS#5306
2021-07-06 11:35:50 +02:00
Vadim Yanitskiy a5602d593c gsm_lchan_interf_meas_calc_band(): also print number of AVG samples
Change-Id: I4cebb0c5eef16f7e20fce85c506fc271127d7259
2021-07-05 12:07:55 +00:00
Vadim Yanitskiy 454a2516f2 rsl: use tlvp_val16be() in rsl_rx_ipac_XXcx()
Instead of using tlvp_val16_unal() and then doing ntohs() here
and there, convert the remote port to the host byte order once.

Change-Id: Id883a976a03fd3022ed9d66f703b01244df2d9db
2021-07-05 12:07:55 +00:00