Commit Graph

8010 Commits

Author SHA1 Message Date
Pau Espin 0f34f7e72f doc: manual: Fix typo in text
Change-Id: I1dfe298ad9a416ea15976527463a55873db56f22
2021-08-26 13:19:30 +02:00
Pau Espin 694d43f706 doc: Improve ACC ramp documentation
Commit below added support for ACC ramping based on channel load, but
documentation was not updated with it.

Fixes: 1e5e7004dc
Change-Id: I8701386b35ccdebfc843fd00535091648e52f739
2021-08-19 14:50:02 +00:00
Neels Hofmeyr c746509d3c early IMM ASS 3/n: implement 'pre-ts-ack'
Add experimental 'pre-ts-ack' to the 'immediate-assignment' options:
send the IMM ASS even before a dynamic timeslot is switched. This
possibly saves an Abis roundtrip, but may be racy.

When pre-ts-ack is chosen, already do the IMM ASS before the dyn TS
pchan switch is ACKed.

In Immediate Assignment, in case the dyn TS is not ready yet, get the
pchan kind from lchan->type, which already reflects the target type, and
not from ts->pchan_is, which still reflects the previous pchan type.

Related test is in I2ae28cd92910d4bc341a88571599347a64a18fe5

Related: SYS#5559
Change-Id: I19e6a3d614aa5ae24d64eed96caf53e6f0e8bb74
2021-08-16 02:13:17 +02:00
Neels Hofmeyr eec43fa532 early IMM ASS 2/n: implement 'pre-chan-ack'
When 'immediate-assignment pre-chan-ack' is set, send the Immediate
Assignment directly after the Channel Activation, not waiting for the
Activation ACK, to save an Abis roundtrip.

Related test is in If71f4562d532b6c5faf55f5fd073449a8a137ebf

Related: SYS#5559
Change-Id: I56c25cde152040fb66bdba44399bd37671ae3df2
2021-08-16 02:13:17 +02:00
Neels Hofmeyr 225af37f48 early IMM ASS 1/n: add vty config option
This patch adds only the VTY config option without any effect, to ease
patch review.
The implementation follows in I56c25cde152040fb66bdba44399bd37671ae3df2

The new config option is written so that further variants of Immediate
Assignment sequencing may be added easily.
See also I19e6a3d614aa5ae24d64eed96caf53e6f0e8bb74.

Related: SYS#5559
Change-Id: I710343d1728153faf3db9758ff5a1ef26bb8d3d4
2021-08-16 02:13:17 +02:00
Neels Hofmeyr 1dbbc60769 error log: improve lchan lookup error msg
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-08-16 02:13:17 +02:00
Neels Hofmeyr 57af76cdcf introduce gsm48_lchan_and_pchan2chan_desc()
The function gsm48_lchan2chan_desc_as_configured() dups
gsm48_lchan2chan_desc() with merely a different pchan type
(ts->pchan_from_config instead of ts->pchan_is).

In an upcoming patch, I would like to do the same, just with yet another
pchan value (derived from lchan->type, because that reflects the channel
type even before a dynamic timeslot switched its pchan type).

So replace gsm48_lchan2chan_desc_as_configured() by
gsm48_lchan_and_pchan2chan_desc() with explicit pchan arg;
also call this from gsm48_lchan2chan_desc(), reducing code dup.

gsm48_lchan2chan_desc_as_configured() had more concise error logging.
Absorb that into the new gsm48_lchan_and_pchan2chan_desc().

Add gsm_lchan_and_pchan2chan_nr(), like gsm_lchan2chan_nr() just with
explicit pchan arg, to be able to pass the pchan down from the new
functions mentioned above.

Related: SYS#5559
Change-Id: I67f178c8160cdda1f2ab5513ac4f65c027d4012f
2021-08-16 00:12:12 +00:00
Neels Hofmeyr cd6f44c8f1 lchan_fsm_post_activ_ack(): return upon release
The bottom of the function changes the lchan state. If a failure branch
is reached, that should no longer happen. Change 'break' to 'return' in
four places to not mix up the channel release.

Related: SYS#5559
Change-Id: I4674752ab4f1c8e8147ef3366f90e9ea2abd5aec
2021-08-16 00:12:12 +00:00
Philipp Maier c96c05f07b osmo_bsc_main: remove unused commandline option -l
The option -l ("The local address of the MGCP") is still present in the
commandline help and the manual, but it is used nowhere and osmo-bsc
exists when it is used. Lets remove it.

Change-Id: Ia295f4414e0d6e78b388c0c72f1a5b8df8bc3d7e
2021-08-03 12:11:32 +02:00
Philipp Maier a23c7be0a1 running.adoc: explain mgw reset-endpoint VTY setting
When OsmoBSC is restarted, it does not automatically clear the calls on
the MGW. However, this is an important part of the configuration to
avoid trouble with resource leakage on the MGW, so lets make (especially
novice) users aware of that option.

Change-Id: I19c499c6ac83d7f9437b18b372977f6f2d518adf
Depends: osmo-mgw I47e7ff858d5067b46d52329be5f362ff61c0dff8
Related: SYS#5535
2021-08-03 11:44:57 +02:00
Neels Hofmeyr e8708af1e1 coverity: quench null deref warning in gscon_change_primary_lchan()
The if conditions for logging an lchan change made it look like
new_lchan might actually be NULL, which it never is. So rather pin
new_lchan as non-NULL with an assert and simplify the logic.

Related: CID#237146
Related: b0d854556d
Change-Id: I8859c6cb9b3b15287e339ce4b6815b946965d0d9
2021-08-02 15:02:11 +00:00
Pau Espin fc842fba24 Clarify string name for GSM_CHREQ_REASON_CALL
The previous naming was confusing since when appearing on log files it
seemed to mean the reason was mainly only call reestablishment, when it
actually means either call establishment (the usual reason) OR call
re-establishment (should happen seldomly).
Let's add some parenthesis to make it clearer.

Related: SYS#5548
Change-Id: Id2dccd71803335c284a5ba271fa7f7890d253c27
2021-07-29 14:40:26 +02:00
Neels Hofmeyr 9612a7c23e vty: improve err msg for invalid subslot nr
Change-Id: I2f649bd2d8d9f217c22b62d2842e1e4fa101ba11
2021-07-24 00:09:21 +02:00
Neels Hofmeyr e2488eb268 vty: lchan deact: allow omitting the lchan type arg
In the command

  bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> deactivate fr

the final argument indicating the channel type does not make sense and
is not actually used. Define a separate vty command for 'deactivate', so
that it doesn't require arguments only used for 'activate'.

Change-Id: Ibdeca3b1d75b9f6092f566544e9d5f4da67fffce
2021-07-24 00:09:02 +02:00
Neels Hofmeyr b0d854556d debug log: indicate change of primary lchan on a conn
Change-Id: Ib4e9a1cde9248f5d3fd8d7d8277623b42670b059
2021-07-24 00:02:00 +02:00
Neels Hofmeyr 9bff117e4a log: fix missing newline in lchan_select.c
Change-Id: Iea8bc73ba6da24f353ad422cdea3fa88173a9a1c
2021-07-24 00:02:00 +02:00
Neels Hofmeyr bb56236e59 fix CM Re-Establishment Request: allocate new A conn
For a call re-establishment, the MS shows up on a different cell and
requests CM Re-Establishment (3GPP TS 24.008 9.2.4). As soon as the
Layer 3 is established, the MSC will clear the first A-connection; the
re-establishment *has* to happen on a new separate A-connection. So for
a brief moment we must allow two distinct A-interface connections to be
used for the same subscriber.

Tested by BSC_Tests.TC_cm_reestablishment
added in I1e7d446644f46b8a0a94688e618ffb4f23a8900e

Related: SYS#5130
Change-Id: I2da9a971dd36c4289a78040adfe85704c8282c59
2021-07-24 00:00:40 +02:00
Pau Espin 56eda35874 Introduce VTY option to forbid use of TCH for non-voicecall signalling
Usual allocation mechansim, when some signalling channel is needed,
first tries to reserve an SDCCH, and if all of them are exhausted, then
attempts to reserve a TCH as a last resort.
This, however, may cause TCH starvation under certain situations, for
instance if there high load on other services (LU, SMS, etc.).
Hence, it may be desirable for the operator to forbid reservation
of TCH slots once SDCCH become exhausted. This commit is thus adding a
VTY command which allows forbidding it. The default behavior (allow using
TCH timeslots when SDCCHs are exhausted) is kept as before.

The above mentioned prohibition is applied only to non-voicecall related
signalling services. That's because voicecall services will end up
requiring a TCH anyway, and forbidding reservation of TCH straighaway
when SDCCHs are exhausted would mean no voice calls could be initiated
while still TCHs would be available.

Related: SYS#5548
Change-Id: Ib08027125145df26602069bfb51847063b0ccc0c
2021-07-23 13:36:03 +02:00
Pau Espin 8e3320ac48 Introduce libbsc to avoid linking long lists of .o files
Every time a new file is added in osmo-bsc, it ends up being a pain
because its .o file has to be included to other tests/util binaries, or
stubs need to be added.
Let's instead bundle all .o files together in an .la file and pass that
around.

Change-Id: If91dc589ea1e476da105b58846d1c3e720a439e1
2021-07-23 13:35:22 +02:00
Pau Espin c8edaad0bf Split bts_vty.c creating bts_trx_vty.c
Change-Id: I15ec8f71a5d31915162cb3ad75ea77e934fa4887
2021-07-23 13:35:04 +02:00
Pau Espin e19289fb89 Split bsc_vty.c creating bts_vty.c
Change-Id: I347e7da328fed0733af2eec10a3ca6e02a148308
2021-07-22 17:26:56 +00:00
Daniel Willmann b2b47d2c47 bts: Clear BTS_STAT_CHAN_*_{TOTAL,USED} on bts disconnect
Adds gsm_bts_stats_reset() to clear the stats and calls it from the
different models.

Change-Id: Ic42687cd73e3546edaa99fb1268a5960ffa43b12
Related: SYS#5541
2021-07-22 15:45:24 +00:00
Neels Hofmeyr 0c2d98e0c4 RES IND: tweak error code on missing Resource Information IE
If the RES IND message is invalid, let's not return ENOENT which
translates to "No such file or directory", instead return EINVAL.

Related: SYS#5313
Change-Id: Ifd700e90c881874d428f2860603a4ddbf13d705e
2021-07-22 12:15:36 +00:00
Neels Hofmeyr a46cd05e93 RES IND: allow empty Resource Information IE
If all channels of a BTS are in use and there are no interference
ratings to be reported, the Resource Information IE may be empty. Do not
log this as an error, it is not something that needs operator attention.

Related: SYS#5313
Change-Id: I75b851ef1269674f43db3fb3a48518e76182d7f0
2021-07-22 12:15:36 +00:00
Pau Espin df420dbe74 Fix recent regression in CHREQ allocation
Recent commit introduces a silly bug when changing code. Fixing it now.

Fixes: fdb87343d7
Change-Id: I1e8027a3933c3c8450e76e1325d0f7c28a89a6d1
2021-07-22 13:26:37 +02:00
Pau Espin 7801bbae82 abis_rsl: Log chan rqd reason on resource exhaustion log message
This allows better understanding which of use is exhausting channels
when there a lot of load.

Change-Id: Ic68162c2d52df07b05c76374e2a92148b9a7ccd5
2021-07-21 13:58:27 +02:00
Pau Espin 4b2feb605b lchan_fsm: Allow rx LCHAN_EV_RLL_REL_IND in state BORKEN
As seen in osmo-bsc log:
DCHAN ERROR abis_rsl.c:2287 lchan(12-0-2-TCH_H-1){BORKEN}: Event LCHAN_EV_RLL_REL_IND not permitted

Related: SYS#5523
Change-Id: Idc7796d41f3483c89559746d9a00fdf32bf67c57
2021-07-20 10:07:17 +00:00
Pau Espin ce869c6baa _select_sdcch_for_call: Avoid 2nd lchan lookup when finally selecting it
We already looked it up, it's not necessary to look it up again by
calling lchan_select_by_type(). Let's instead call
lchan_select_set_type() directly on the lchan pointer.

Related: SYS#5309
Change-Id: I1054c18f58c9e249f263e3e97a365a1fd8b03a93
2021-07-20 10:07:03 +00:00
Pau Espin 2956b52c5b Add new lchan_select_set_type() API helper
It's an easy helper, but it helps in standarizing and finding similar
places in code.
Morevoer, it will be used in follow-up commit where we first use
lchan_avail_by_type and finally we select it in a later stage.

Change-Id: I025a40962a5e5d40543b297a0760e47618fb525c
2021-07-20 10:07:03 +00:00
Philipp Maier 181b5f3b9a handover_ctrl: add control interface for handover settings
The VTY handover_vtc.c offers a large number of handover specific
settings. Those settings are (with one exception) auto generated using
macros. Lets add an equivalent for the control interface that uses the
same auto generation mechanisms.

Change-Id: I12f143906818fd6b16e8783157cbb1eb51e49ffc
Depends: libosmocore I53fc207677f52b1dc748b01d58424839cdba807c
Related: SYS#5369
2021-07-19 10:44:05 +02:00
Neels Hofmeyr 8ce07d021f extend test_dyn_ts_favor_half_used_tch_h_as_target.ho_vty
Clarify that filling half-used TCH/H first only happens on dynamic
timeslots, not static ones.

Related: SYS#5313
Change-Id: I5213459fb7fb201361ce0d6198fc0c2c745deee1
2021-07-16 16:04:18 +00:00
Neels Hofmeyr ea0b6b2ca9 add test_dyn_ts_favor_static_ts_as_target.ho_vty
In a discussion about the effect of interference levels, I noticed that
there is not sufficient clarity about how strongly the preference of
static timeslots is ranked. This test helps to show what we have.

Related: SYS#5313
Change-Id: I0911cd74613045d9fbe29d04eaef036d32049b92
2021-07-16 16:04:18 +00:00
Neels Hofmeyr 9c61446423 vty 'interference-meas level-bounds': explain duality in ordering
Related: SYS#5313
Change-Id: If71e20e95d29e7f03739ee04e1ef429bf8bd51ed
2021-07-16 16:04:18 +00:00
Neels Hofmeyr ae0b737c62 separate 'interference-meas level-bounds' cfg and used
The VTY defun already indicates BSC_VTY_ATTR_RESTART_ABIS_OML_LINK
correctly, but so far we would immediately start using the new values
internally, and wrongly interpret interference levels. Fix that.

Have bts->interf_meas_params twice: interf_meas_params_cfg for the VTY
configured values, and interf_meas_params_used for the values that the
BTS actually knows about, after they were sent via OML.

In a running BSC, when changing the interference level boundaries on the
telnet VTY, the BTS is not immediately told about the change. That would
require a BTS restart. Hence store the cfg values separately in
interf_meas_params_cfg. For comparing/printing interference levels in a
running BTS, only employ the values that were actually sent via OML and
placed in interf_meas_params_used.

Related: SYS#5313
Change-Id: Iad8cf4151ff7f86dc0549158ed5d91d788d40b1f
2021-07-16 16:04:18 +00:00
Pau Espin 71b4f94601 cosmetic: Small improvements to _select_sdcch_for_call
This commit improves some cosmetic and logical aspects from recent
commit (see "Fixes" below).

* Fix typo s/free_tcch/free_tchh/"
* Improve some comments

Fixes: fdb87343d7
Change-Id: Id6217c929068b0182cb2d4a9922bfbf544c8c75d
2021-07-15 12:54:06 +02:00
Neels Hofmeyr be32e93513 hodec2: add low-rxqual-assignment penalty timer (2/2)
Hold off re-assignment after an intra-cell re-assignment due to low
rxqual.

Adjust test_amr_tch_h_to_f_rxqual.ho_vty to show the changed behaviour.

Related: SYS#5198
Change-Id: Id00a07313fe04eec509b336c0637b59c707760e0
2021-07-15 09:28:18 +00:00
Neels Hofmeyr 12d80e8945 hodec2: add low-rxqual-assignment penalty timer (1/2)
First add a handover test script that shows the behavior without the
low-rxqual-assignment penalty timer implemented. When implemented, the
changes to this test script will show the change in behavior.

Related: SYS#5198
Change-Id: I799fce709c86401546ccfe41b9f57fd579bcd987
2021-07-15 09:28:18 +00:00
Neels Hofmeyr b4176e5200 handover tests: test passing of penalty timeout
With recent addition of fake time in handover_test ('wait cmd'), show
how a penalty timeout in handover decision 2 passes and allows a
handover again after due time.

Related: SYS#5198
Change-Id: I65e59cc7309778cf9d71612669ce84d101c8135e
2021-07-15 09:28:18 +00:00
Neels Hofmeyr cc845feb12 test_penalty_timer.ho_vty: show lchan recovery
Use recently added fake-time 'wait' command to show how the lchan in
LCHAN_ST_WAIT_AFTER_ERROR recovers as soon as timer X3111 has passed.

This prepares for also waiting for the penalty timeout to pass.

Related: SYS#5198
Change-Id: I8f7668b6d08a0dac9e90d2358955f9d5099d39fa
2021-07-15 09:28:18 +00:00
Neels Hofmeyr b55ff05eb8 handover_test: add fake-time 'wait'
Add a 'wait' cmd that lets (fake) time pass.

An ucoming patch will show the
first use of this: "test_penalty_timer.ho_vty: show lchan recovery"
I8f7668b6d08a0dac9e90d2358955f9d5099d39fa

My actual original reason to add this follows in patches
- "handover tests: test passing of penalty timeout"
  I65e59cc7309778cf9d71612669ce84d101c8135e
- "hodec2: add low-rxqual-assignment penalty timer (2/2)"
  Id00a07313fe04eec509b336c0637b59c707760e0

Related: SYS#5198
Change-Id: Ia6b5696adef7e7bf649473b4d79b96acf3aa59e3
2021-07-15 09:28:18 +00:00
Neels Hofmeyr 70d08b00ab switch handover penalty timers to CLOCK_MONOTONIC
To be able to add a fake time to handover tests, the penalty timers need
to use an osmo_* time source.

There already is a fixme comment rightfully asking for a monotonic
clock, so this change is overdue anyway.

An upcoming patch will prove that this works:
"handover tests: test passing of penalty timeout"
I65e59cc7309778cf9d71612669ce84d101c8135e

Related: SYS#5198
Change-Id: Ifb1ab3165db50511aed4f65aa445798367d7e19e
2021-07-15 09:28:18 +00:00
Neels Hofmeyr 1d9e758e76 handover_test: also show when an lchan is busy
In expect-ts-use, indicate a busy lchan with letter '!'.

The code is a bit complex because of the choice made earlier to show two
TCH/H subslots as "TCH/HH", "TCH/H-" or "TCH/-H" depending on the
subslot states:
- show "-" as a shorthand for "all subslots UNUSED"
- show a "TCH/" prefix only when there is any "H" or "F" following, i.e.
  when any subslot is actually established
- if a subslot is busy (any other state besides ESTABLISHED and UNUSED),
  indicate the subslot as '!'.

The spectrum of reported state strings for TCH/F is:

 TCH/F  !  -

For TCH/H:

 TCH/HH TCH/H- TCH/-H TCH/H! TCH/!H !- -! -

The only current test affected is test_penalty_timer.ho_vty, where a
failed handover leaves an lchan in LCHAN_ST_WAIT_AFTER_ERROR. Adjust
that test.

Rationale: I will soon add tests to verify the accurate timeout of a
handover2 penalty timer. While implementing, I noticed that immediate
retry of the handover ends up in timeslot 2, because timeslot 1 is still
in WAIT_AFTER_ERROR. Instead of working around that, I would like to
explicitly show the error state in the test -- it is an important
aspect.

Related: SYS#5198
Change-Id: I735ce7e2c3e0e450d3f76047d7e47691fe889cad
2021-07-15 09:28:18 +00:00
Neels Hofmeyr 71526043ea ensure trigger_ho() returns zero only when HO or AS was indeed triggered
In an upcoming patch, handover_decision_2.c will use this indicator to
decide whether to start a penalty timer:
"hodec2: add low-rxqual-assignment penalty timer (2/2)"
Id00a07313fe04eec509b336c0637b59c707760e0

Related: SYS#5198
Change-Id: I5de385e0666f716184a62e6e70d656545ac5d2ee
2021-07-15 09:28:18 +00:00
Pau Espin fdb87343d7 Avoid switching dyn ts to sdcch8 if it starves later TCH
In case an MS requests a channel to establish a voice call, we usuually
try to assign an SDCCH to negotiate the call and finally make the MS
switch to a TCH. However, it doesn't make much sense to provoke a switch
of a dynamic TS into SDCCH8 if that would mean we end up with no TS
available for TCH at the next step close in time. In that case, we are
better assigning the TCH directly so that the full call can be
established successfully.

Related: SYS#5309
Change-Id: I3b32968949a7bdcbebf5a823359295bac51d8e08
2021-07-14 13:49:15 +00:00
Philipp Maier cb0786365c bsc_vty: add vty option to allow call-reestablishment
The rach control parameter value that controls the usage of
call-reestablishment is currently hardcoded. Lets add a VTY option for
this so that we are able to configure call-reestablishment

Change-Id: Ia18c1dde4c001cb4d423f694f8bc146adfd77daf
Related: SYS#5130
2021-07-13 10:41:58 +00:00
Vadim Yanitskiy dfd7bef664 lchan_fsm: fix potential NULL-pointer dereference
Change-Id: I373855b95f8bde0ce8f9c2ae7bf95c9135d33484
Related: SYS#5526
2021-07-12 18:05:42 +02:00
Oliver Smith e0c62bb9bd handover_test: fix ts_str may be uninitialized
Fix for:
  handover_test.c: In function 'res_ind':
  handover_test.c:1094:30: error: 'ts_str' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       char subslot_val = ts_str[lchan->nr];

Fixes: f76424 ("RES IND: add test_resource_indication.ho_vty")
Change-Id: I398ba24b945bad96896eeb5ddbaff9c48bacf8ab
2021-07-12 10:28:35 +02:00
Neels Hofmeyr 5ac7075643 RES IND: pick lchan with least interference
In lchan_select, do not return on the first available lchan, but iterate
through all available lchans. Among those that would match, pick the one
with the lowest interference level as indicated by earlier RES IND.

Lchans that have no interference ratings are picked last.

This feature is off by default, enable per BTS with

 network
  bts N
   channel allocator avoid-interference 1

osmo-bsc still does the same ascending/descending lchan allocation as
before this patch with the default setting of:

   channel allocator avoid-interference 0

Related: SYS#5313
Change-Id: I844494092193811dfd9fa4d52983cbaed0fc9248
2021-07-11 21:14:51 +02:00
Neels Hofmeyr f764248b03 RES IND: add test_resource_indication.ho_vty
Show that osmo-bsc does not yet take Resource Indication's reported
interference levels into account. (An upcoming patch will change that.)

This test is not actually doing any handover, but it is using the
handover/*.ho_vty scripting that was intended for handover testing.
(Like test_dyn_ts_favor_half_used_tch_h_as_target.ho_vty does.)

Related: SYS#5313
Change-Id: I56ec61196a1e103f0b4caf18d25d8222bb82cf87
2021-07-11 20:48:36 +02:00
Neels Hofmeyr c8cd61ddf2 RES IND: add VTY: bts / channel allocator avoid-interference (0|1)
Store the config option whether the channel allocator should try to
avoid lchans with higher interference levels reported in RES IND.

The actual implementation of avoiding interference follows in
I844494092193811dfd9fa4d52983cbaed0fc9248

Related: SYS#5313
Change-Id: I8b62d0b41ad9e908b27713db9219e3dbc1ebaab7
2021-07-11 20:31:41 +02:00