Commit Graph

830 Commits

Author SHA1 Message Date
Neels Hofmeyr 9607d09203 cosmetic: rename lchan_activate_mode to lchan_activate_for
In subsequent patches, I will add enum lchan_modify_for and enum
assignment_for, I prefer to have similar lchan_activate_for naming.

Change-Id: Ia4420fcd1234dbee92e768e5a32eab13fba29ea9
2021-05-21 15:43:30 +02:00
Neels Hofmeyr 794e1281d8 cosmetic: rename FOR_* to ACTIVATE_FOR_*
Soon, there will also be enums with ASSIGNMENT_FOR_* and MODIFY_FOR_*
naming. Add the ACTIVATE_ prefix to the existing enum to clarify.

Change-Id: I12190d4d154a1da6a9ebc9a755ccc2fe382ff188
2021-05-21 15:43:30 +02:00
Neels Hofmeyr 18fd3ee4d2 add missing arg braces in LOG_LCHAN macro
Change-Id: Ifd9f868636fda3298bb19c061d3ef194fd941fc3
2021-05-21 15:43:30 +02:00
Neels Hofmeyr d60b21cc6b log: show src file,line of lchan_set_last_error
Change lchan_set_last_error() to macro so that the error log reflects
where the error was encountered.

Change-Id: I571fdf2d418c52d120215cf19e57a3c96d67af07
2021-05-21 15:43:30 +02:00
Michael Iedema 858ac62b88 stats: add BTS uptime counter
Change-Id: Ib17674bbe95e828cebff12de9e0b30f06447ef6c
2021-05-04 16:09:46 +00:00
Neels Hofmeyr ef28721c16 gsm_lchan_name_compute with ctx
Use a talloc ctx directly without an intermediate static buffer.

A subsequent patch will add a name tweak for VAMOS secondary lchans, so
it felt appropriate to first clean this.

Change-Id: Idb922605c15242a2cdc7c34668c845a179a15660
2021-04-28 16:32:19 +02:00
Neels Hofmeyr 18abd1a808 Lb: stop RESET FSM when sccp_user is unbound
A crash was reported in bssmap_le_tx_reset() sending a RESET with
sccp_user == NULL. Looking at the issue I noticed that when the
sccp_user is torn down, the RESET FSM should also be terminated.

Add bssmap_reset_term_and_free() to the generic RESET FSM implementation
and call from lb_stop() before sccp_user is set to NULL.

Related: OS#5134
Change-Id: If412ef990fcdde8ff88098a5169e86f05cd1c7f0
2021-04-27 17:34:23 +02:00
Pau Espin b0b76af0c3 SRVCC: Parse Last Used E-UTRAN PLMN Id in Handover Request
Whenever SRVCC EUTRAN->GERAN is performed by the CN, it will set the
Last Used E-UTRAN PLMN Id in order for the BSS to inform the MS
about EUTRAN neighbors once the call is over.
The last part (sending EUTRAN neighs) is already implemented, since same
thing is done as per CSFB. However, we lacked the first part, where the
EUTRAN PLMN Id is recorded for later use.

Actually, in both cases, we end up building the list of neighbors
without taking into accound the PLMN value (hence no filtering of
configured neighs), but it only sends such a list if any PLMN was stored
there, which means this patch is still necessary for a quick fallback to
4G after the call is over.

Related: SYS#5337
Depends: libosmocore.git Change-Id I0e55e947b6fef6dad0cf1a6c16b781bef4cc76c5
Change-Id: Ia5008f11a4c36ef8085a2037d4abddd131086e6e
2021-04-24 08:49:08 +00:00
Pau Espin 8831160631 Revert "update neighbor ARFCNs on startup and config changes"
This patch caused major breakage in my setup, with BSC printing at
startup: "(bts=0,trx=0) Failed to generate System Information".

And bts-trx printing all the time:
"sysinfo.c:162 PH-RTS-IND: Unable to determine actual BS_AG_BLKS_RES
value as SI3 is not available yet, fallback to 1"

This reverts commit c1a5310a3e.

Change-Id: I5da365c93aedc6668a77b82ee9b68cbec64967e3
2021-04-23 13:38:58 +02:00
Neels Hofmeyr c1a5310a3e update neighbor ARFCNs on startup and config changes
The effects of the neighbor configuration depend on the LAC, Cell
Identity, ARFCN, BSIC configuration of neighbor cells. Make sure that
the neighbor ARFCN list in the System Information is updated.

This may seem rather aggressive: updating the SI of all BTS if only one
config item changed. But indeed even modifying one config item of one
BTS may cause a change in the neighbor relations that many other BTS may
have to the changed BTS. For example, if many BTS configure a
'neighbor lac-ci 42 23', and this cell's config changes to LAC 43, all
of those other BTS need to update their neighbor ARFCNs.

Also update the system information even before the BTS are connected and
started up. The main benefit here is that the VTY 'show bts N' command
then already lists the correct neighbor ARFCNs.

In gsm_bts_trx_set_system_infos(), make sure that the updated SI is only
sent to TRXes that are actually usable, otherwise abis_rsl_sendmsg()
spams the log with complaints that a message's dst == NULL. Still return
an error rc in case a TRX is not connected, so that the CTRL command
bts.N.send-new-system-informations accurately returns whether SI were
actually sent to all TRXes.

The desire to have the ARFCNs listed in the VTY before starting up BTSes
came during analysis for Ifb54d9a91e9bca032c721f12c873c6216733e7b1,
which fixes a bug that is now much easier to verify being fixed.

Change-Id: I2222e029fc225152e124ed1e8887f1ffd4a107ef
2021-04-22 18:50:32 +00:00
Pau Espin 5bc54d6ce8 Send EUTRAN neighs based on whether Common Id msg contained Last used E-UTRAN PLMN ID
From 3GPP TS 48.008 sec 3.1.30 "Common ID":
"""
If the SCCP connection is established due to CSFB from E-UTRAN and the MSC supports
return to the last used PLMN after CS fallback, then it should send the COMMON ID message
to the BSS including the Last used E-UTRAN PLMN ID information element if available at
the MSC immediately following the successful SCCP connection setup.
"""

Furthermore, 3GPP TS 48.008 version 16.0.0 Release 16 "3.2.1.21 CLEAR COMMAND",
for field CSFB Indication, states:
"""
NOTE: This information element doesn't serve any useful purpose. MSCs should not send the
information element unless it is required by the recipients (due to the need to interwork
with older versions of the protocol). It is expected that in future versions of the present
document, this information element will be deleted from this message.
"""

Hence, build up the EUTRAN neighbor list based on whether we received
the Last E-UTRAN PLMN ID IE during Common Id. In the future, we should
probably filter the list while populating it based on the received IE.

This change will also allow reusing same mechanism for SRVCC
EUTRAN->GERAN support, where te Last E-UTRAN PLMN ID IE can be found
inside "Old BSS to New BSS information" IE in msg HANDOVER REQUEST.

Related: SYS#5337
Change-Id: I5d290ac55eca5adde1c33396422f4c10b83c03d5
2021-04-19 12:12:31 +02:00
Neels Hofmeyr defb5b1200 drop unused gsm_bts_trx->description
Change-Id: I3c0778322b8c630b0eb9d9cd3ac3cc71386c9c12
2021-04-14 17:40:45 +00:00
Neels Hofmeyr 14f9860e79 drop unused func decl rsl_lchan_mark_broken()
Change-Id: Ib08e69720e2b9a6ea5f5b5d13baa9920c415f078
2021-04-14 17:40:45 +00:00
Vadim Yanitskiy d51d96c99c Replace all references to 'sysmobts' with 'osmo-bts'
sysmoBTS is a BTS model sold by Sysmocom, which runs osmo-bts.
The later may also work with some other back-ends, including
the genaral purpose SDR hardware.  Therefore, it's more
logical to call it 'osmo-bts'.

Change-Id: I93ab4dbf483e0786c35685b75ee4ea83bd591f7b
2021-04-12 18:54:40 +00:00
Alexander Chemeris e9a44fdedd stats: Count transitions from BORKEN state due to LCHAN_EV_TS_ERROR signal.
Change-Id: Ice3379020039dc3634aa3887939740729d720dee
2021-04-12 17:56:55 +00:00
Vadim Yanitskiy 6a8536d4da [hopping] Rework generation of Cell/Mobile Allocation
Calculating the Cell Allocation (basically a bit-vector of all the
frequencies allocated to a cell) on the OML link establishment has
several downsides and potential problems:

  * Theoretically, more than 64 ARFCNs can be allocated for a cell
    via the VTY interface.  The problem here is that the Mobile
    Allocation IE cannot contain more than 64 channels.

  * The BSC's operator will neither be warned by the interactive
    VTY shell during configuration, nor during the startup.

  * The BSC will accept such a configuration, but then will be
    unable to encode the Mobile Allocation IEs at run-time.

This change aims to improve the situation by separating part of
the logic from generate_cell_chan_list(), and invoking this
part directly from the VTY commands.  This way it will become
impossible to configure more than 64 ARFCNs, neither via the
config file, nor interactively from the VTY.

Change-Id: I98211fb0684a973239f5760e1de52a24a1f4c33c
2021-04-12 12:17:40 +00:00
Keith Whyte 1823f89c1e Ignore CHANnel ReQuireD with Access Delay IE > 63
It is observed that a CHANnel ReQuireD with access delay
greater than 63 can be received from the Ericsson RBS.
This results in osmo-bsc sending back a CHANnel ACTIVation with
a Timing Advance IE containing the access delay value.
The RBS NACKs this, leading to a BORKEN Channel.

This patch makes the maximum acceptable access delay vty-configurable
and Ignores CHANnel ReQuireD RSL Messages with Access Delay IE greater
than that configured. Default value is 63.

Related: OS#5096
Change-Id: Ie8987bcc0e43921bc753162b77a0efc68799b3ce
2021-04-04 15:39:53 +02:00
Neels Hofmeyr 764449ec2e fix/refactor neighbor config
The neighbor configuration storage is fundamentally broken: it requires
all local cells to be configured before being able to list them as
neighbors of each other. Upon config write-back, the neighbor config
however is placed back inline with the other config, and hence a
written-out neighbor config no longer works on program restart.

The cause of this problem is that the config is stored as explicit
pointers between local cells (struct gsm_bts), which of course requires
the pointer to exist before being able to reference it.

Instead, store the actual configuration that the user entered as-is,
without pointers or references to objects that need to be ready. Resolve
the neighbors every time a neighbor is needed.

Hence the user may enter any config at any place in the config file,
even non-working config (like a BTS number that doesn't exist), and the
relation to actual local or remote neighbor cells is made at runtime.

Abort program startup if the initial neighbor configuration contains
errors.

Related: OS#5018
Change-Id: I9ed992f8bfff888b3933733c0576f92d50f2625b
2021-03-24 21:22:21 +01:00
Neels Hofmeyr d88f9a5384 refactor handover penalty timers
So far the list of penalty timers was stored for an opaque target
pointer. That was either a gsm_bts pointer for a local BTS, or a cell
identifier list pointer for a remote-BSS cell.

Reasons to refactor penalty timers:

- The cell identifier list pointer came from the neighbor configuration
  storage, but the way cell neighbor config is stored will change in a
  subsequent patch. There will be no more cell identifier lists there.

- Storing object pointers is inherently unsafe -- if an object gets
  removed and another gets allocated, the penalty timer could
  theoretically remain in force for an unrelated object.

Rather store penalty timers for specific Cell IDs. Since remote-BSS
neighbors can be requested by a cell identifier *list*, use a
gsm0808_cell_id_list2 as key in the list of penalty timers.

Fix handover_test.c: have different CI for each local BTS. So far it was
the same LAC+CI for all BTSes, which now would make the test fail,
because any penalty timer would appear to apply to all local cells.

Related: OS#5018
Change-Id: I72dd6226a6d69c3f653a3174c6f55bf4eecc6885
2021-03-24 10:02:29 +01:00
Javi 2d168bd1d7 Add command to enable RX diversity to RBS2000
Allow selection of RX diversity from VTY
Options are a,ab,b
Default is 'a' so there is no change from previous behavior

Change-Id: I430762b8cfa51060841d90ba4446de73bd557c6c
2021-03-15 18:50:32 +00:00
Javi 0a3913ee71 Add vty command for Ericsson RBS2000 sync
This commit adds support for Selection of syncronization source.
Options are internal for E1 and external for GPS

Change-Id: Ia3d1acd6b3442238b35fc911092e12a6ac989adb
2021-03-13 07:43:17 +01:00
Michael Iedema 456a962c7e stats: add SIGN/SPEECH assignment subcategories
Change-Id: I73f4dab6edb0951180f2bbcfc352ff34de647679
2021-02-17 15:13:25 +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
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
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
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
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
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
Michael Iedema e42208c6ea stats: Add granularity to SDCCH/TCH/LU activity.
Change-Id: I4df275e4770c5ff3643c79ba828e736986f8bb47
2021-01-18 10:59:02 +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
Harald Welte c77cea43ee abis_om2000: keep OM2K FSMs around, don't terminate
The existing code uses short-lived FSMs which are allocated straight
before START, and which are free'd after DONE state is reached.

While that works, it makes state introspection a bit hard, as one
cannot show the FSM states, etc.

Let's change to a different model where the per-OM2k-MO FSMs are
always around (in state INIT after object creation).  While at it,
also introduce a RESET event that can reset each FSM instance back
to INIT state, i.e. in case of OML link failure.

Change-Id: Ia37cffff5c451e1d79a52ccae41ab5718b4661d4
2021-01-02 22:47:18 +00:00
Harald Welte a34ced0cc2 abis_om2000: make om2k_mo_name() an exported function
Change-Id: Idb05bcad8059ab2b2be6c7057495d0279a4b62c7
2020-12-29 17:30:52 +00:00
Harald Welte c57333e158 Add a bts_model->bts_init() and trx_init() call-back function
This allows a given BTS model driver to initialize data structures
specific cor this BTS instance (or a TRX for this BTS instance).

Change-Id: Icbad9cdc12221c9ad997267d77e5414edcbac538
2020-12-29 17:30:52 +00:00
Vadim Yanitskiy 53866d3bf7 power_control: add VTY command to set static / maximum BS Power
Change-Id: I11ca856aba46aaf84d94cbbdf4c39a01ee8289b9
Related: SYS#4918
2020-12-22 11:11:07 +00:00
Vadim Yanitskiy 0ce12e7a37 power_control: add VTY commands for per-BTS configuration
Change-Id: Ifd6ea29c3b9dbaccf92856131d5fb2e352b84eb2
Related: SYS#4918
2020-12-22 11:11:07 +00:00
Vadim Yanitskiy 8a2907e646 power_control: add encoding/init API to 'struct gsm_bts_model'
This change introduces two optional function pointers:

  - power_ctrl_enc_rsl_params() - this function will be called by the
    A-bis/RSL code in order to encode MS/BS Power control parameters
    for CHANnel ACTIVation and MS/BS POWER CONTROL messages.

  - power_ctrl_send_def_params() - this function will be called for
    each transceiver on A-bis/RSL link establishment in order to
    send default MS/BS Power control parameters.

Change-Id: Iba3ad5d8d549a6676050272f85b21c9b4c219d21
Related: SYS#4918
2020-12-19 22:54:48 +01:00
Vadim Yanitskiy 8bde75c91d power_control: add new structures and default parameters
Change-Id: I7fb8ccb997490b40a061d09c241359aaabc37c4a
Related: SYS#4918
2020-12-19 22:54:48 +01:00
Vadim Yanitskiy e0adb24100 abis_rsl: turn rsl_msgb_alloc() a macro and move it to header
Also, take a chance to make talloc chunk names more informative.

Change-Id: Id25c4bf1e06f697328d10777d6449c83006e8466
2020-12-19 00:04:51 +01:00
Pau Espin Pedrol 0597745ac7 Use rest_octets functionalities from libosmocore
libosmocore > 1.4.0 is required (master, not yet released) since some
fixes done in osmo-bsc code where not cherry-picked to libosmocore APIs.

Depends: libosmocore.git I2bf5635b8536b11d69774d17ac1908019633e3af
Change-Id: I7d5e5ddd174463c2a3d957c8245d2911ce013681
2020-12-15 19:21:44 +00:00
Vadim Yanitskiy 027b506c27 vty: add new attribute for vendor-specific commands
Change-Id: I2254cdf8c4be85c89819d0f831102ee71349b188
Related: SYS#4918
2020-12-15 06:54:34 +00:00
Pau Espin Pedrol 7c5b7ad633 gsm_lchan_name: assert on NULL lchan
Steve Langasek <steve.langasek@ubuntu.com> submitted some patches
against downstream osmo-bsc 1.3.0 because some possible null derefences
were detected by the compiler on Ubuntu s390x. Code has eveolved since
then and patch doesn't apply directly anymore, since related code
changed (we now use osmo_count in bsc_subscr_get).
The compiled allegedly claimed some null dereference in gsm_lchan_name.
In general code using that function seems to be doing checks for
existing lchan before calling it, or assuming the lchan pointer is not
null, so I couldn't find any major issue.
However, let's add a OSMO_ASSERT to make sure we can easily identify the
issue if an issue ever happens there, since the gsm_lchan_name should
clearly only be called on non null pointers.

Change-Id: If4d12cb1d95ee2a89244bb8f27df839871667387
2020-12-10 15:28:05 +00:00
Pau Espin Pedrol 44a0e0fc08 oml: Delay configuring NSVC until BTS features are negotiated
This is needed in order to to proper feature support verification for
IPv6 when configuring the NSVC.
Before this patch, there could be a race condition where NSVC FSM
checked for BTS feature BTS_FEAT_IPV6_NSVC before it was negotiated
through BTS Get Attributes (Ack).

Fixes: OS#4870
Change-Id: I7c207eee0e331995ae04acec014fbd13d4d16280
2020-12-04 15:54:34 +01:00
Pau Espin Pedrol 396eb76fcd Fix typo in function nanobts_attr_nsvc_get
Change-Id: I50235ba7b045ab7fba2112e61191d2756a67dfdc
2020-12-04 14:44:43 +01:00
Pau Espin 10364c8999 Handle BTS/BBTRANSC Get Attributes (Ack) in NM FSMs
Before this patch, Get Attributes was sent quicklyafter the OML link
became up, even if the BTS/BB_TRANSC objects were still powered off,
which is wrong since attributes should only be available after the
objects transition out of the Power off state.

Furthermore, information about get attr response already received will
be required in future patches to delay NSVC setting.

Related: OS#4870
Change-Id: I8ec39c7e1f956ffce9aecd58a5590c43200ba086
2020-12-04 14:44:43 +01:00
Alexander Couzens d74bb1e3b0 Introduce NM GPRS NSVC FSM
Related: OS#4870
Change-Id: I381472532c2622a8dba7c81ae00ea873c2e58ae1
2020-12-04 14:44:40 +01:00
Pau Espin aab54b44e4 Introduce NM GPRS CELL FSM
Related: OS#4870
Change-Id: I074f4496aa153b5f84e6ce85f413754efe64d831
2020-12-03 19:56:19 +01:00
Pau Espin ee9f02f2df Introduce NM GPRS NSE FSM
Related: OS#4870
Change-Id: I91a5f40324d5373eac885032295690cec97214a6
2020-12-03 18:46:27 +01:00
Pau Espin 64c422858d Store GPRS MOs directly under BTS SiteMgr object
The only real 1-1 relationship between BTS NM objects is the one between
GPRS Cell and BTS (which is actually a BTS cell).
In our current osmo-bts implementation we don't care much since we only
handle 1-cell BTSses, but let's make the data structure organization
more generic.

Implementation notes:
The gsm_bts_sm is moved to its own file, APIs to allocate are added and
the new public object is hooked correctly in the allocation process of
osmo-bsc.

Change-Id: I06461b7784fa2a78de37383406e35beae85fbad8
2020-12-03 16:31:36 +01:00
Philipp Maier 0eb479e283 abis_rsl: parse cm3 and indicate ACCH repetition cap to BTS
In order to activate FACCH/SACCH repetition on the BTS, the classmark 3
IE in the CLASSMARK CHANGE message must be parsed and depending on the
Repeated ACCH Capability bit the RSL_IE_OSMO_REP_ACCH_CAP is added to
the RSL CHAN ACT und RSL CHAN MODE MODIFY. Since
RSL_IE_OSMO_REP_ACCH_CAP is a propritary IE, it may only be added for
BTS type osmo-bts.

Change-Id: I39ae439d05562b35b2e47774dc92f8789fea1a57
Related: OS#4796 SYS#5114
2020-12-01 11:58:24 +00:00
Philipp Maier ca878ff4df bts: add repeated acch mode flags + vty config
To be able to control the FACCH/SACCH repetition behavior inside the
BTS a one byte flag is sent to the BTS together with the
RSL_IE_OSMO_REP_ACCH_CAP IE. This patch adds the necessary VTY commands.
The sending of the flag is implemented in a follow-up patch.

See also: I39ae439d05562b35b2e47774dc92f8789fea1a57

Related: SYS#5114, OS#4796, OS#4794, OS#4795
Depends: libosmocore I6dda239e9cd7033297bed1deb5eb1d9f87b8433f
Change-Id: I083eaa2c30478912426e9c24a506f0b88836e190
2020-12-01 11:58:24 +00:00
Neels Hofmeyr dad4e7c3f7 fix TCH/H allocation: use half occupied dyn TS instead of switching more dyn TS
Change-Id: I5a8d943f31774af00664d037550be14e767d312a
2020-11-17 03:32:17 +01:00
Neels Hofmeyr 4d8a469cd4 handover vty doc: explain rxqual values
Change-Id: I4f9d6b59c4f4a0550fb6a386342be55dcd777de8
2020-11-17 03:32:14 +01:00
Vadim Yanitskiy 218b3753f1 bts: move rate counter / stat item definitions from *.h to *.c
A header file should only contain declarations, not entire definitions.
The fact that we have 'static const struct ...' definitions in a header
file means that very C file including this header file will get its own
private copy of the entire definition.

The header file should only include declarations, while the actual
non-static definitions should go to a *.c file.  Let's fix this.

Also, take a chance to improve readability and apply more consistent
formatting (similar to 'struct hf_register_info[]' in Wireshark).

Change-Id: Ib5949879902acbe1edda577477d9d51a2cc425d1
Closes: OS#4816
2020-10-19 01:07:24 +07:00
Pau Espin 0aa489252d ipa: Fix use of null pointer in log macro
Fixes: Coverity CID#214962
Fixes: Coverity CID#214963
Change-Id: Iafea915dbbbfbaa710fb5899cb9be5e507ba384c
2020-10-17 13:56:16 +00:00
Neels Hofmeyr 60e5ddf65d drop features 'core-location-area-code' and 'core-cell-identity'
This feature apparently assigned a fixed LAC and CI to a specific MSC, but
looking at the implementation was obviously not useful.

Keep the vty commands for legacy compat, now without effect besides logging an
error via vty_out().

Related: OS#4751
Change-Id: I6bee704e7e5d5b6b86473323bae1fa9fce9241ee
2020-10-16 13:51:48 +00:00
Pau Espin 558183f3dc OML: Stay compatible with older osmo-bts versions
Older osmo-bts versions (before FSMs) tended to mimic broken behavior
from nanoBTS. As so, we detect it because SiteMGr becomes Enabled by
default as in nanoBTS, and hence we can manage them also by expecting no
Offline state and sending Opstart (and hence finally transitting to
Enabled) during Dependency state.

Change-Id: Iaa036a2936f609b9b9721b2b4ad8d6deaf023f42
2020-10-15 05:55:36 +00:00
Pau Espin 09544ab436 Introduce Radio Channel FSM
Change-Id: Iddc008c5737afb2fddd32c628bc5278056a64d89
2020-10-15 05:55:36 +00:00
Pau Espin d9d105c1f7 Introduce NM RadioCarrier FSM
Change-Id: Ieed61d1fb1e896db42545c2c3421b20cb41ad549
2020-10-15 05:55:36 +00:00
Pau Espin 95486f248a Introduce NM BaseBand Transceiver FSM
Change-Id: Ib4d35316c52eb4c71ea0d352a1e06fd5e600fe08
2020-10-15 05:55:36 +00:00
Pau Espin 6adeb607d0 Introduce NM BTS FSM
Change-Id: I7756a8ce90b6cc8a502b5665889a7987d7f749cb
2020-10-15 05:55:36 +00:00
Pau Espin 4338de5f51 Introduce NM BTS Site Manager FSM
Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
2020-10-15 05:55:36 +00:00
Neels Hofmeyr d3d1cb6dbc LCS: add proper BSSMAP-LE RESET re-using new generalized reset FSM
Previous commits to generalize the a_reset FSM prepare for this commit: use the
same reset FSM for the Lb interface.

Change-Id: I8c03716648f8c69d12d8f0a0bcec14f040d7cff2
2020-10-15 05:39:09 +02:00
Neels Hofmeyr 3779494d4b LCS: disable Lb interface by default, add vty 'smlc' / 'enable'
To not modify previous SCCP behavior of OsmoBSC, keep the Lb interface disabled
by default. The following configuration enables the Lb interface:

  smlc
   enable

Change-Id: I01314a29a2cad6f325d9f4687a9dedca6b90a3ce
2020-10-15 05:39:09 +02:00
Neels Hofmeyr e95b92b63e BSSMAP RESET: move RESET-ACK into reset fsm
The Lb interface will need the same RESET-ACK logic.

Change-Id: Idf4682319a0af5665e867dbc0515d1fe343d9daf
2020-10-15 05:28:44 +02:00
Neels Hofmeyr 6efafb1219 BSSMAP RESET: move cancel-paging call to osmo_bsc_sigtran_reset()
So far we would cancel ongoing Paging for a given MSC only after receiving a
RESET message from that BSC. However, the typical operation would be that
OsmoBSC *sends* a RESET and receives a RESET-ACK.

Instead, move the call to within osmo_bsc_sigtran_reset(). This is also called
when OsmoBSC considers the A-interface link to be lost, from the a_reset.c
code, after multiple SCCP connection failures.

Change-Id: Ia14b916be56563d18632c69a833084e71799a468
2020-10-15 05:28:44 +02:00
Neels Hofmeyr c27ae2da55 BSSMAP RESET: generalize a_reset FSM
Separate the a_reset FSM implementation from BSSMAP and MSC specifics, so that
it can be re-used on the Lb interface.

Move the FSM implementation to bssmap_reset.c and tweak, to match common practices we
have generally established in our osmo_fsm implementations.

Keep a_reset.h and a_reset.c and redirect to bssmap_reset.c.

A difficulty is setting a proper logging category: the FSM definition allows
only one fixed logging category for FSM state transitions and events. Ideally,
the BSSMAP reset fsm would log on DMSC, and the BSSMAP-LE reset fsm would log
on DLCS. Since that is not possible, introduce a separate DRESET logging
category. This in fact matches an item on my wishlist, because if a given MSC
is configured but currently not connected, the previous RESET FSM would
continuously "spam" log LOGL_NOTICE messages indicating that it is resending
RESET, and I often want to silence those messages without silencing the entire
DMSC category. This is now easily possible by setting DRESET logging to
LOGL_ERROR. There is additional "link up" / "link lost" logging on DMSC, so all
interesting info is still visible on DMSC.

Change-Id: Ib3c3a163186c40a93be0dea666230431172136df
2020-10-15 05:28:24 +02:00
Neels Hofmeyr 7046a49457 remove unused osmo_bsc_reset.h
Change-Id: Ib315da03d1731a0e79d09ac886e363890ac815b4
2020-10-09 19:26:38 +00:00
Neels Hofmeyr 4ae338d5b6 LCS: implement the bulk of Location Services
Depends: I4d7302a4853518916b6b425e710c10568eb2ffe5 (libosmocore)
Change-Id: I28314ba97df86a118497e9b2770e2e6e2484e872
2020-10-09 00:26:02 +02:00
Neels Hofmeyr a33ef3ae2b LCS: SCCP next conn id: prepare Lb-interface
When adding the Lb interface, it is necessary to determine an unused conn id
across *all* SCCP users. Prepare adding Lb by moving conn id creation out of
the gscon code and generalizing.

Change-Id: I12fcb18f6e4380f72929cfe7681bac05330a8c9a
2020-10-08 07:24:52 +00:00
Vadim Yanitskiy d3d8e91bda vty: add attributes to VTY commands indicating when they apply
Change-Id: I3bf9223295fc4a2fcb4046a1f29f792ff6a41d51
Related: SYS#4937, OS#1601
2020-10-08 07:18:12 +00:00
Neels Hofmeyr 1ae1826245 LCS: implement re-use of existing A-interface conn
Location Services brings a new scenario to OsmoBSC: the MSC may create an
A-interface conn for a subscriber without an lchan being established (N-CONNECT
from MSC to BSC, so far only for an incoming inter-BSC handover).

If an MS becomes active while an A-interface conn is already established,
associate with an existing conn.

Change-Id: I42290f519a419ed7e8dd02a5ed0a5261b30a51e6
2020-10-07 11:40:12 +00:00
Neels Hofmeyr d1e7d3908b cosmetic: fix naming of GSCON_EV_A_CONN_REQ -> GSCON_EV_MO_COMPL_L3
The N-CONNECT.req on the A interface is a possible *consequence* of the event
being handled, namely the incoming RSL ESTablish INDication containing the
Complete Layer 3 message: dispatched by bsc_compl_l3().

If an (LCS related) connection is already present on the A-interface when the
lchan is established, there will be no N-CONNECT but an N-DATA sending the
Complete Layer 3. See BSC_Tests.TC_cm_service_during_lcs_loc_req().

Change-Id: Ic43aabeb0d3c58ac62249ad9d3718363d32508f9
2020-10-07 11:40:12 +00:00
Neels Hofmeyr 86a1dca5c7 introduce osmo_use_count for bsc_subscr
During LCS development, I'm getting use count bugs and would like to see use
token strings to figure it out.

Change-Id: I29bf60059d4cf7bb99a00753e6cdc149baf95f94
2020-10-07 11:40:12 +00:00
Neels Hofmeyr d4946b22f7 LCS: add paging reason, return in paging_request_stop()
To distinguish between the CN requiring a Complete Layer 3 response, or just
the BSC requiring a TA, allow recording a separate for-LCS paging reason.

Change-Id: Ib28d1599ae4e483727398859d07de4490fbc31f0
2020-10-07 11:40:12 +00:00
Neels Hofmeyr 4c5fd38b3b refactor paging: add bsc_subscr to bsc_paging_params
Get a bsub once at start of paging.

Change-Id: I13621cd51d934846ff6556e1f2f8839da73a5dbb
2020-10-07 11:40:12 +00:00
Neels Hofmeyr 86ce105038 refactor paging: introduce bsc_paging_start()
Allow starting a paging from elsewhere than a BSSMAP Paging Request. For
upcoming Location Services (LCS), a BSSLAP TA Request from the SMLC may require
triggering a Paging.

Change-Id: Iaff91584699d163bd1963927280ff3a8ddd43073
2020-10-07 11:40:12 +00:00
Neels Hofmeyr 766f59096e refactor paging: introduce bsc_paging_params
For LCS, I would like to add an enum indicating the paging reason. Instead of
modifying extremely many function signatures to pass the reason across all
levels of paging, introduce a struct combining these.

Change-Id: I27ca78fc6ff8ef1101554c0a8429e34945ca6f3c
2020-10-07 10:21:12 +00:00
Neels Hofmeyr 65a13b4d98 compl l3: move Paging Response handling out of bsc_find_msc()
Instead of iterating the llist of gsm_paging_requests first to find an MSC, and
then again right away to mark the paging as served, do both in the same step.

Change-Id: I447e61afc9934f3a5a82f6076e41c155d3328041
2020-10-07 10:19:58 +00:00
Neels Hofmeyr 2001dd6cb5 compl l3: allocate conn in gsm_08_08.c, not gsm_04_08_rr.c
Move conn allocation to bsc_compl_l3(), from gsm0408_rcvmsg().

Drop dispatch of GSCON_EV_A_DISC_IND, because a) we did not receive such
DISC.IND, and b) the lchan release will discard the conn in the regular
fashion.

In upcoming LCS patch, bsc_compl_l3() will decide whether to allocate a new
conn or whether a conn from a Perform Location Request already exists for the
subscriber.

In this patch, it becomes clear that the conn->bsub is always NULL in
bsc_compl_l3(), and that the 'log_set_context(LOG_CTX_BSC_SUBSCR, conn->bsub);'
never has the intended effect. An upcoming patch will change that.

Change-Id: I92af0f0d54c4282d782f2b29d524a64006c3b674
2020-10-07 10:19:58 +00:00
Alexander Couzens 62af292f38 pcuif_proto: version 10: add support for IPv6 NSVCs
Introduce a address_type in the NSVC configuration pass the given
protocol. The remote_ip is network byte order, the default
encoding for in_addr and in6_addr.

Related: Iae854875a45dbc29cd46a267ccaf60f1f2ac2973
Related: SYS#4915
Change-Id: I740be0a401612bb5ed4e8ccd7f4be8176b936449
2020-10-05 14:06:26 +00:00
Alexander Couzens 97d3978dd0 pcuif_proto: version 10: add frequency hopping parameters
Related: SYS#4868, OS#4546, OS#4547
Change-Id: I5540fae66a116cbb25ec75b35145c36137146ffd
2020-10-05 14:06:26 +00:00
Alexander Couzens 2f9df96eba oml: encode IPv6 NSVC using the new OML attribute NM_ATT_OSMO_NS_LINK_CFG
The old IE NM_ATT_IPACC_NS_LINK_CFG didn't support IPv6 NSVC.

Depends: Ic261bc43a07fa741b97a9c6ec5a9ed6f5ecae588 (libosmocore)
Depends: I9e279bb20940c66eea5196f281184cb4f8a5cc5f (libosmocore)
Change-Id: I6529876a3c1116a79dd624312243d8ae48a41fe2
2020-10-05 14:06:26 +00:00
Alexander Couzens 5fa725314d pcuif_proto: protocol 9: add missing fields
The protocol 9 was extended (compatible) with
* app info request
* suspend request (ETWS)
* rach indition (add fields ts / trx)

Only copy the relevant parts but no implementation.

Related: OS#4766, OS#4767, OS#4768
Change-Id: Ia81310326b093a8e473b6c69045304667b3b60f1
2020-10-03 18:42:05 +00:00
Neels Hofmeyr d712451d5d remove unused signature gsm48_handle_paging_resp()
Change-Id: Ib221e34afe08d87e43ac7ddc73d6894bbe36dc4b
2020-10-03 07:38:41 +00:00
Pau Espin 1a7e3ccef1 oml: Fix premature Opstart to Radio Carrier
During the A-bis/OML bootstrapping, osmo-bsc sends Opstart to the
Radio Carrier MO twice.  The first Opstart is triggered by the
State Changed Event Report, originated by the Radio Carrier itself.
The second is triggered by Software Activated Report.

According to 3GPP TS 12.21, figure 2, we shall send it only once,
after the "Attribute setting" step.  Therefore, the first Opstart
is premature, and we shall not send it.

Related: SYS#5063, OS#4755
Change-Id: If69393551117266ecb726d8961153560b2b3cc59
2020-09-20 09:56:49 +00:00
Neels Hofmeyr 638eb99286 clean up timer definitions: introduce groups, move some T to X
Backwards compatibly, introduce timer groups in OsmoBSC, and move some
non-specified T timers to new X timers:

T993111 -> X3111
T993210 -> X3210
T999 -> X4

Why X4? because there already is an X3 used elsewhere in Osmocom, and I find
it less confusing if X-numbers don't repeat across programs. See
https://osmocom.org/projects/cellular-infrastructure/wiki/List_of_Timer_numbers

Drop unused timers from g_mgw_tdefs. Only X2427 has an actual effect.
(libosmo-mgcp-client recently moved T2427001 to X2427.)

Put libosmo-mgcp-client related timers to the 'mgw' group, like in osmo-msc.
This makes the MGCP timeout configurable for the first time.

Keep previous timer commands as DEFUN_HIDDEN, and also translate the moved T
timers to X timers on-the-fly. All previous VTY commands still work, and new
'timer [(net|mgw)] ...' commands are added. timer.vty shows this.

Remove the "_OPTIONAL" from the legacy "timer" and "show timer" commands, so
that they don't ambiguously overload the new "timer [(net|mgw)] ..." commands.

Related: OS#4539
Related: If097f52701fd81f29bcca1d252f4fb4fca8a04f7 (osmo-mgw)
Change-Id: I4beec47502afa193dee343869c4be55dc6a4b536
2020-09-18 08:47:49 +00:00
Neels Hofmeyr aa826cdcd7 drop bsc_subscr.lac
It does not make sense to set the bsc_subscr's LAC from a Paging Request,
especially since the paging code has loops that possibly kick off several
pagings.

At this point, there remains no code setting bsub->lac anywhere. We could set
it during rx of Complete Layer 3, but since there is no use for it besides a
vty dump, let's just drop the bsub->lac completely, and the vty dump of it.

Change-Id: Id017bd494d329b6fc254d7135b4074ac2b224d66
2020-09-16 21:54:52 +00:00
Neels Hofmeyr e60254118c dissolve bsc_grace_paging_request()
RF-locking: simply ask bsc_grace_allow_new_connection() at the start of
page_subscriber(). Before this patch, we would log an INFO of "Paging request
failed" when RF-locked, for each BTS. Instead log "RF-locked". (An upcoming
patch will introduce a LOG_PAGING() macro that will trivially add more log
context there, so not bothering now.)

Drop LAC condition: since Stefan introduced page_subscriber() starting 2018
Ic3c62ff0fccea586794ea4b3c275a0685cc9326e, matching a requested LAC to a
specific BTS is done *before* calling page_subscriber().

BTW: the msc->core_lac (config 'core-location-area-code') has not had an effect
on Paging maybe ever. I opened OS#4751.

Change-Id: Ic8696414a1db8f4b1be502d6434599f684746ed6
2020-09-16 21:54:52 +00:00
Philipp Maier 1482ec4813 abis_rsl.c: flush channel request queue on RSL bootstrap
When RSL link is bootstrapped the BSC should clear the channel request
queue.

Change-Id: Iefb333817033e8d376184b58d89b186d875b968f
Related: OS#4549
2020-09-11 14:38:54 +02:00
Philipp Maier cc6d35d788 abis_rsl: prioritize emergency calls over regular calls
when an emergency call arrives while all TCH are busy, the BSC should
pick an arbitrary (preferably the longest lasting) call / lchan and
release it in favor of the incoming emergancy call.

The release of the existing call is a process that can not be done
synchronously while the ChanRQD is handled sonce multiple messages are
exchanged between BTS and MSC and multiple FSMs need to do their work.

To be able to release one lchan while handling a ChanRQD a queue is
implemented in which the incomming channel requests are collected. If
an emergency call is established while all channels are busy, an
arbitrary lchan is picked and freed. When freeing the lchan is done,
the queue is checked again and the emergency call is put on the free
lchan (TCH/H or TCH/F).

Change-Id: If8651265928797dbda9f528b544931dcfa4a0b36
Related: OS#4549
2020-09-07 12:44:41 +02:00
Philipp Maier 92eed41a99 lchan_fsm: make rsl mode-modify working again
osmo-nitb supports the modification of an lchan if the lchan is
compatible but in the wrong mode. This feature was dropped in the
transition to AoIP/bsc-split. However, osmo-bsc still has code to
generate and parse the messeages, but the FSMs do not support a mode
modify yetm

Lets add handling for mode-modify to the lchan_fsm and assignment_fsm in
order to support mode modify again

Change-Id: I2c5a283b1ee33745cc1fcfcc09a0f9382224e2eb
Related: OS#4549
2020-09-03 21:35:25 +02:00
Neels Hofmeyr b26dd1ebf6 drop some unused members and function decls
Change-Id: I0de2c8a3ee6c693a5a321f0ea2a8a75fbe64a1c2
2020-09-03 01:07:15 +02:00
Neels Hofmeyr 90f7c3c08d bssap: do not send a Clear Request after a Clear Command
During handover cleanup due to a Clear Command from the MSC, do not send
another Clear Request to the MSC. Only send that when no Clear Command was
received yet.

Add a flag rx_clear_command per gscon instance, indicating whether a Clear
Command was received, and exit early in gscon_bssmap_clear() when true.

This is part of patches fixing the rate counters around handover, which uncover
some bugs:
- Another patch enables proper handover result handling when receiving a Clear
  Command.
- After that, the handover_end() handling would always cause sending a Clear
  Request, even if a Clear Command was already received.
- This patch removes the extraneous Clear Request, for this scenario and for
  all other corner cases that might still exist.

Related: OS#4736
Change-Id: Iab82cac0a7ffa7d36338c8ff7c0618a813025f13
2020-08-31 18:01:17 +02:00
Neels Hofmeyr dbe59f69a4 add {BTS,BSC}_CTR_INTER_BSC_HO_OUT_FAILED for RR HO Failure
So far, during inter-BSC outgoing handover, when receiving an RR Handover
Failure from the MS, it would be counted as 'error'. Instead, add the 'failed'
counter like for all other HO types.

It may make sense to omit the 'failed' counter for inter-BSC *incoming*
handover, because then we won't receive an RR Handover Failure message. I
probably got those two mixed up during initial development.

Related: OS#4736
Change-Id: I9a61d5cc7273a830ba4e66e43e4aac6cdb707471
2020-08-31 18:01:17 +02:00
Neels Hofmeyr d41247d4cf CBSP: add local bind to client mode
Add the ability to set a local bind address for the CBSP client mode.

Change-Id: I56a420d204a9a487b27dd460f4cc52e0b4093d69
2020-08-29 07:57:59 +00:00
Neels Hofmeyr 641f7f0845 CBSP: rewrite the CBSP link setup and 'cbc' VTY section
Firstly, make CBSP server and client mutually exclusive: Do not allow osmo-bsc
to be configured as CBC client *and* CBC server at the same time.
cbsp_link.c expects at most one CBSP link to be established, and, upon sending
CBSP messages, probes whether to send the message to a CBSP server or client
link. When both listen-port and remote-ip are configured (regardless of an
actual CBSP connection), osmo-bsc gets confused about where to send CBSP
messages.

One solution would be more accurate probing for an actual established TCP
connection. But the simpler and less confusing solution is to force the user to
configure only server or only client mode, never both.

Introduce 'cbc' / 'mode (server|client|disabled)'.

Secondly, clarify the 'cbc' config structure into distinct 'server' and
'client' subnodes. Refactor the 'cbc' VTY node in such a way that the IP
addresses for server and client mode can remain configured when the CBSP link
is switched between server/client/disabled modes.

To implement the above, switch the struct bsc_cbc_link to use osmo_sockaddr_str
for address configuration.

Related: OS#4702
Related: I7eea0dd39de50ed80af79e0f10c836b8685d8644 (osmo-ttcn3-hacks)
Related: I9e9760121265b3661f1c179610e975cf7a0873f1 (docker-playground)
Change-Id: Icaa2775cc20a99227dabe38a775ff808b374cf98
2020-08-29 07:57:59 +00:00
Pau Espin 657f3109dc Allow storing IPv6 address strings in BSSAP structs
Related: SYS#4915
Change-Id: I95601f24e3c658aab328e1c55dc514f553c297b8
2020-08-28 19:11:18 +02:00
Vadim Yanitskiy 6a26e2cf50 bsc_subscr_conn_fsm: use proper cause values in SAPI N REJECT
As 3GPP TS 48.058 clearly states, an RLL RELease INDication is only
sent if the datalink is released by the MS.  Thre's no cause value
giving further diagnostics, but if the MS releases the link, it is
clearly not the BSS's fault, and hence "BSS not equipped" is wrong.

Change-Id: I38222e60071841abcd06046a472ddb35907164a4
Related: OS#4728
2020-08-26 19:05:59 +00:00
Vadim Yanitskiy f1339dfece fix bsc_sapi_n_reject(): dlci is unsigned, use uint8_t
Change-Id: I5f04f16caecb58a28e119512267999fdc18ff172
2020-08-26 19:05:59 +00:00
Daniel Willmann aa420cec14 Add bts counters to count BTS events where we don't have a bts
In some (error-) cases we might be unable to determine which BTS to use
when counting handover events. We don't want to loose these events
because then ctr(bsc) == sum(ctr(bsc->bts)) would not be true anymore.

Those events are now counted by a counter in struct gsm_network which
uses an index that is out of range for regular BTS (65536).

Change-Id: Ic0f3edd5dc014c4eac5e8423133633a3e5d4c13e
Related: SYS#4877
2020-08-24 07:41:43 +00:00
Daniel Willmann bf2a4b69d8 Count intra-cell and intra-bsc handover separately
Currently the counters don't distinguish between intra-cell and
intra-bsc handover.

Add _CTR_INTRA_CELL_HO_ and _CTR_INTRA_BSC_HO_ counters to track
intra-cell/bsc handover separately.

Change-Id: I3a1195640b99813036c9f1426ee5f07548e26547
Related: SYS#4877
2020-08-24 07:41:43 +00:00
Daniel Willmann 02f0b30cda Count handover per BTS as well as per BSC
Our current handover counters only count success/failures per BSC. It
would be nice to also count which BTS is part of a (successful/failed)
handover.

This patch duplicates the BSC counters for the BTS and changes the
ho_count and related macros to also count per BTS. If a BTS is NULL
(when conn->lchan is NULL) counting for the BTS is ignored.

Change-Id: I025ef14e2cfd2eea8880212c9406372ce0bf9296
Related: SYS#4877
2020-08-24 07:41:43 +00:00
Daniel Willmann 45062b42ce Remove punctuation in counter description
Change-Id: I304dcc9e88afc5e607d5b010df3e95f40fb8c49b
2020-08-20 18:44:46 +02:00
Harald Welte 210aa95d49 Implement support for receiving BSSMAP CommonID from MSC
The MSC may at any time send a BSSMAP CommonID message via a
SCCP connection to inform us of the IMSI of the subscriber.  Let's
make use of that information by associating a related bsc_subscr
and updating the identity of the bsc_subscr_conn_fsm for improved
logging / filtering.

Closes: OS#2969
Change-Id: I52c43fb940f0db796adf4c0adb2260321c721c39
2020-08-17 13:04:03 +02:00
Philipp Maier 7a11fce611 lchan_rtp_fsm: use E1 endpoints if the BTS is not ipaccess type
When the BTS is is not an ipaccess BTS, the BTS can only be an E1 bts.
In that case E1 endpoints must be used and there will be no RTP stream
setup towards the BTS.

Change-Id: I4f1f39bf90b0a7c9ea448dab255daf99cd36bb4a
Related: OS#2547
2020-08-06 15:52:16 +00:00
Pau Espin 1e5e7004dc Introduce support for ACC ramping during whole BTS life cycle
Prior to this patch, ACC ramping was only used to go 0->N in the
number of allowed ACCs during BTS startup. It could optionally
dynamically stretch or extend the ramping time based on channel load.

With this patch, ACC ramping is kept alive during the entire time the
BTS is active, and subset of allowed ACCs can now be incresed or
decreased based on channel load. A new VTY command
"access-control-class-ramping-chan-load" is added to configure a lower
and an upper threshold. Channel load under the low threshold will
potentially trigger an increment of the subset size of allowed ACCs,
while a channel load over the upper threshold will potentially trigger
the opposite (a decrease in size).
The time between checks is kept fixed per VTY command (reusing old
"access-control-class-ramping-step-size"), but the "dynamic" option
is deprecated and ignored from now on since it provides nothing valuable
in the new implementation, because the size always dynamically changes
based on channel load (configured thresholds).

Related: SYS#4912
Change-Id: Id17f947c92cdfc0eb9541a9bf066338169caaeb5
2020-07-31 09:56:46 +00:00
Pau Espin deaa6fd624 Introduce support for ACC subset rotation
See updated documentation section in manuals/chapters/bts.adoc regarding
an explanation on how the system works.

Related: SYS#4911
Change-Id: I952c9eeae02809c7184078c655574ec817902e06
2020-07-29 20:09:47 +00:00
Pau Espin 02f2056ccf rename files acc_ramp.* -> acc.c*
With upcoming next commit, the file will contain far more code that
simply ramping, so rename it to be more generic.

Change-Id: I8c368ab87e264439dea4ccf556821a44664cdbb0
2020-07-20 16:21:59 +02:00
Pau Espin 8d4f94a176 Move gsm_bts_{trx_}set_system_infos APIs to bts{_trx}.*
Change-Id: I2aa83b499d6e5d06a0fa1001fee3111f7e639c94
2020-07-18 21:45:32 +00:00
Pau Espin aca53203d1 Move struct gsm_bts_trx: gsm-data.* => bts_trx.*
See rant fro similar recent commit moving stuff to bts.*.

Change-Id: I11758ca3d255d849d77bd068f24bb68bde1f89a5
2020-07-18 21:45:32 +00:00
Pau Espin e2f1c95774 bts: Drop duplicated function to get trx by number
In the big mess of gsm_data we reached a point where we have multiple
functions doing the same thing, most probably because it's hard finding
stuff in there. Let's drop one of them (the one which less callers) and
move it to bts.*, where it belongs.

Change-Id: I9071a0ab250844619280fbe2be63ed99f2c87eb1
2020-07-18 21:45:32 +00:00
Pau Espin 388ed58482 Move struct gsm_bts: gsm_data.* => bts.*
Place all code related to the object into the related file.

Having all the data model in one file made sense in early stage of
development to make progress quickly, but nowadays it hurts more than
helps, due to constantly growing size and more and more bits being
added to the model, gaining in complexity.

Currently, having lots of different objects mixed up in gsm_data.h is a hole
of despair, where nobody can make any sense were to properly put new stuff
in, ending up with functions related to same object in different files
or with wrong prefixes, declarations of non-existing functions, etc.
because people cannot make up their mind on strict relation to objects
in the data model.
Splitting them in files really helps finding code operating on a
specific object and helping with logically splitting in the future.

Change-Id: I00c15f5285b5c1a0109279b7ab192d5467a04ece
2020-07-18 21:45:32 +00:00
Neels Hofmeyr 3405c77282 propagate RSL error cause codes to RR Channel Release cause
In various places that receive an error cause from RSL and place it in
lchan.release.rsl_error_cause, translate it to an RR cause and place that in
the recently added lchan.release.rr_cause. Hence the RR Channel Release message
now reflects more specific error causes when the reason for the error was
received in an RSL message's cause value.

Change-Id: I46eb12c91a8c08162b43dd22c7ba825ef3bbc6ac
2020-07-16 12:03:19 +00:00
Neels Hofmeyr b523f54de4 RR Channel Release: pass Cause code from BSSMAP Clear to the BTS
In lchan.release, add 'cause_rr', and set RR Channel Release message's cause
value to lchan.release.cause_rr.

In lchan_release(), do not set lchan.release.rsl_error_cause to the RR cause
value, these are unrelated. Store in new lchan.release.cause_rr instead. The
rsl_error_cause is apparently only used for logging, except for one place in
lchan_fsm_wait_activ_ack() that compares it to RSL_ERR_RCH_ALR_ACTV_ALLOC, so
there should not be a functional difference by this fix.

Propagate the BSSMAP Clear Command cause to the RR Channel Release:

Add struct gscon_clear_cmd_data as event data for GSCON_EV_A_CLEAR_CMD -- so
far it sent the is_csfb flag, add the gsm0808_cause; invoking the event happens
in bssmap_handle_clear_cmd().

Adjust event handling in gscon_fsm_allstate(); there, pass the cause to
gscon_release_lchans(). In gscon_release_lchans(), pass the cause to
gscon_release_lchan(), and then lchan_release(), which sets the new
lchan.release.cause_rr to the passed cause value.

As soon as the lchan FSM enters the proper state, it calls
gsm48_send_rr_release(). There, set the cause value in the encoded message to
lchan.release.cause_rr.

Interworking with osmo-msc: so far, osmo-msc fails to set the Clear Command
cause code for normal release, it just passes 0 which amounts to
GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE. Before this patch, osmo-bsc
always sent GSM48_RR_CAUSE_NORMAL in the RR Channel Release, and after this
patch it will receive 0 == GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE from
osmo-msc and more accurately translate that to GSM48_RR_CAUSE_PROT_ERROR_UNSPC.
This means in practice that we will now see an error cause in RR Channel
Release instead of GSM48_RR_CAUSE_NORMAL when working with osmo-msc. For
changing osmo-msc to send GSM0808_CAUSE_CALL_CONTROL instead (which translates
to GSM48_RR_CAUSE_NORMAL), see OS#4664 and change-id
I1347ed72ae7d7ea73a557b866e764819c5ef8c42 (osmo-msc).

A test for this is in Ie6c99f28b610a67f2d59ec00b3541940e882251b
(osmo-ttcn3-hacks).

Related: SYS#4872
Change-Id: I734cc55c501d61bbdadee81a223b26f9df57f959
2020-07-16 12:03:19 +00:00
Pau Espin a6ab8ce7d1 Fix trailing whitespace in several files
Change-Id: Ide9921dfce3b6d7c580edaa612a3063c94319a02
2020-07-15 20:54:09 +02:00
Pau Espin 1ee7e55cd1 gsm_data.h: Drop duplicated include stdint.h
Change-Id: I7610cffc3a641975e05ba4ea9f469e12c99e407f
2020-07-15 19:30:27 +02:00
Neels Hofmeyr 19ec374e7e SI2quater: allow storing 48 EARFCNs
Up to 16 SI2quater are multiplexed; each fits 3 EARFCNS, so the practical
maximum is 48 (of course depending on how many bits are used by other SI2quater
elements).

Change-Id: Iabeed10053ee5899b4def3509aedd25abb2410a9
2020-07-08 03:33:13 +02:00
Vadim Yanitskiy f6983f68a9 system_information: publicly declare generate_cell_chan_list()
Change-Id: Idc7a9ed558ed6897e15a0f6d3c23418db7cee0d0
2020-07-03 03:27:17 +07:00
Vadim Yanitskiy 6281d4f869 fix crashes due to OSMO_ASSERT(conn->lchan)
Starting from ttcn3-bsc-test-sccplite build #777, it was noticed
that osmo-bsc crashes with the following message:

  Assert failed conn->lchan include/osmocom/bsc/gsm_data.h:1376

The cause of this is a recently merged patch that calls conn_get_bts() during
assignment_fsm rate counter dispatch:
"Count assignment rates per BTS as well"
commit b5ccf09fc4
Change-Id I0009e51d4caf68e762138d98e2e23d49acc3cc1a

The root cause being that the assignment_fsm attempts to count an Assignment
event for a BTS after the lchan has already been released and disassociated
from the conn.

The assertion is found in conn_get_bts(), which is used in various places. In
fact, each caller is a potential DoS risk -- though most are in code paths that
are guaranteed to have an lchan and bts present, having an OSMO_ASSERT() on the
relatively volatile presence of an lchan is not a good idea for osmo-bsc's
stability and error resilience.

- Change conn_get_bts() to return NULL in the lack of an lchan.
- Adjust all callers of conn_get_bts() to gracefully handle a NULL return val.
- Same for cgi_for_msc() and callers, closely related.

Here is a backtrace:

  Program received signal SIGABRT
  pwndbg> bt
    0x0000555555be6e52 in conn_get_bts (conn=0x622000057160) at include/osmocom/bsc/gsm_data.h:1376
    0x0000555555c1edc8 in assignment_fsm_timer_cb (fi=0x612000060220) at assignment_fsm.c:758
    0x00007ffff72b1104 in fsm_tmr_cb (data=0x612000060220) at libosmocore/src/fsm.c:325
    0x00007ffff72ab062 in osmo_timers_update () at libosmocore/src/timer.c:257
    0x00007ffff72ab5d2 in _osmo_select_main (polling=0) at libosmocore/src/select.c:260
    0x00007ffff72abd2f in osmo_select_main_ctx (polling=<optimized out>) at libosmocore/src/select.c:291
    0x0000555555e1b81b in main (argc=3, argv=0x7fffffffe1b8) at osmo_bsc_main.c:953
    0x00007ffff6752002 in __libc_start_main () from /usr/lib/libc.so.6
    0x0000555555b61bbe in _start ()

In the case of the assignment_fsm counter, we now miss a chance to increase a
BTS counter for a failed Assignment, but this is a separate problem. The main
point of this patch is that osmo-bsc must not crash.

Related: OS#4620, OS#4619
Patch-by: fixeria
Tweaked-by: neels
Fixes: I0009e51d4caf68e762138d98e2e23d49acc3cc1a
Change-Id: Id681dfb0ad654bdb4b71805d1ad4f39a8bf6bbd1
2020-06-23 12:53:50 +00:00
Harald Welte 0415a5c5fa Count RSL DELETE INDICATION received from BTS
If the BTS downlink CCCH (PCH + AGCH) queue is full, it sends
us an RSL DELETE INDICATION.  So far, osmo-bsc logs this as

<0004> abis_rsl.c:2026 Unimplemented Abis RSL TRX message type 0x14

which is not very helpful.  Instead, make the log message more
descriptive and add a rate counter for monitoring.

Change-Id: I9bd2966db90e39ccca442d6bc9abc91e9a9147d4
Closes: OS#3190
2020-06-21 16:07:15 +00:00
Neels Hofmeyr 1c963eb97d MSC pooling: add rate counters
Tests for these counters are added in I2006f1def5352b4b73d0159bfcaa2da9c64bfe3f
(osmo-ttcn3-hacks).

Change-Id: I2ded757958dfa62b502efbab765203bcadf899e2
2020-06-17 05:05:40 +02:00
Neels Hofmeyr b69db82b1c MSC pooling: add 'no allow-attach' for MSC off-loading
As in 3GPP TS 23.236, to offload an MSC, the BSC must be able to avoid
attaching new subscribers to it:

4.5a.1: "UEs being moved from one CN node are stopped from registering to the
same CN node again by an O&M command in BSCs and RNCs connected to the pool."

Change-Id: I6249201c15d0f6565aca643c21d2375c9ca58584
2020-06-17 00:14:01 +02:00
Neels Hofmeyr 4099f1db50 MSC pooling: make NRI mappings VTY configurable
Use the osmo_nri_ranges API to manage each MSC's NRI ranges by VTY
configuration.

Change-Id: I6c251f2744d7be26fc4ad74adefc96a6a3fe08b0
2020-06-17 00:14:01 +02:00
Neels Hofmeyr a87646cd84 use osmo_mobile_identity API everywhere
Depends: If4f7be606e54cfa1c59084cf169785b1cbda5cf5 (libosmocore)
Change-Id: I71c3b4c65dbfdfa51409e09d4868aea83225338a
2020-06-16 14:56:57 +02:00
Neels Hofmeyr 2c61245935 remove extract_sub(), add bsc_subscr_find_or_create_by_mi()
Use the new osmo_mobile_identity API to shed some code dup and simplify.
gsm48_paging_extract_mi() is now unused, drop.

(More refactoring to use osmo_mobile_identity follows in subsequent patch.)

Depends: If4f7be606e54cfa1c59084cf169785b1cbda5cf5 (libosmocore)
Change-Id: Id6cccaac64392b737b3bba8f3a22a88009adb23b
2020-06-16 14:56:57 +02:00
Daniel Willmann b5ccf09fc4 Count assignment rates per BTS as well
This adds the assignment counters for the BTS as well and changes the
assignment_count() macro to increase both the counters for the BSC as
well as the BTS.

Related: SYS#4877
Change-Id: I0009e51d4caf68e762138d98e2e23d49acc3cc1a
2020-06-16 09:07:20 +00:00
Daniel Willmann fea5d640d4 abis_rsl: Count successful channel requests
Ticket: SYS#4877
Change-Id: I5c51956569223e802f4789dc5ed1605d18f80aea
2020-06-16 08:43:45 +00:00
Daniel Willmann ce7aa0d5c2 gsm_data.h: Remove period at end of counter description
Change-Id: I045cef207603074bd018e40f984263d03db31405
2020-06-16 08:43:45 +00:00
Neels Hofmeyr eec776e9ca refactor bsc_find_msc()'s round-robin
Prepare for MSC pooling by NRI. Before introducing actual NRI decoding and MSC
matching, fix the bsc_find_msc() implementation.
(Indicate the places relevant for NRI by "TODO" comments).

bsc_find_msc() puts an MSC to the end of the internal list of MSCs when it was
used. This has problems:

- Modifying the list affects VTY output, e.g. 'show running-config' and
  'show mscs' change their order in which MSCs are shown, depending on how
  often a round-robin selection has taken place.

- Emergency calls and normal calls potentially pick quite different sets of
  eligible MSCs. When the round-robin choices between these sets affect each
  other, the choice is not balanced. For example, if only the first MSC is
  allow_emerg == true, every emergency call would reset the round-robin state
  to the first MSC in the list, also for normal calls. If there are regular
  emergency calls, normal calls will then tend to load more onto the first few
  MSCs after those picked for emergency calls.

Fix: Never affect the ordering of MSCs in the internal list of MSCs. Instead,
keep a "next_nr" MSC index and determine the next round-robin target like that.
Keep a separate "next_emerg_nr" MSC index so that emergency call round-robin
does no longer cause normal round-robin to skip MSCs.

Further problems in current bsc_find_msc():

- The "blind:" label should also do round-robin.
- The "paging:" part should not attempt to use disconnected MSCs.
- Both should also heed NRI matches (when they are added).

Fix: instead of code dup, determine Paging Response matching with an earlier
Paging Request right at the start. If that yields no usable MSC, continue into
the normal NRI and round-robin selection.

The loop in this patch is inspired by the upcoming implementation of MSC
pooling by NRI, as indicated by the two TODO comments. The point is that, in
the presence of an NRI from a TMSI identity, we always need to iterate all of
the MSCs to find possible NRI matches. The two round-robin sets (Emergency and
non-Emergency) are determined in the same loop iteration for cases that have no
or match no NRI, or where a matching MSC is currently disconnected.

Change-Id: Idf71f07ba5a17d5b870dc1a5a2875b6fedb61291
2020-06-10 14:21:11 +02:00
Vadim Yanitskiy 4f3a64182e handover_test: use 'unknown' BTS type instead of 'sysmobts'
This unit test does not really need a BTS of such specific type.

Change-Id: Id676042518d06e94a9fb20112334280e2b91074b
2020-05-31 02:14:28 +07:00
Vadim Yanitskiy c1b141c8c3 gsm_data: cosmetic: mark argument of is_*_bts() as const
Change-Id: Ifa084e34cbea006e09c83a530e1434a22895e9aa
2020-05-31 02:14:28 +07:00
Neels Hofmeyr 06a14d289b flatten: move network->bsc_data->* to network->*
The separate struct osmo_bsc_data is like another separate struct gsm_network
for no reason. It is labeled "per-BSC data". These days, all of this is a
single BSC and there will not be different sets of osmo_bsc_data.

Drop struct osmo_bsc_data, move its members directly into gsm_network.

Some places tested 'if (net->bsc_data)', which is always true. Modify those
cases to rather do checks like 'if (net->rf_ctrl)', which are also always true
AFAICT, to keep as much unmodified logic as possible in this patch.

Change-Id: Ic7ae65e3b36e6e4b279eb01ad594f1226b5929e0
2020-05-29 20:16:40 +00:00
Neels Hofmeyr b281b1cdb6 drop MSC types "local" vs "normal"
Another legacy feature. All that this setting effectively does is prevent MSCs
from being contacted for non-emergency calls. To select which MSCs shall handle
emergency calls, there is the allow_emerg flag.

Change-Id: I7fc630d9c35be9a69a0d378d3de2b2312c69690d
2020-05-29 20:16:40 +00:00
Neels Hofmeyr 6a8955b741 drop all BSC originated USSD notification features
The BSC is the wrong network component to originate USSD messaging, as can be
seen in the hacks in the USSD code: for example, the BSC would send a CM
Service Accept message as if an MSC had accepted the connection, dispatch a
USSD and directly send some RR release message (without proper tear down
messaging like the lchan_fsm does these days). This made sense in the osmo-nitb
world, but by now we are aiming for solid 3GPP compliance. The BSC shall not
originate USSD messages.

Deprecate all VTY and CTRL commands related to USSD:
VTY
 [no] bsc-welcome-text
 [no] bsc-msc-lost-text
 [no] bsc-grace-text
 [no] missing-msc-text
 (the commands with 'no' are ignored, without 'no' lead to an error)
CTRL
 ussd-notify-v1

Drop (already unused) ussd.h.
Drop gsm_04_80.h, gsm_04_80_utils.c, and all calling code.

Drop "RF grace" notification, where osmo-bsc was able to notify active
subscribers that the RF was being turned off.

Change-Id: Iaef6f2e01b4dbf2bff0a0bb50d6851f50ae79f6a
2020-05-29 20:16:40 +00:00
Neels Hofmeyr bf4134edaf drop CC 'local-prefix' feature
It is not entirely clear to me what this used to do once, but I've stumbled
upon this before. By now I am certain that this is a non-standard legacy
feature. The BSC does *not* redirect connections during CC transactions.

Along with this, a bunch of legacy utility functions can be dropped. All of
this is unused code.

(Preparing for MSC pooling.)

Change-Id: Id54afe8ccf0e11b9121a733224054c9565eafb58
2020-05-29 20:16:40 +00:00
Alexander Chemeris 001a2df2ed stats: Count paging requests flushed due to MSC Reset.
Change-Id: Ie93fc54fecdfcf615483f7f41a36dbcea61a537b
2020-05-28 09:01:20 +00:00
Neels Hofmeyr 5cda1d01b4 drop IMSI filter and libfilter completely
Filtering by IMSI in osmo-bsc is a legacy use case with questionable
usefulness. Remove.

Do not keep deprecated VTY commands: those could be dangerous, since
(presumably non-existing) users might assume that the filtering would still be
in place. Rather fail to start osmo-bsc for config with an IMSI ACL.

The IMSI filtering did, if present, provide the logging with an IMSI to print
for the bsc_subscriber. TMSIs should have ended up in logging likewise, which
has never been implemented. The proper way to learn the IMSI would be by the
Common Id message from the MSC. Furthermore, the upcoming MSC pooling feature
will extract the mobile identity again, and will hence make sure that both IMSI
and TMSI identities, as available, end up in the bsc_subscriber and will be
logged again.

So long, IMSI ACL, and thanks for all the fish.

Change-Id: I89727af5387e8360362e995fdee959883c37d89a
2020-05-27 01:56:06 +02:00
Neels Hofmeyr c8f432a849 deprecate 'msc' / 'ip.access rtp-base <port>'
The bsc_msc_data->rtp_base has been unused ever since we introduced the exernal
MGW in osmo-bsc [1]. The vty command also still exists. Deprecate the vty
command, remove the member.

[1] "mgcp: use osmo-mgw to switch RTP streams"
    commit 39c609b7c9
    Change-Id Ia2882b7ca31a3219c676986e85045fa08a425d7a

Change-Id: Id14fa3066ca5d472a817593074a6222f159168a8
2020-05-19 20:31:29 +00:00
Alexander Chemeris 3a656da1c6 bssap: Handle BSSMAP CONFUSION message.
We decode the mesage and print it to the log files at ERROR log level.
We also count it in the BSSMAP message counters. There is not much
else we could do about it.

Depends: If8afd2d096fb66c6c2f255a08fc1129de3d09cec (libosmocore)
Change-Id: Ib4cd94f185f751b2384842222678ff671ac413c4
2020-05-19 20:00:32 +00:00
Alexander Chemeris 43def7493c stats: Add a BTS/BSC counter PAGING_NO_ACTIVE_PAGING.
This is a corner case but still we should count the events to
know when is this happening. And for the number of paging requests
to match the number of paging responses.

Change-Id: I1755be40d29980b75353cb4b8087d1ce0d92854a
2020-05-19 20:00:32 +00:00
Alexander Chemeris 5d63827318 stats: Add counters and gauges for BORKEN lchans/TS
Now we can monitor the situation with the BORKEN lchans and TS in our
BTS's over time.

Change-Id: I427bbe1613a0e92bff432a7d76592fe50f620ebe
2020-05-19 20:00:32 +00:00
Alexander Chemeris aac5423415 stats: Rename BSSMAP Rx message counters to match Tx ones.
Change-Id: I29e42687ac084a60007f0b1ec6ec0a102fb4007f
2020-05-11 12:03:21 +03:00
Alexander Chemeris 98824b8f06 stats: Add counters for Tx BSSMAP messages.
We already have counters for Rx side, now we also count Tx side.
See comments in the msc_ctr_description array implementation for
the details.

Change-Id: I89a173f6bdd9a3c21233fe01d07ab2ff0442bb10
2020-05-11 12:03:21 +03:00
Alexander Chemeris 8b0f6879ed stats: Export connected OML/RSL links count per BTS.
Change-Id: I88c8025940a0eecb034b1c70f76ea17937fa0325
2020-05-09 12:26:06 +03:00
Alexander Chemeris e26b153bd8 stats: Add counters for received BSSMAP messages.
Change-Id: I3f08d71b58b4e8d6f61376d85c2051e194aa8e43
2020-05-09 12:26:06 +03:00
Alexander Chemeris db54283954 stats: report a number of configured BTS to a stats gauge.
It's useful to know how many BTS are actually configured to compare
it to a number of connected BTS's.

Change-Id: I41cb60f9cb962003227e4a7b63db05acbcdb6f4c
2020-05-09 12:26:06 +03:00
Alexander Chemeris 5e89333b27 stats: Add a stats gauge for the MSC links count.
Change-Id: Ibe4b29056ba704a27b925cfdba49f343ee34f428
2020-05-09 12:26:06 +03:00
Sylvain Munaut 57a1ec5b2e gsm_data: Update trx_is_usable for ericsson BTS
There is no bb_transc oject.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I34bb808cd21575ff25d36e6df028b140935a008f
2020-05-09 08:05:21 +00:00
Alexander Chemeris b091def16e stats: Report per channel type load to statsd counters.
Change-Id: I2eac4c93061204aeb8f3d223f7e78158c61c7156
2020-05-08 20:25:54 +00:00
Sylvain Munaut cbaa179945 om2k: Add support for MCTR configuration
Currently only supports a single MCTR with fixed configuration

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I96b8bb2c01c05bf153fc924f62bd6aafa96725ee
2020-05-08 15:16:15 +02:00
Sylvain Munaut dbd1b50604 om2k: Add option to limit OML version during negotiation
Starting from G12R13 the MCTR swiches to BSC controlled mode. And
although we think we know how to configure it (via MCTR Conf Req),
something doesn't work right and the timeslot configuration is not
accepted. (TS Conf Result shows "Data not according to request").

So as a workaround for now, we use this version of the protocol where
we don't configure the MCTR (it's in "BTS controlled mode") and with
this protocol, the BTS accepts our timeslot config and we can bring
the system up.

This commit add a generic option to limit either OML or RSL IWD
version to any value. It also keeps track of the actual negotation
version so we can react to it in other places of the code.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I8f0b0ba72056ea4250fe490e7a38630c77c04f65

better version limit

Change-Id: Ia789f8ede3eab7eeca6c759da0109e0b53398f60
2020-05-08 15:16:15 +02:00
Harald Welte 456a62e98e bts_nokia_site: Fix LAPD segfault during reset procedure
The existing Nokia *Site code destroyed the LAPD SAP instance for OML
while processing an OML message.  Once the stack frame returned back
to the LAPD code, the LAPD SAP was gone -> segfault.

Let's work around this by moving deletion of the LAPD SAP out-of-line
by starting a timer 0ms in the future.  Not particularly nice, but
effective.

Change-Id: I6270c7210f600e53f845561898245d2fd30a368d
Closes: OS#1761
2020-05-08 13:27:40 +02:00
Harald Welte 1d7349ffc9 gsm_data.h: Comment the 'nokia' BTS fields
Change-Id: I5e3eaf3dee97e2edcd80b20c3acf85bd89b40cdc
2020-05-04 08:20:06 +00:00
Sylvain Munaut e55e76f4c7 om2k: Add VTY command to allow TX of arbitrary message for testing
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I5a385614fc670946f83ea79cc176c2d448675672
2020-04-28 09:50:59 +02:00
Sylvain Munaut d9fe61c43f om2k: Allow the CON configuration request to be triggered via VTY
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id1171a151773182bb5cdc14c023c3637fb9ad0bc
2020-04-28 09:50:59 +02:00
Sylvain Munaut 63d7661147 om2k: Add definitions for the TG object
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I6d90554a54baa78f454281a486e4b5e95784fdee
2020-04-28 09:29:14 +02:00
Harald Welte 7463285994 handorer.h: Fix compilation with gcc-10
/usr/bin/ld: bsc_subscr_conn_fsm.o:/home/laforge/projects/git/osmo-bsc/src/osmo-bsc/../../include/osmocom/bsc/handover.h:26: multiple definition of `mr'; abis_rsl.o:/home/laforge/projects/git/osmo-bsc/src/osmo-bsc/../../include/osmocom/bsc/handover.h:26: first defined here

See also https://alioth-lists.debian.net/pipermail/debian-mobcom-maintainers/Week-of-Mon-20200413/000649.html

Change-Id: Ic21af84f2a6de48d220940f30dad02a0e7683ce8
2020-04-20 18:18:05 +00:00
Vadim Yanitskiy e981f17200 vty: clarify EGPRS Packet Channel Request message support
According to 3GPP TS 44.060, section 12.24, GPRS Cell Options IE
contains two parameters related to 11 bit Access Burst support:

  - ACCESS_BURST_TYPE - whether the 8 or 11 bit format shall be
    used in the PACKET CHANNEL REQUEST message, the PTCCH/U block,
    PACKET CONTROL ACKNOWLEDGMENT and the PS HANDOVER ACCESS
    messages on the PRACH (if present).

  - EGPRS_PACKET_CHANNEL_REQUEST - whether EGPRS capable MSs shall
    use EGPRS PACKET CHANNEL REQUEST message for Uplink TBF
    establishment on the RACH or on the PRACH (if present).

The VTY option 'gprs 11bit_rach_support_for_egprs' actually controls
the second parameter - EGPRS_PACKET_CHANNEL_REQUEST, though it may
be hard to understand this from its name and description.

This patch is actually a group of tightly related changes:

  - deprecate 'gprs 11bit_rach_support_for_egprs (0|1)':
    - update its description to avoid any possible confusion,
    - print a warning if it's used in non-EGPRS mode,
    - print a warning if it's still used;

  - introduce '[no] gprs egprs-packet-channel-request':
    - ensure that it can only set / printed in the EGPRS mode;

  - take a chance to clean-up / rename the related struct members:
    - 'supports_egprs_11bit_rach' -> bool 'egprs_pkt_chan_request',
    - remove 'supports_egprs_11bit_rach' from 'gprs_cell_options'
      because we already have 'ext_info.use_egprs_p_ch_req' there.

Change-Id: Ied5bd10a806aeeac65ef32339d4ab0e3700e5da9
2020-04-14 15:50:10 +00:00
Vadim Yanitskiy 0c94d7257e rest_octets: cosmetic: fix alignment in gprs_cell_options
Change-Id: I344ea61df8cc910d9b524c9b2f0e03721eefe56c
2020-04-06 19:00:05 +07:00
Harald Welte 25e41af2d9 remove 'NAT' log category
This dates back to a time where osmo-bsc_nat was in the same repository,
which is a long time ago.

Change-Id: Id965295dfe04f8bd5ce831db70c86f67b8dc290b
2020-04-01 11:57:37 +02:00
Oliver Smith ba0a12233f VTY: add show bts failure report
Save OML failure reports from each BTS. Add a VTY command to display them
conveniently and optionally clear the list.

OsmoBSC> show bts 0 fail-rep
[2020-03-23 14:51:22] Type=processing failure, Severity=minor failure, Probable cause=Manufacturer specific values: Software warning, Additional text=test message sent from VTY
[2020-03-23 14:51:19] Type=processing failure, Severity=minor failure, Probable cause=Manufacturer specific values: Software warning, Additional text=test message sent from VTY

Related: OS#1605
Change-Id: I18aa17a721cd5eb1c98926dc2367229c0a50bc78
2020-03-27 09:55:30 +01:00
Oliver Smith cd1df9975c abis_nm: move fail report parsing to extra func
Separate raw input parsing from handling the failure report. A follow-up
patch will use the new parsing function to print saved failure reports
to the VTY.

While at it, put struct tlv_parsed inside struct nm_fail_rep_signal_data
instead of a pointer, so we don't need an additional alloc. Also add
error handling to the abis_nm_tlv_parse() call.

Related: OS#1605
Change-Id: Ia51004faf620aa4d40435d58c70d758c9d0054d8
2020-03-26 14:52:02 +01:00
Oliver Smith a595db15ea main: exit on mutually exclusive codecs settings
Refuse to start with mutually exclusive codec settings, unless
allow-unusable-timeslots is set in the network section of the config.
The checks were already implemented and fill the error log if the config
is invalid.

Related: OS#3739
Change-Id: I3ccfc3b0a8641400cb97a23b24d7ed92d2ad25cd
2020-03-19 12:29:22 +01:00
Harald Welte 2fa9763fb8 OM2000: Add some more message types and IEs we now understand
OM2000 is not only used for the venerable RBS2000 family, but also
for the more modern RBS6000 family, specifically the DUG 20 GSM
baseband unit.

In RBS6000, there are some protocol extensions which are not yet fully
understood. However, we are understanding some bits around the MCTR
(multi carrier transceiver?), a new MO that appears to be present for
every physical RUS (Radio Unit) attached to the DUG 20.

Let's add what we have learned so far.

Thanks to Sylvain Munaut for his help with this.

Change-Id: Ib868358eca12b94c4fcca58e94ec8ab1a4edfda2
2020-01-29 09:21:00 +01:00
Harald Welte 35d07b7698 Introduce nm_fail_rep_signal_data for "SS_NM, S_NM_FAIL_REP" signal
Let's not just pass around the raw msgb, but also all other metadata,
such as the decoded parts of the TS 12.21 message.

As there's no current consumer of that signal, this creates no
compatibility issues.

Change-Id: I5d4d9d422b4e23348ffbe69c6e87a31d5574f90d
2020-01-06 10:28:18 +00:00
Pau Espin 7950e5d90c bsc: Adapt maximum MS Power Ctrl level based on band and MS Power class
Related: OS#4244
Change-Id: I6bff440b7797e710bca5af94fae546e5d55e6972
2019-11-19 00:52:18 +00:00
Martin Hauke a29affda98 Fix some typos
Fix typos and common misspellings in code comments and in the manual.

Change-Id: I46fc9d424620c77ae9ccf78b58081bd303386d7c
2019-11-13 22:10:41 +01:00
Vadim Yanitskiy 73bd463061 osmo_bsc_main.c: verify the physical channel mapping at startup
As per 3GPP TS 45.002, section 3.3.2.3, and table 3 of clause 7,
the following limitations apply mapping of CCCH/BCCH channels:

  - TS0/C0 shall be configured as CCCH/BCCH (optionally combined);
  - combined CCCH (CCCH+SDCCH4) can only be used on TS0;
  - additional CCCHs can be on TS2, TS4, and TS6;
  - additional CCCHs are not allowed if TS0 is combined.

Let's make sure that OsmoBSC is properly configured before starring.

Change-Id: I758ef80f7884ba35cdf59d671ee30222ffb9d68b
2019-11-02 02:48:21 +07:00
Pau Espin 00201b64f0 gsm_data.h: Remove unused func declarations
Change-Id: I189d34b6db78de749e1901733d0df35411e0d583
2019-10-31 16:01:33 +01:00
Pau Espin 74e0b5bfff gsm_data.h: Remove unused field classmark from gsm_subscriber_connection
Change-Id: If2826a8f334afabfa3a0198a0bc1eed009962c81
2019-10-31 14:08:42 +01:00
Pau Espin b37e963248 Remove unused API classmark_is_r99()
Furthermore, similar API already exist in libosmocore:
osmo_gsm48_classmark_is_r99()

Change-Id: I6763d8c894f0a0555a9801bddbc0a12c2b945599
2019-10-31 13:46:37 +01:00
Pau Espin 120746e66f gsm_08_08.c: Mark func bsc_find_msc() static
Its currently only used by bsc_compl_l3() in same file.

Change-Id: I7273a9452dbc4c1285cfa69269fa36ab09551d89
2019-10-03 17:22:11 +02:00
Harald Welte 7d88844909 SMSCB: Send ETWS Primary Notifiation via RSL to BTS
In addition to transmission of the ETWS Primary Notification via all
dedicated channels, we also need to send it to the BTS for transmission
via PCH (P1 Rest Octets) and for forwarding to PCU for PACCH
transmission.

Change-Id: I7e45b0373458a4348b12b92dd92861062532548b
2019-09-08 08:39:17 +00:00
Harald Welte bbd0bfff17 SMSCB: Send ETWS primary warning message via all dedicated channels
As soon as we have received an ETWS primary notification message from
the CBC, we should transmit it as "RR Application Information" to all
dedicated channels.

Change-Id: I913d0237cffdcb95037da8489acef5f32a7fc02e
2019-09-06 23:09:54 +02:00
Harald Welte d41b7c7f83 Cell Broadcast: CBSP and CBCH scheduling support
This adds code to handle CBSP (Cell Broadcast Service Protocol)
from the CBC (Cell Broadcast Centre), as well as BSC-internal data
structures for scheduling the various SMSCB on the CBCH of each BTS.

There are currently one known shortcoming in the code: We don't yet
verify if keepalives are received within repetition period.

Change-Id: Ia0a0de862a104d0f447a5d6e56c7c83981b825c7
2019-09-02 12:06:25 +02:00
Neels Hofmeyr 91a202d488 neighbor config: allow re-using ARFCN+BSIC pairs
Fix neighbor config to match OsmoBSC manual: implement the plan for neighbor
configuration that was so far only described in the manual without actually
being in operation.

This first allows re-using ARFCN+BSIC pairs in and across BSS.

So far the handover_start() code always looked for handover target cells across
*all* local cells, even if they were not listed as neighbors to a source cell.
Imply all cells as neighbors only as long as there are no explicit neighbors
configured. As soon as the first 'neighbor' line appears in a 'bts' config,
only the listed neighbors are regarded as handover target cells. (The
'neighbor-list' commands are not related to this, only the relatively new
'neighbor (bts|lac|cgi|...)' commands affect actual handover procedures.)

TTCN3 tests TC_ho_neighbor_config_1 thru _7 play through the various aspects of
neighbor configuration: both the legacy implicit all-cells-are-neighbors as
well as allowing only explicit neighbors by config.

Related: OS#4056
Related: osmo-ttcn3-hacks Ia4ba0e75abd3d45a3422b2525e5f938cdc5a04cc
Change-Id: I29bca59ab232eddc74e0d4698efb9c9992443983
2019-08-13 23:47:23 +02:00
Philipp Maier 3bc9b16459 bsc_msc_data: remove unused member is_authenticated
The struct member struct bsc_msc_data->is_authenticated is set to true
permanently. This is a leftover from the sccplite implementation and can
be removed now.

Change-Id: I966a48b383c85345c92c9a1fec791150e96cd7b9
Related: OS#3112
2019-08-12 08:43:44 +00:00
Harald Welte afe987f848 logging: introduce LOG_BTS and LOG_TRX and use it everywhere
It's quite ugly to have manual "bts=%d" printf-statements all over
the BSC code.  Let's change this to use shared logging helper functions
all over the place, whenever we need to log something related to one
BTS or one TRX.

This can also help us as the first step to later add alternative logging
of BTS identities, e.g. by printing the Cell Global Identifier or
LAC+CI, or even a human-readable/vty-defined 'name' of the BTS, rather
than its numeric bts number.  With this change in place, we can
introduce such changes at a single location in the code.

Change-Id: I4a7814d164384eecfb6913c31802cf2faead6e6c
2019-07-16 04:00:19 +00:00
Neels Hofmeyr 08822a3302 comment and VTY doc tweaks
Clarify some in-code comments.

Fix descriptions of some handover timers, which still talked of "MO" and "MT"
handover -- which we now call "inter-BSC out" or "inter-BSC in" instead.

Change-Id: I8429a830edd0325893ac90f22fcc05309617bd2d
2019-07-13 05:07:53 +02:00
Neels Hofmeyr 08371ecc01 doc/manuals, vty doc: more handover doc clarifications
Related: OS#3487
Change-Id: I1639efb2dbcca4f0e9c33a74f3067606ce5f4209
2019-07-09 15:42:38 +00:00
Neels Hofmeyr 0fb9206c6a make bsc_clear_request() static
bsc_clear_request() is in fact used only within gsm_08_08.c, make it static to
that file.

Since the gscon FSM, "real" BSSMAP Clear are sent only by gscon_bssmap_clear().

bsc_clear_request() remains in use for legacy code paths in gsm_08_08.c:
- the bsc_filter, i.e. for IMSI filtering;
- in move_to_msc(), from handle_cc_setup(), a code path that is in fact not
  entirely clear to me. It seems to be an old functionality to serve multiple
  MSCs?

Both of which I personally haven't seen in use, are not tested and should
probably be completely removed.

For now contain legacy code in the static context.

Adjust comment.

Change-Id: Ic89d0afad42e4b11183a13d2dc6b7bbf0b822fd9
2019-07-08 15:23:23 +02:00
Harald Welte 1626f90946 Re-introduce support for IPA-encapsulated MGCP
Old osmo-bsc-sccplite already supported this, but in the migration
over to libosmo-sigtran and to real 3GPP AoIP, this functionality
got lost.

We now create a UDP proxy socket. Any MGCP commands received via IPA
from MSC (or rather: bsc_nat) are retransmitted to the MGW via UDP on
this socket.  Any responses back from the MGW received on the UDP
socket are retransmitted back to MSC/bsc_nat as MGCP inside the IPA
multiplex.

Closes: OS#2536
Change-Id: I38ad8fa645c08900e0e1f1b4b96136bc6d96b3ab
2019-06-18 18:09:26 +00:00
Pau Espin 062cd20993 Remove extern declarations of libosmovty symbols
The library has the declarations since 2011, so it's time to
get them removed from here.

Depends: libosmocore d61d517a2e35f482519561bd325652ee7144679a
Change-Id: I5c8d02605a78c6792f616ad423b4491b83f42545
2019-06-18 18:09:26 +00:00
Pau Espin ed41e8c08e Introduce msc_is_{sccplite,aoip}() helpers
Having the helper makes it easier to read/find for transport type checks. It
will be ifurther re-used in forthcoming commits.

Change-Id: Ic0ee4c472e29ec3092049e5e23b744395613616d
2019-06-06 19:43:05 +00:00
Harald Welte 1540025181 Allow VTY to set the CCCH Load Indication Threshold
Add a new VTY command "ccch load-indication-threshold <0-100>"
by which the user can configure the threshold after which the BTS
shall send CCCH LOAD IND.  It used to be hard-coded to a
default value of 10.

Change-Id: I059fe4627438e26a06e00d84e342b736ab7af440
2019-05-26 09:10:32 +00:00
Harald Welte be86caacdf keep per-BTS stat_items about RACH busy / RACH access percentage
Change-Id: I3ad0cc4866d6210181cbafbab876e8028ad27540
2019-05-24 09:12:57 +00:00
Harald Welte ae46685a63 abis_rsl: Add support for extended CBCH to rsl_sms_cb_command()
Now that OsmoBTS understands about extended CBCH, let's at least
update the BSC side function to allow for other code to generate
such messages.

Change-Id: I77a16b75ce311d63fb022475c8ff25fbbcee7f55
2019-05-24 10:46:37 +02:00
Pau Espin 83c0f76d21 bssap: Parse Osmux CID on BSSAP Assign Req recv and use it in MGCP
The Osmux CID obtained from the MSC is passed to the co-located BSC MGW
to configure the MSC-side MGW conn of a call leg.

Depends on: osmo-mgw.git I73b4c62baf39050da81d65553cbea07bc51163de
Change-Id: I86e7e13fc7921e3209fb764c0e7797e7ec09b79e
2019-05-19 22:36:18 +00:00
Pau Espin a94907ec06 bssap: Detect MSC Osmux support on RESET (ACK) recv
Related: OS#2551
Depends on: libosmocore I28f83e2e32b9533c99e65ccc1562900ac2aec74e
Change-Id: I830e38cc1ffb8b6ebbe299567507160f19beb528
2019-05-19 07:26:28 +00:00
Pau Espin 6c548dc615 vty: Add option to enable osmux towards MSC
Change-Id: I30c485c022f2d55e0a004f69b2503da7f91ecb74
2019-05-19 07:26:28 +00:00
Neels Hofmeyr 5a06da1a95 fix inter-BSC-HO-incoming for AoIP (1/2)
Move the HO_ST_WAIT_MGW_ENDPOINT_TO_MSC state up to right after the lchan is
done establishing. For AoIP, the local RTP address towards the MSC already
needs to be known before the Handover Request Acknowledge is sent, so the AoIP
Transport Layer Address IE can be included. This patch only modifies the
handover FSM, a subsequent patch adds the IE.

Change-Id: I00c18b78573386145af71c4b39f7f22aec24579b
2019-05-05 13:27:25 +02:00
Sylvain Munaut aa82492ad6 assignment_fsm: Properly support assigning signalling mode TCH/x
To support the 3 possible preferences, the changes needed were:
 - Replace 'full_rate' bool with a 3 option enum to represent
   the channels types for signalling
 - Switch from _pref/_alt to using an array sorted in preference
   order

Originally merged as Change-Id I4c7499c8c866ea3ff7b1327edb3615d003d927d3,
reverted because the change broke voice calls. Re-submitting with the fix:
don't forget to set conn->assignment.requires_voice_stream.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I7513d2cbe8b695ba6f031ad11560c63a6535cf2d
2019-05-03 16:10:33 +02:00
Neels Hofmeyr f14aaa4ba1 move mgw endpoint FSM to osmo-mgw.git
osmo-mgw.git also includes fixes of the MGW endpoint FSM, for example
I92a9944acc96398acd6649f9c3c5badec5dd6dcc.

Depends: I9a3effd38e72841529df6c135c077116981dea36 (osmo-mgw)
Change-Id: I03e6b48d9b0a5370310d5f56809259ff7909cf9d
2019-04-30 02:24:18 +02:00
Neels Hofmeyr a6078fe1d8 use libosmocore osmo_tdef
Move the T_defs API to libosmocore as osmo_tdefs: remove the local T_defs API
and use libosmocore's osmo_tdef* API instead.

The root reason is moving the mgw_endpoint_fsm to libosmo-mgcp-client to be
able to use it in osmo-msc for inter-MSC handover.

When adding osmo_tdef, the new concept of timer groups was added to the API. It
would make sense to apply group names here as well, but do not modify the VTY
configuration for timers. The future might bring separate groups (or not).

Depends: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5 (libosmocore)
Change-Id: I66674a5d8403d820038762888c846bae10ceac58
2019-04-23 21:57:44 +02:00
Daniel Willmann 62f3b302b0 Revert "fix inter-BSC-HO-incoming for AoIP (1/2)"
This reverts commit 94c9324fe0.
Multiple ttcn3 handover tests were broken due to this commit. Let's
merge this once all the other commits pertaining to that fix can be
merged as well.

Fixes: OS#3942
Change-Id: I01d93778fb19c601c21f99ec4d2a3ab8a4a48f67
2019-04-19 10:31:11 +02:00
Daniel Willmann 1d5eda4b4c gsm_data.h: Remove unused variable from OpenBSC times
This variable does not seem to be used anywere in OsmoBSC, seems to be a
remnant from OpenBSC times.

Change-Id: I5e4aa352fa5f16f6ff64738f25afd1a844fa4fcb
2019-04-17 16:01:11 +00:00
Pau Espin d46a7a0f2a Drop unused old osmux leftover code
Let's better clean up old stuff before doing new implementation.

Change-Id: Id4e254a1c24831afaba9ab7b330d4e09a2474c8e
2019-04-15 20:36:48 +02:00
Neels Hofmeyr 94c9324fe0 fix inter-BSC-HO-incoming for AoIP (1/2)
Move the HO_ST_WAIT_MGW_ENDPOINT_TO_MSC state up to right after the lchan is
done establishing. For AoIP, the local RTP address towards the MSC already
needs to be known before the Handover Request Acknowledge is sent, so the AoIP
Transport Layer Address IE can be included. This patch only modifies the
handover FSM, a subsequent patch adds the IE.

Change-Id: I4a5acdb2d4a0b947cc0c62067a67be88a3d467ff
2019-04-08 16:26:28 +02:00