Commit Graph

50 Commits

Author SHA1 Message Date
Harald Welte 519c7e1d42 Structural reform: Get rid of osmo_bsc_sccp_con
There was always a 1:1 correspondence between gsm_subscriber_connection
and osmo_bsc_sccp_con, so there's really no point in having two separate
dynamically allocated data structures with pointers back and forth and
another linked list around.

Let's merge osmo_bsc_sccp_con into gsm_subscriber_connection for
simplicity.

The resulting code might not be elegant in places, but I've tried to
do only the most simple changes in this patch, while further
simplifications can be done in later subsequent patches.

As a side-effect, this patch also fixes lchan clearing if the MSC
(or the local SCCP provider) hard-disconnects the SCCP connection.

Change-Id: Idd2b733477ee90d24dec369755a00f1c39c93f39
2018-02-19 08:20:35 +00:00
Neels Hofmeyr a60f344212 HO: store speech codec list from BSSMAP Assignment in conn
On BSSMAP Assignment Request received from the MSC, store the Speech Codec List
in the subscr conn, so that we may evaluate available codecs during handover
decision. (Will be used, e.g., by handover_decision_2.)

Change-Id: I8222d73085eb777696e365c94214c05d56e6d129
2018-02-16 16:11:16 +01:00
Neels Hofmeyr cbdfb78f7b HO: move penalty timers to own file as proper API
Separate penalty timers API from specific struct members and move to own .h/.c
file, so that future code may re-use the API arbitrarily.

Change-Id: Ife975a1c7c17a500b1693be620475a8bea72f86f
2018-02-16 16:11:16 +01:00
Neels Hofmeyr 91004ab734 gsm_network: drop unused subscr_epxire_timer
Change-Id: I2e34ffb35e244472f8bfc993facc8d6e130f10d9
2018-02-14 12:55:45 +01:00
Neels Hofmeyr 28838e9aaa drop unused common.h
Change-Id: I7cf4076d7e36ae71d88e70a86d5c2d0640c1146f
2018-02-14 12:55:45 +01:00
Neels Hofmeyr d23ce86c25 drop libcommon-cs completely
Change-Id: I07d4a48af3154ee4d904686f230a51b8b8a94ff9
2018-02-14 12:55:45 +01:00
Neels Hofmeyr 92b9f2ecd4 common_cs.h: mv gsm_encr to gsm_data.h
This leaves common_cs.h practically empty. Leave its removal to the next patch,
which removes libcommon-cs entirely
(I07d4a48af3154ee4d904686f230a51b8b8a94ff9).

Change-Id: Ic3233f03580aa8c0ab178dfd33e68ecab5b9f042
2018-02-14 12:55:45 +01:00
Neels Hofmeyr d85e4cb711 gsm_network: drop unused trans_list
Change-Id: I7910ce8098d5431e41409bf09429ae4221efb360
2018-02-14 12:55:45 +01:00
Neels Hofmeyr 104851632d libcommon: join gsm_data_shared.* into gsm_data.*
The separation of gsm_data_shared.* from gsm_data.* historically allowed
compiling parts of it into osmo-bts, which we have dropped since (osmo-bts has
its own copy now). Even though gsm_data.* now becomes rather large by it,
remove the legacy separation to get rid of the "shared" naming, which is no
longer meaningful. A future patch might separate into meaningful smaller bits,
if we get the time.

Change-Id: Ie247bc492efb331871d970c56700595ad3f7e201
2018-02-14 12:15:40 +01:00
Stefan Sperling 81dc9e7455 Add stat items for the BTS's channel load average and T3122.
In addition to logging the current values of a BTS's channel load
average and T3122 override, maintain stat items for these values.
This allows for plotting these values over time, for instance.

These values show up in the VTY under 'show stats' like this:

base transceiver station:
 Channel load average.:       25 %
 T3122 IMMEDIATE ASSIGNMENT REJECT wait indicator.: 32 s

Change-Id: Icace0176e8b1d23d7c7b4816f7c67c65312844fa
Suggested-by: laforge
2018-02-05 22:36:54 +00:00
Stefan Sperling 6cee893a0f Make "waiting indicator" of IMMEDIATE ASSIGN REJECT dynamic.
The IMMEDIATE ASSIGN REJECT message contains a wait indicator which
tells an MS requesting a channel to wait for a specified amount of
time before trying to request a channel again, i.e. the wait indicator
controls the T3122 timeout value in the MS.

Previously, the wait indicator was fixed to 10 seconds.
This is not sufficient if there are a lot of MS requesting channels
because the MS will retry too soon. Instead of using a fixed value,
maintain a dynamic wait indicator value based on average channel load.

The load (used vs. available channels on a BTS) is sampled once per
second, and once 8 samples have been collected we update a BTS-specific
T3122 wait indicator based on the measured load.

While the wait indicator could go up to 255 seconds, this initial
implementation keeps it in the range from 10 to 128 seconds.

Further experimentation and testing will show whether higher wait
indicator values are desirable, if the sampling rate needs to change,
or if the function mapping the load measurement to a wait indicator
value should change (currently we map the load average linearly into
the range [10, 128] inclusive).

Change-Id: I57e38f6d6ba3b23cc6e1f9520b90261dbb1f1cec
Related: OS#2592
2018-02-05 13:58:17 +01:00
Harald Welte b794887cab remove obsolete gsm_subscriber_connection.bts member
This member was merely a cache for conn->lchan->ts->trx->bts,
so let's avoid having to keep copies of the same data (which needs
to be kept up to date).

Change-Id: Id3bff8b18425ef5d45eb460ac9eb620023013ba0
2018-01-28 03:23:00 +01:00
Andreas Eversberg 084b421fba HO: Add a penalty timer list to the subscriber connection entity
This penalty timer is used to temporarily block cells where handover
or assignment failed or where handover is not allowed. This is usefull
to prevent repeated handover attempts to broken cells or cells that have
limited allowed distance.

Change-Id: I95cb7e3211b2470b773965e7aa94d8eb6c8c1a3a
2018-01-22 01:57:50 +00:00
Andreas Eversberg 935e5d76dd HO: add queue to cache DTAP messages during handover/assignment
Add ho_dtap_cache to gsm_subscriber_connection, a stock msgb queue to be used
with msgb_enqueue() and msgb_dequeue().

Keep a counter of queue length, to enforce a sane maximum counter for cached
messages. So far a hardcoded maximum of 23 messages will be cached.

Have balanced ho_dtap_cache_add() and ho_dtap_cache_flush() functions.

The original patch was by jolly, but I have basically completely replaced it
with the simpler msgb queue pattern.

Change-Id: I6e4d93628befb3d97e5cee0343cd9f8ba0b8620c
2018-01-19 22:09:19 +00:00
Andreas Eversberg 9869203f65 HO: fix: increase the number of measurement report history to 10
If we want to average over up to 10 measurement reports (as configurable
at VTY), we need a history of at least 10 measurements.

Change-Id: Ia7cfac073bdc464092ca3e51dec319ac30401dd1
2018-01-19 16:03:16 +01:00
Neels Hofmeyr e25018b8c1 HO prep: introduce per-BTS handover config, with defaults on net node
It is desirable to allow configuring handover for each individual network cell.
At the same time, it is desirable to set global defaults.

Treat the 'network' node handover parameters as global defaults, add another
set of parameters for each individual BTS.

This raises questions on how the 'network' node should affect the individual
BTS. The simplistic solution would have been: on creating a BTS in the config,
just copy the current defaults; with serious drawbacks:
- tweaking any parameter in the telnet VTY on network node will never affect
  any running BTS.
- network node defaults *must* be issued before the bts sections in the config
  file.
- when writing a config back to file, we would copy all net node defaults to
  each BTS node, making the network node configs pointless.

Instead, add a handover_cfg API that tracks whether a given node has a value
set or not. A bts node ho_cfg gets a pointer to the network node config and
returns those values if locally unset. If no value is set on any node, use the
"factory" defaults, which are hardcoded in the API. Only write back exactly
those config items that were actually issued in a config file / on the telnet
VTY. (ho_cfg API wise, we could trivially add another ho_cfg level per TRX if
we so desire in the future.)

Implement ho parameters as an opaque config struct with getters and setters to
ensure the tracking is always heeded. Opaqueness dictates allocating instead of
direct embedding in gsm_network and gsm_bts structs, ctx is gsm_net / bts.

This is 100% backwards compatible to
old configs.
- No VTY command syntax changes (only the online help).
- If a 'bts' sets nothing, it will use the 'network' defaults.
- The 'show network' output only changes in presence of individual BTS configs.

On 'show network', say "Handover: On|Off" as before, iff all BTS reflect
identical behavior. Otherwise, output BTS counts of handover being enabled or
not.

Use the same set of VTY commands (same VTY cmd syntax as before) on network and
BTS nodes, i.e. don't duplicate VTY code. From the current vty->node, figure
out which ho_cfg to modify.

For linking, add handover_cfg.c (the value API) in libcommon, while the
handover_vty.c is in libbsc. This is mainly because some utility programs use
gsm_network and hence suck in the ho stuff, but don't need the VTY commands.

Review the VTY online help strings.

Add VTY transcript test for handover options, testing config propagation from
network to bts nodes, 'show network' output and VTY online help strings.
(Needs recent addition of '... !' wildcard to osmo_interact_common.py.)

I considered leaving parts of this more readable, but in the end decided for
heavy use of macros to define and declare the API, because more values will be
added in upcoming patches and I want to prevent myself from messing them up.

Inspired-by: jolly/new_handover branch, which moves the config to 'bts' level
Depends: I7c1ebb2e7f059047903a53de26a0ec1ce7fa9b98 (osmo-python-tests)
Change-Id: I79d35f6d3c0fbee67904378ad7f216df34fde79a
2018-01-19 16:03:16 +01:00
Harald Welte 74b8cdb8e9 Make libcommon, libcommon-cs, libfilter, utils depend on mgcp/sigtran
The stow-enabled jenkins builds are currently failing like below:

make[3]: Entering directory '/build/src/libcommon'
  CC       bsc_version.o
  CC       common_vty.o
  CC       debug.o
  CC       gsm_data.o
In file included from debug.c:34:0:
../../include/osmocom/bsc/gsm_data.h:15:38: fatal error: osmocom/sigtran/sccp_sap.h: No such file or directory
 #include <osmocom/sigtran/sccp_sap.h>
                                      ^
compilation terminated.
In file included from common_vty.c:27:0:
../../include/osmocom/bsc/gsm_data.h:15:38: fatal error: osmocom/sigtran/sccp_sap.h: No such file or directory
 #include <osmocom/sigtran/sccp_sap.h>
                                      ^
compilation terminated.
In file included from gsm_data.c:37:0:
../../include/osmocom/bsc/gsm_data.h:15:38: fatal error: osmocom/sigtran/sccp_sap.h: No such file or directory
 #include <osmocom/sigtran/sccp_sap.h>
                                      ^
compilation terminated.

Let's make sure the common gsm_data.h have all required CFLAGS to compile.

Change-Id: I30b75db6ffba227b05b5413b84b15f69e0c213f2
2018-01-15 20:14:01 +01:00
Harald Welte ed23c1d83d Reduce T3109 default from 19s to 5s
T3109 is started when the BSS sends a RR CHAN REL to the MS and stops
downlink SACCH generation. Stopped when the MS successfully releases the
LAPDm link. After stop or timeout, the radio channel is released using
RSL RF CHAN REL.

Recommended values in literature are 1-2s + RadioLinkTimeout*0.48s or
5s, while we had the absurdly high 19s timeout.  This means we occupy
the radio channel way longer than needed in situations where the MS is
no longer able to properly release Layer2 (LAPDm DISC) due to loss of
signal or the like.

See also: https://osmocom.org/projects/osmobsc/wiki/Timers

Change-Id: I7416b4118e5b73c6ffb98e3546bc62a36c7a967a
Closes: OS#2734
2018-01-04 11:13:41 +00:00
Harald Welte 148ee361b3 cosmetic: Hide all accesses to conn->bts behind conn_get_bts()
This is a new inline function that hides all accesses to conn->bts.

A follow-up patch will then point this to conn->lchan->ts->trx->bts
to get rid of the bts field.

Change-Id: Ib6cf7097ced34eebe80441c29ab1534f21956a33
2017-12-23 00:23:08 +01:00
Harald Welte 472275c301 remove unused 'lac' member of 'struct gsm_subscriber_connection'
This field was used in write-pnly mode, i.e. set but never read.

Change-Id: I319945538fd3e3bc5cf3b9d82533641cb8ba5256
2017-12-19 18:58:51 +01:00
Harald Welte 4a8ebc8394 gsm_data.h: Document all fields of gsm_subscriber_connection
Change-Id: I429fe7817f075d0794645d37f5ea11b104102ba0
2017-12-19 18:58:51 +01:00
Harald Welte 3edbd0e065 Remove some more dead code
Change-Id: I919bffe88babd90227c89abd4434322965c32ebb
2017-12-19 17:53:14 +00:00
Harald Welte 8311a81bae Remove bogus MM INFO configuration
The network name and other MM INFO is controlled by the MSC, not the BSC.

Change-Id: I1cbf72fc50cff29e7c1633ba752cbf15b4b84c58
2017-12-19 17:53:14 +00:00
Harald Welte c499e5c62e Remove bogus vty config for LU reject cause
The LU reject cause (like anything MM related) is under control of
OsmoMSC, not BSC.

Change-Id: I559ae31d67726845c9699c8b6127e21c6f63ace6
2017-12-19 17:53:14 +00:00
Harald Welte faacb090f6 Remove unused RRLP options/codec
RRLP is handled in OsmoMSC after the split from NITB, so let's remove
any bogus VTY commands left over in the BSC.

Change-Id: Ib626f43a3a3ca69dfc127afe5832eb58f7fb6a38
2017-12-19 17:53:14 +00:00
Harald Welte d9956d91ba Remove dead code left over from NITB split
There still is a lot of dead code that we inherited from the NITB
days, let's remove more of it.

libtrau will be re-introduced as part of osmo-mgw later.

Change-Id: I8e0af56a158f25a4f1384d667c03eb20e72df5b8
2017-12-19 17:53:13 +00:00
Harald Welte 00d64fd5ec Add new "chan:mode_modify_nack" counter to count RSL MODE MODIFY NACK
Those NACKs shouldn't happen in production, and if they do, you probably
want to have a more persistent figure than a line in the log file about
it.  Having counters allows the user to monitor this efficiently.

Change-Id: Ic82c6baaf4cb88d07bc5cdc200f8279cf130f396
2017-12-14 15:03:43 +01:00
Harald Welte 581398afab Add a new counter "rsl:ipa_nack" to count number of IPA related NACKs
Those NACKs (CRCX/MDCX/PDCH_ACT) shouldn't happen in production, and
if they do, you probably want to have a more persistent figure than
a line in the log file about it.  Having counters allows the user
to monitor this efficiently.

Change-Id: I5edf979c9a2b4c9a5a60eef9f66c26da54f2bddf
2017-12-14 15:03:43 +01:00
Harald Welte 62d9cb0529 Add new per-BTS "rsl:unknown" counter to count unknown RSL messages
Change-Id: I268f222140fa5783e1d19f81fbd45614aaa4b8c4
2017-12-14 15:03:43 +01:00
Harald Welte 4f59892ce6 Add per-BTS rate_ctr for total + failed number of RSL CHAN_ACT
Change-Id: I471b598af194dee78ebaa3414b6290c72d9bbcff
2017-12-14 15:03:43 +01:00
Harald Welte 6e59ced031 Reduce T3113 default from 60s to 10s
Our T3113 timer default of 60s was set early in the development of
OpenBSC, where we didn't really know what values to use and used
excessively large/safe values. Paging the same MS for 60 seconds (even
if there's no paging response) will however create a lot of PCH load for
no good reason.

It seems there's no clear guidance as to what the value should be. Other
implementations use something in the order of 10 seconds (OpenBTS,
yateBTS), which seems more realistic. THe Siemens BS-11 has a default of
5 seconds.

Let's be conservative and go to 10s as a default, which is already 6
times less potential PCH usage than our default so far...

Closes: OS#2756
Change-Id: If9c8441939c6fdcf6e2b9ede8cc576eb86296209
2017-12-14 13:06:33 +01:00
Harald Welte cf9d431e89 libbsc: paging: more reasonable (and detailed) paging statistics
Counting the number of T3113 expirations (one per subscriber per BTS)
vs the number of paging attempts (Bsc global) is a ueseless figure,
as you cannot relate each other.

We count on the BSC level:
	* how many PAGING we received from the MSC (total)
	* how many of those were for cells/LACs we don't serve
	* how many of those resulted in PAGING RESPONSE

We count on the BTS leve:
	* how many PAGING CMD we sent to the BTS (total)
	* how many of those we ignored as we were already paging
	* how many of those resulted in PAGING RESPONSE
	* how many were expired due to T3113 expiring

Change-Id: I410bbcbb2621f95f11238f7a5da01ab438f5fee1
2017-12-14 13:06:33 +01:00
Harald Welte dea252d29c Change T3101 default from 10s to 3s.
This timer is started when a channel is allocated with an IMMEDIATE
ASSIGNMENT message. It is stopped when the MS has correctly seized the
channel.  Ever since the early days of development we were using a very
long timeout to be on the safe side.  However, in production networks
this is a terrible waste of resources, as we will occupy 10s worth
of air-time on one of our channels for each RACH request we receive.

The only scenarios where you might need something absurdly high as 10s
would be if you have 8s of RTT between your BTS and the BSC.

See also https://osmocom.org/projects/osmobsc/wiki/Timers

Change-Id: If3c52a7cf0c06d074c44a2fc414679279189aab9
Closes: OS#2733
2017-12-11 14:03:50 +01:00
Harald Welte 9311005aff Remove 'msc' counter group from BSC
This is left over from the OsmoNITB days.  We're defining and allocating
these MSC counters, but never actually using them.  This also means that
the automatic counter export will list them, raising the expectation at
users that such counters could be used in OsmoBSC.

Let's remove them.  They are in OsmoMSC, but not OsmoBSC.

Change-Id: I5bd9e6e333b1c396beae46630986b17e7f8b82ef
2017-12-09 23:14:50 +01:00
Harald Welte 1ef46d922a rate_ctr: Use ':' as separator, not '.'
In more recent versions of libosmocore, we are converting any '.'
in [rate] counter names to ':' to avoid clashes with the special
meaning of '.' in the CTRL interface.  Let's avoid any conversion
and use the proper name already here.

This also changes the codec_foo counters to codec:foo to follow the
notation of other counters.

Change-Id: I18916abbfc706b86bd211e7cca1a0ca3099826e9
2017-12-09 23:10:46 +01:00
Harald Welte d82101e663 Move many counters from BSC-global to per-BTS granularity
We used to have a lot of counters only globlly per BSC, but they're
much more useful on a per-BTS level.

Change-Id: I954b9dda72b83b91d46a934c221a8b3375743599
2017-12-09 23:07:38 +01:00
Alexander Couzens 547c207579 use _NUM_CHREQ_T to define the size of ctype_by_chreq
Make it future compatible for changes. Otherwise it will break
when additional enums are adding to chreq in libosmocore.
Depends on libosmocore Id67ba8de89dd6288e449197438e9e1c5d7f5a134

Change-Id: I2acab2af8d67bccb2bc495512c1f259ae649a832
2017-12-06 13:25:35 +00:00
Philipp Maier 20114aa809 auth: remove obsolete VTY commands
authentication (optional|required) is no longer needed, the
related decisions are now made in the HLR.

Change-Id: Ib6c6331cc86004c4862067031e4fcb12a6975b63
2017-11-30 09:21:51 +01:00
Philipp Maier ad381102ea auth: remove unused structs
The following structs are no longer used/needed:

- gsm_auth_algo
- gsm_auth_info
- gsm_auth_tuple
- gsm_security_operation

Change-Id: I93873a6cb980a54e03e719170e27a7e397236b77
2017-11-30 09:21:51 +01:00
Philipp Maier ad47f7108a auth: remove obsolete VTY commands
Authentication is no longer done in the BSC, the variables that
set the authentication policy and the IMSI regex have no longer
any effect.

Remove auth policy and authorized-regexp

Change-Id: Ie31b921b5fd0af5501ec0c77c0f08089c10075e2
2017-11-29 11:48:49 +00:00
Max d0f479e744 cosmetic: remove obsolete ROLE_BSC
It's leftover from the time when gsm_data_shared.* was actually shared
with OsmoBTS. Nowadays ROLE_BSC is always defined so we can just drop it
entirely and make working with gsm_data_shared.h slightly easier.

Change-Id: I34fc9ee5955c14bbbde68d5499cf2acfd329afbc
2017-11-29 12:24:52 +01:00
Philipp Maier 39c609b7c9 mgcp: use osmo-mgw to switch RTP streams
osmo-bsc currently negotiates the RTP stream directly with the
BTS and reports back the RTP IP/Port on the BTS. This works fine
for a single BTS, but for Handover the port/ip pointing to the
MSC side must not change, so an entity in between the BTSs and
the MSC is required.

Integrate the mgcp-client and use osmo-mgw to switch the RTP
streams.

Depends: osmo-mgw Ib5fcc72775bf72b489ff79ade36fb345d8d20736
Depends: osmo-mgw I44b338b09de45e1675cedf9737fa72dde72e979a
Depends: osmo-mgw I29c5e2fb972896faeb771ba040f015592487fcbe

Change-Id: Ia2882b7ca31a3219c676986e85045fa08a425d7a
2017-11-07 20:57:51 +00:00
Max 36bf7974ab Check OML state per-BTS
To properly decide if a given OML link is degraded we have to use
BTS-specific information about MO state.

* move check function into BTS-specific part
* add generic wrapper

Related: OS#2486
Change-Id: Iddc7a4d20fbb95a6566eed1487a12733e5adb9e2
2017-11-02 15:58:08 +01:00
Max 25cc407c5b ctrl: add oml-uptime command
Expose OML link uptime available via vts's "sh bts 0" command with the
new "bts.0.oml-uptime" ctrl command. To avoid code duplication, move
uptime computation into separate function and use it for both.

Change-Id: Iec405aa949d6a38a9c8e64cd7ee4b49fd416835d
Related: OS#2486
2017-10-11 01:28:10 +00:00
Max 3d049d27f5 OML: consider RSL link state
OML link state is available via vty ("sh bts 0" command) and
ctrl ("oml-connection-state" RO variable).

When showing OML link state, take into consideration RSL link state as
well: if OML is up but RSL is missing show it as degraded.

That's implemented via BTS model-specific functions (currently Sysmo- and
Nano- BTS only)

Change-Id: I5952fc59e4d82e0aa627ad91d20f964d9559a4c4
Related: OS#2486
2017-10-09 18:42:15 +02:00
Harald Welte 2da93fc05b Remove any references to RANAP and Iu
This is a BSC, it has norelation to RANAP or Iu(h). Let's remove
an references to it, and also the build dependency to libosmo-ranap-dev

Change-Id: I517b9f69309b2ed0540dd6c186b3d4a2a03aed44
2017-10-04 08:15:32 +08:00
Max 9cc704424a Further cleanup leftovers from BSC/MSC split
* drop unused header
* fix name of jenkins test
* remove dead code

Change-Id: I986904864741995910b6ba92173b9f7b1b03e2f1
2017-09-25 08:25:15 +00:00
Max be356ed32f Make TRX rf locking more visible
* log administrative state transitions
* log what's caused it
* while at it, mark boolean variable as such

Change-Id: I3e25a19fac4d0b4886d825c9876771b1f66efe58
Related: SYS#3864
2017-09-08 08:31:02 +00:00
Neels Hofmeyr 4a0c01167b drop MGCP client from osmo-bsc
After osmo-mgw change I8e0b2d2a399b77086a36606f5e427271c6242df1, there now is a
separated libosmo-mgcp-client, and osmo-bsc needs adjusting.

But besides having an unused struct in gsm_network, osmo-bsc does not yet use
its MGCP client; these are merely plans for the future. Until we do, let's just
drop the dependency entirely.

Change-Id: I6402c7cbe58dacae7630f7f03819f8102e54c699
2017-09-06 16:26:36 +02:00
Neels Hofmeyr c01647914b move include/openbsc to include/osmocom/bsc
Change-Id: I39e7b882caa98334636d19ccd104fd83d07d5055
2017-09-06 16:26:13 +02:00