Commit Graph

1752 Commits

Author SHA1 Message Date
Philipp Maier 5562475e7c assignment_fsm: Check for conn->lchan
When the SDCCH gets released while the TCH still beeing activated, then
the ChanActivACK that is received after the TCH is activated will trigger
a segmentation fault in the assignment_fsm. The reason for this is that
conn->lchan, which holds the SDCCH at that point in time, is now NULL.

To prevent osmo-bsc from crashing, the FSM should check for the presence
of conn->lchan first. If it does not exist, the FSM should terminate.
(Assignment failed)

Change-Id: I3b1cd88bea62ef0032f6c035bac95d3df9fdca7a
Related: SYS#5627
2021-10-12 16:24:26 +03:00
Vadim Yanitskiy 3991ae5b87 abis_nm: enrich debug messages with contextual info
Change-Id: I68f64e6cae061a49733c4885ba383d2b9b4cfca9
2021-02-20 23:24:09 +01:00
Keith Whyte e4b52dff39 Disallow changing the type of an existing BTS from the vty
Changing the BTS type is not supported, so don't allow it.

For example, Changing from type sysmobts to type rbs2000
may hit an OSMO_ASSERT in om2k_bts_fsm_alloc()

The default BTS type if osmo-bsc is started with an empty
configuration and the operator issues config terminal->network->bts 0
will be "unknown". This type and only this type can be
changed from the vty config node.

Change-Id: I0df97ef128a1bbd84c787654d1d842dce4dad819
2021-02-19 08:29:32 +01:00
Pau Espin Pedrol cdbd7e3bf2 SI13: Enable sending GPRS Cell Options Extension Information on GPRS-only BTS
The EGPRS bits are anyway conditionally enabled by egprs_supported.

Change-Id: Ie7a438419eb416ce3d29794febab5f952661e5c5
2021-02-18 00:56:13 +00:00
Michael Iedema 456a962c7e stats: add SIGN/SPEECH assignment subcategories
Change-Id: I73f4dab6edb0951180f2bbcfc352ff34de647679
2021-02-17 15:13:25 +00:00
Pau Espin Pedrol 0cfed38f07 Fix neigh resolution service on local neighbours
Change-Id: I217e3550aa6d7f3c3cab4e545641d790ae12b23f
Related: SYS#4909
2021-02-13 08:15:01 +00:00
Pau Espin Pedrol a27e8a5c9a Move bts_ident_key to neighbor_ident.c
The function is not really handover specific, and will be used in other
places in subsequent patches.

Change-Id: Icae8b9045e497f850f22cb3b6f93acbf61b84746
2021-02-13 08:15:01 +00:00
Philipp Maier a2f21b3bc4 bsc_vty: mark repeat rxqual 4 (BER >= 1.6) as default
Change-Id: Iecc2395efab703cf3de8f8e16b9e4bc8c8baf260
Related: SYS#5114
2021-02-11 12:45:36 +01:00
Pau Espin Pedrol d01bc3e4c7 Introduce VTY cmd to configure Alpha in SI13
Related: SYS#5358
Change-Id: I8b97ea11bad5fe05f2f634945b5703ee9abde81d
2021-02-09 13:31:48 +01:00
Harald Welte c72c853a96 hide the "smscb-command" vty command; people should use osmo-cbc
Many years prior to the implementation of osmo-cbc, we introduced
a way how raw RSL SMSCB COMMANMD can be injected from the VTY.

These days, people should use the CBSP interface with osmo-cbc or any
other CBC.  We should not advertise the VTY command hack
as a standard feature anymore.

Change-Id: If5ddc3db989763a1f47d4cbc026e293e3134d8ef
Related: OS#4753
2021-02-08 17:21:20 +00:00
Vadim Yanitskiy ea8d6939e6 power_control: make P_CON_INTERVAL parameter configurable
Change-Id: I6e0fae81cc60f708e49d5eb8dfc0bbcad926b18f
Related: SYS#4918
2021-02-07 19:20:12 +01:00
Vadim Yanitskiy e1d2691e69 power_control: enable Uplink DPC by default if format is known
So far osmo-bsc would enable Uplink DPC (Dynamic Power Control) only
for osmo-bts, and the 'static' mode for all other BTS models.  This
decision dates back to the time when ip.access specific encoding for
dynamic power control parameters was not implemented, and the MS
Power Parameters IE was sent empty in the RSL messages.

Let's make a step forward by enabling Uplink DPC by default for
all BTS models which declare the API for vendor-specific encoding
of the power control parameters.  Currently this includes osmo-bts
and nanoBTS, both supporting ip.access specific format.

Change-Id: If86d27d4332af3d82f862737340d061e42e34eba
Related: SYS#4918
2021-02-07 04:38:15 +01:00
Vadim Yanitskiy d5a03a59b0 power_control: check BTS model in cfg_power_ctrl_avg_osmo_ewma()
Change-Id: I1c454f447d37cbc4d44b242dc4b2c62297ee3f67
Related: SYS#4918
2021-02-06 20:19:38 +01:00
Neels Hofmeyr b03e73f27b lchan activation: indicate whether TA is known
On lchan activation, we already know the Timing Advance in most
situations: from the Channel Request RACH, or from a previous lchan in
the same cell. Place this information in lchan->activate.info.ta.

So far, the lchan->last_ta (until recently called rqd_ta) was used to
store the initial TA for channel activation -- move the initial TA to
lchan->activate.info.ta, for proper scoping.

Only an inter-cell handover does not yet know a Timing Advance (until
the Handover Detection RACH is received), so indicate
activate.info.ta_known = false for that case.

If ta_known is false, do not include an Access Delay IE in the Channel
Activation message, ensuring that the BTS does not use an arbitrary TA
that is likely inaccurate.

The effect for OsmoBTS is that we will *not* start the downlink SACCH on
channel activation for inter-cell handover, but will wait for a HO RACH
first, and then use the correct TA when enabling downlink SACCH.

Related: OS#4008 SYS#5192
Change-Id: I986bf93e8acd6aef7eaf63ac962480b680aa894f
2021-02-05 20:24:43 +01:00
Neels Hofmeyr 980a28fdcb rename lchan->rqd_ta to last_ta
Originally, the lchan stored only the Timing Advance from the initial
channel request, hence it was called rqd_ta.

Since quite a while now, rqd_ta also stores the most recent Timing
Advance from each received Measurement Report. So rename to last_ta.

This is cosmetic preparation for an upcoming patch that clarifies
whether the Timing Advance is already known for Channel Activation.

Change-Id: I1049526a173819baeb4978db5bf018ba3f1006a0
2021-02-05 20:24:43 +01:00
Neels Hofmeyr 71b1bc4964 lchan assignment when RTP is set up: don't break on Mode Modify
Change-Id: I06d3f35fcc71d77e1f30c2b15ab221ef7d5f7f27
2021-02-05 20:24:40 +01:00
Michael Iedema 9a66b3f200 cosmetic: shorten deref chains where possible
Change-Id: Ic42db1a2d768c8ee7e07406ac5f77af757e52cdb
2021-02-04 20:25:52 +00:00
Vadim Yanitskiy e511c99052 assignment_fsm: assert the result of conn_get_bts()
Change-Id: I036f2d895e3569bd050ce574759f8371bd19cec9
Fixes: CID#216933
2021-02-04 14:22:50 +01:00
Harald Welte f1c82b8e12 BS-11: Send proprietary MRPCI message after assignment + HO complete
This is a non-standard RSL message that must be sent after each traffic
channel has been established.  Without it, any voice call will be
disconnected within seconds.

This is a hack; we need to store the subscribers classmark2 value and
use it here.

Change-Id: I6cb6d25e405aa888c4df4022d897330a6af9e946
Related: OS#2389
2021-02-03 08:50:07 +00:00
Neels Hofmeyr b4364a4adc hodec2: fix intra-cell congestion balancing with source lchan on dyn TS
Related: SYS#5301
Change-Id: I332477cbddf32cf6f057007b45cda8477227f0b1
2021-02-02 21:53:53 +01:00
Pau Espin Pedrol 1475aac8ed Allow configuring SI13 CCN_ACTIVE bit from VTY, enable by default on osmo-bts
This is required in order to tell MS that osmo-pcu now supports
Network Assisted Cell Change (NACC).

Other BTS are not enabled by default since NACC support is not known to
work nor tested there.

Depends: libosmocore.git Change-Id I61991266b95d0c13d51b47906cc07846e9cf1390
Related: SYS#4909
Change-Id: If91d85331d402c3ab9c32b70c2c66cd7ba6ceb28
2021-01-30 19:16:18 +00:00
Michael Iedema e3d0b93986 stats: Add granularity to chan:rf_fail stat.
Add additional counters to track TCH and SDCCH RF failures in separate subcategories.

Change-Id: I91fe6659fe9df33763f4070b4f505561b2005d38
2021-01-30 14:15:16 +00:00
Harald Welte 5e01039d79 select_best_cipher(): Prefer A5/1 over A5/2
We cannot simply use the highest 'x' in A5/x codecs.

For A5/7 through A5/3, larger 'x' means better.
But: A5/1 is better than A5/2, so we need to prefer the former
over the latter.

Change-Id: I399fff8d07d1bfcbc6b385e90914ff6d9e00eb73
Closes: OS#4975
2021-01-29 21:24:36 +00:00
Pau Espin f4db24c731 cosmetic: bts-sysmo: Fix whitespace indentation
Change-Id: Ia4594d8a98aee19f14e75449cfdfdc0fbcaf6e9f
2021-01-29 17:10:31 +01:00
Philipp Maier 80184ae171 abis_rsl: check if emergency calling is disabled before premption
If an emergency call arrives at the BSC while all TCH are busy, one TCH
is cleared in favor of the emergency call. However, if emergency calls
are disabled (system information), it is still possible that an MS might
try an emergency call anyway or that due to interference a regular call
might look like an emergency call (channel request reason). In those
cases the preemption must not happen and the emergency call must be
rejected.

Change-Id: I1af1f4fefcbe6a886bb5396901ce0cb2368a0e19
Related: OS#4976
2021-01-26 22:42:06 +01:00
Philipp Maier 20a90a9b86 bsc_vty: fix acch_repetition ber threshold strings
When setting the BER threshold for ACCH repetition the VTY displays
wrong threshold values in the online help.

Change-Id: I4c89ad130da328aba99663e5a2931a4007772bca
Related: SYS#5114
2021-01-22 20:46:48 +00:00
Neels Hofmeyr f7e25a1010 hodec2: fix congestion balancing on dyn TS
When balancing congestion, not only look at TCH/F or TCH/H separately,
but also to take into account the effects on the other TCH kind from
using/freeing dynamic TS.

Related: OS#5298
Change-Id: I433df6f343650f9056b1bab926bc19ac1d867ad5
2021-01-19 11:49:07 +01:00
Neels Hofmeyr 2eeef70310 lchan_avail(): omit logging for handover decision 2
Add bool log argument to lchan_avail_by_type() and omit logging when
passed as false. From handover_decision_2.c, pass 'log' as false, from
all other callers pass true, i.e. for unchanged behavior.

Rationale:

Usually, we use lchan_avail_by_type() to select a new lchan to initiate
actual service. For that, it is interesting to see how osmo-bsc decides
which lchan will be used.

For handover decision 2, we since recently call lchan_avail_by_type()
for each and every handover candidate, to determine whether it will
occupy a dynamic timeslot or not (to know whether we would congest the
other TCH kind). So this happens for each permutation of source lchan
and target cell. That produces a lot of logging, out of proportion of
being useful to the maintainer.

Change-Id: Ia403f8fc853ca9ea9e81f7a7395df6b23845ebed
2021-01-19 11:49:07 +01:00
Neels Hofmeyr 3025e69814 hodec2: fix congestion resolution on dyn TS
For handover algorithm 2, properly figure out what effects the target
cell will see for the *other* TCH kind when a handover would occupy a
dynamic timeslot.

Before this, only TCH/F or TCH/H would be regarded at a time. This
introduces detection of whether a dynamic timeslot would be occupied by
a handover, and how losing one unused dynamic timeslot affects the
congestion situation for the TCH kind that is not targeted by the
handover.

In other words, if a handover to TCH/F causes congestion in TCH/H
because of a dynamic timeslot becoming occupied, the handover will not
be performed. Before this, oscillation situations could occur.

A subsequent patch will do the same for congestion balancing.

Related: SYS#5297
Change-Id: I1536b60f03cb0aeb6ba14a72b518aec82fa572fe
2021-01-19 11:49:07 +01:00
Michael Iedema e42208c6ea stats: Add granularity to SDCCH/TCH/LU activity.
Change-Id: I4df275e4770c5ff3643c79ba828e736986f8bb47
2021-01-18 10:59:02 +00:00
Vadim Yanitskiy d2e0654ee4 gsm_data: return early if MS Power class remains the same
The following message makes no sense:

  DRLL DEBUG gsm_data.c:844 MS Power class update: 4 -> 4

because nothing really changed, MS Power class remains 4.  Neither
it makes sense to call lchan_update_ms_power_ctrl_level().

Change-Id: I519d2d1575cbb5352cc381a60513db8e0e2cb0a0
2021-01-15 22:55:48 +01:00
Vadim Yanitskiy 259e797a8a vty: fix 'codec-list' command: check all given arguments first
Allocating a new list of supported codecs *before* checking the
command arguments is a bad idea.  The operator may simply mistype
one of the codecs and will end up with a list of NULL pointers.

The functions calling audio_support_to_gsm88() assume that this
list always does contain valid pointers, so if a new subscriber
connection gets established, or the operator simply invokes
'show running-config', osmo-bsc would crash due to NULL pointer
dereference.

Steps to reproduce:

  1. In the VTY, do: 'en' -> 'configure terminal' -> 'msc';
  2. Configure any invalid codec list, e.g. 'codec-list Boom!';
  3. Invoke 'show running-config', boom!

Let's check the input before changing the internal structures.

Change-Id: I35b740a39c9cf3716d286e717486ef505bc61522
Fixes: OS#4946
2021-01-14 20:47:09 +00:00
Vadim Yanitskiy f5c8034bb7 power_control: fix: properly initialize per-lchan BS power
My assumption that lchan_reset() is called on CHANnel ACTIVation
was wrong - it's actually called on CHANnel RELease.  Therefore
(re)setting per-lchan BS power value must be done in the other
function that is responsible for channel activation.

Change-Id: I056c448ce017458dc4a004374ddca86d44dc35b4
Related: SYS#4918
2021-01-14 17:37:16 +01:00
Vadim Yanitskiy cbf1b931f2 vty: fix writing empty IP address for unconfigured NSVCs
config_write_bts_gprs() currently writes the remote address of an
NSVC even if osmo_sockaddr_str_from_sockaddr() returns non-zero
code.  Thus saving a configuration with only one configured NSVC
to a file would produce the following:

 bts N
  ...
  gprs nsvc 0 nsvci 101
  gprs nsvc 0 local udp port 23023
  gprs nsvc 0 remote ip 127.0.0.1
  gprs nsvc 0 remote udp port 23000
  gprs nsvc 1 nsvci 0
  gprs nsvc 1 local udp port 0
  gprs nsvc 1 remote ip

and next time osmo-bsc would refuse to start due to:

 Error occurred during reading the below line:
  gprs nsvc 1 remote ip

The related condition consists of the following two parts:

  - checking if osmo_sockaddr_str_from_sockaddr() != 0;
  - checking if 'remote.af != AF_UNSPEC'.

The first one is wrong, because osmo_sockaddr_str_from_sockaddr(),
like many other functions, returns 0 on success.  Let's fix this.

After the fix, the second part does not seem to make sense, because
remote.af would remain AF_UNSPEC (0) if the function call succeeds.

Printing the remote port alone does not make sense, let's avoid
printing it if the address cannot be parsed into a string.

Change-Id: I5d6cbde4f605c8184db4ade87de5644a849c05db
Fixes: I621360cab1e12c22248e33d62a9929995053ce04
2021-01-14 12:29:26 +00:00
Vadim Yanitskiy df1affded8 vty: use 'const' for *nsvc in config_write_bts_gprs()
Change-Id: I869944cc692c7954b2862ecff32c6034d20babef
2021-01-14 12:29:26 +00:00
Neels Hofmeyr 8e830dd136 hodec2: to balance congestion, use overload percent
For balancing load across congested cells and across congested TCH/*
kinds, instead of comparing the number of lchans above the configured
congestion threshold, compare the percent of lchans of overload.

In short, using a percentage prevents cells with less min-free-slots to
fill up 100% while neighbor cells still may have several free lchans
available.

An obvious example of why this is desirable is illustrated by
test_balance_congestion_by_percentage.ho_vty:

Cell A has min-free-slots 2, and has all slots occupied.
Cell B has min-free-slots 4, and has 2 slots remaining free.

If we count congested lchans as in current master: cell A has a
congestion count of 2: two more lchans in use than "allowed". If we move
one lchan over to cell B, it ends up with a congestion count of 3, which
is worse than 2. So when counting lchans, we decide that cell A should
remain full.

Instead, when comparing percentage of remaining lchans, we would see
that cell A is loaded 100% above congestion (2 of 2 remaining lchans in
use), but when moving one lchan to cell B, that would only be 75% loaded
above its treshold (3 of 4 remaining lchans in use). So a percentage
comparison would cause a handover to cell B.

Related: SYS#5259
Change-Id: I55234c6c99eb02ceee52be0d7388bea14304930f
2021-01-14 06:24:57 +00:00
Pau Espin Pedrol 55a015dddf Introduce Neighbor Resolution Service
This new CTRL interface allows users of this BSC (such as attached PCU)
to gather neighbor information.

This interface is needed for PCU to translate ARFCN+BSIC keys provided
by MS in the Um side into CGI + RAC keys used to identify target cells
in RIM procedures against SGSNs on the Gb interface.

This patch extends the already existing neighbor information storage in
the VTY by allowing storage of CGI + RAC (RAC couldn't be stored
beforehand).

Related: SYS#4909
Depends: libosmocore.git Change-Id If48f412c32e8e5a3e604a78d12b74787a4786374
Change-Id: Ib07c9d23026332a207d4b7a0f7b4e76c0094e379
2021-01-13 17:14:09 +01:00
Neels Hofmeyr 0096f27b61 hodec2: fix congestion oscillation bug
When evenly distributing congestion across cells, count the number of
occupied lchans surpassing congestion, and not the overall number of
free lchans -- which disregards congestion thresholds.

Fix the bugs shown by
 test_congestion_no_oscillation.ho_vty
 test_balance_congestion_tchf_tchh.ho_vty

This implements a simple calculation for congestion load by counting
lchans in use above congestion. An improvement of this calculation
using percent follows in I55234c6c99eb02ceee52be0d7388bea14304930f.

Related: SYS#5259
Change-Id: Icb373dc6bfc9819446db5e96f71921781fe2026d
2021-01-12 09:36:12 +01:00
Neels Hofmeyr d946e5b280 hodec2: add ho_candidate.{current,target}.free_tch
Store the number of free lchans and the min-free-slots settings in
ho_candidate, instead of figuring those out in various places, to make
it easier to read.

Prepare for upcoming patch which also requires these values to fix a
bug.

Change-Id: Ie6ca5af5e8d0ebb8deaaaa637e2728008ecba517
2021-01-12 08:30:15 +00:00
Neels Hofmeyr 1dc9a7f53d hodec2: reduce check_requirements() args
Instead of passing single args, pass the ho_candidate struct.

No functional change.

Change-Id: I086aef9cc47ad8a5376f18179024c486f6f8b779
2021-01-12 08:30:15 +00:00
Neels Hofmeyr d4f8a8bca1 hodec2: cosmetic: clarify ho_candidate.{current,target}
So far it is often confusing which cell a specific member refers to.
Clarify lchan, bts, ... to current.lchan, target.bts, ...

Also move the rxlev_{current,target} to {current,target}.rxlev.

Eliminate numerous local variables to make it easier to read which side
is being used (e.g. "c->target.bts" instead of just "bts").

No functional change.

Change-Id: I06898eb745a5be548df0b76fa760ce790cfab3ed
2021-01-12 08:30:15 +00:00
Vadim Yanitskiy 0a2541c3c3 power_control: add increase / reduce step size recommendations
Change-Id: I82e762c0c2b5e0dd739850ee494ab0a798e353de
Related: SYS#4918
2021-01-12 08:27:52 +00:00
Neels Hofmeyr 3f1c43e74b hodec2: fix candidate choices in congestion check
Fix flaws in picking a candidate for congestion resolution, shown in
recently added tests.

- For TCH/H->TCH/F upgrading, do not favor moving to a weaker neighbor
  cell.

- When comparing dynamic timeslots on the same cell, favor a dynamic
  timeslot that frees an entire dyn TS even though the target rxlev
  differs.

Do not separate the passes for inter-cell and intra-cell candidates:
before, the inter-cell pass would already pick a candidate and start
handover, even though the subsequent intra-cell pass would have revealed
a better candidate. Join the intra-cell considerations into
pick_better_lchan_to_move().

The intra-cell pass was separate, because it would find the *weakest*
current rxlev, to give a TCH/H to TCH/F upgrade to the currently weakest
lchan.

Instead of the separate pass for weakest rxlev, in addition to the
target cell's rxlev, also consider the rxlev *change* in
pick_better_lchan_to_move(): For candidates that do not change the rxlev
(usually those that stay in the same cell) and that upgrade to TCH/F,
favor a candidate with weaker current rxlev.

Completely revisit the conditions in pick_better_lchan_to_move() to
yield the desired prioritization of candidate preferences.

In three handover tests, remove the "FAIL" comments and adjust to now
expect the actually desired behavior.

Related: SYS#5032
Change-Id: I2704899c85c35dfd4eba43468452483f40016ca2
2021-01-11 14:35:34 +00:00
Neels Hofmeyr 305f21f9dc hodec2: cosmetic: clarify afs_bias, simplify pick_better_lchan_to_move()
Instead of passing the TCH/H -> TCH/F bias (AFS bias) in local
variables, rather store it in the ho_candidate struct next to the other
rxlev related values.

Add the AFS bias to the compared rxlev in pick_better_lchan_to_move().

Modify pick_better_lchan_to_move() to simpler semantics of returning
either a or b.

No functional change.

Change-Id: I73860abdf2a77270ca4851ad58c09767d1bb08f1
2021-01-05 23:27:26 +01:00
Neels Hofmeyr 0c01ab6cbb hodec2: clarify current and target rxlev per candidate
Store the rxlev of the current lchan and the target BTS in the
ho_candidate, to clarify the code.

No functional change, cosmetically prepare for
I2704899c85c35dfd4eba43468452483f40016ca2.

Change-Id: Ie6c165e17bb3c99eebc967a6bb02529db8bdfc98
2021-01-05 23:27:26 +01:00
Neels Hofmeyr d15d672427 hodec2: code dup / cosmetics
In handover_decision_2.c, instead of repeating a similar loop four
times, put that loop in a function and parameterize it.

Prepare for a fix of two problems in handover decision 2, see
I2704899c85c35dfd4eba43468452483f40016ca2.

Change-Id: I7c32d08e490a88a7f044b0a71dc4b07d748dd572
2021-01-05 23:27:26 +01:00
Neels Hofmeyr 23da99ddda hodec2: cosmetic: add dBm unit to rxval logging
Change-Id: I58a5ae721b674576339360b1f03e91b015a1bf46
2021-01-05 23:27:26 +01:00
Vadim Yanitskiy c137152947 ericsson_rbs2000: fix unreachable code in inp_sig_cb()
Change-Id: I20674945ddb80ceb1a1917e1be8572595764b370
Fixes: CID#215885
2021-01-05 12:20:13 +01:00
Harald Welte 71a21477fd smscb: Fix adding of SMSCB messages when no message with lower period exists
Adding SMSCB messages to a BTS so far only worked if there were
existing messages with a lower scheduling period than the new message.

Before this patch, it fails for new messages if they are of equal or
lower scheduling period than the existing messages.

Change-Id: I69a05b22200b3a1ee406b0673553e135603d723b
2021-01-04 21:48:03 +00:00
Vadim Yanitskiy a95a1e6783 vty: fix wrong attributes for UL/DL ACCH repetition commands
None of those commands apply immediately, they only affect newly
established logical channels.  The reason is that the related
IEs are only getting sent on channel activation / assignment.

Change-Id: I06c7851115fb31d1eb92c400d9724f4f051bd171
Related: SYS#5114
2021-01-04 11:53:13 +01:00