Commit Graph

6415 Commits

Author SHA1 Message Date
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
Neels Hofmeyr 2660c0412d HO: make bts_by_arfcn_bsic() public
Change-Id: Ie746f76433f6b46a71a91b7714cc034c4355d993
2018-01-19 22:09:19 +00:00
Neels Hofmeyr 1c251f0c9f HO: rename gsm_bts_neighbor() to bts_by_arfcn_bsic()
The name sounds like it is looking up neighbors, instead it simply traverses
the global list of BTSes. Rename to reflect what it does.

Move FIXME comment to its logical place: at the invocation of
bts_by_arfcn_bsic().

Change-Id: I063870d09f782a4f18e85d87c7cd17fe660cb3fd
2018-01-19 22:09:19 +00:00
Andreas Eversberg df65c9afee HO: Count number of free timeslot on a given BTS
This is needed for handover algorithm to balance free slots and to prevent
congestion of one cell, while other cells still have free capacities.

Change-Id: Ic8bee8a515ee8aa9a99af71756fe60b8dd8f868b
2018-01-19 18:19:00 +01:00
Andreas Eversberg 81260a6795 HO: Change debug category at handover decision: DHO -> DHODEC
Change-Id: I7322b790f647b681bfe3a9c95b04516fbc7cbf88
2018-01-19 16:03:16 +01:00
Neels Hofmeyr 87b5eb667b HO: add handover algo 2 parameters; skip HO 1 if HO 2 is configured
Change-Id: I8811ee8a75be09048042b511ee4bd9bc1de63976
2018-01-19 16:03:16 +01:00
Neels Hofmeyr c561515ae0 HO: enable handover by initializing at startup; rename init function
Change-Id: I224884c84895ebf6c8cf498c16616214cb2b5779
2018-01-19 16:03:16 +01: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
Andreas Eversberg 30b6df607e Correctly set T3105 for ipaccess BTS type
The given value is 10 * ms, so 13 is used instead of 128.

If T3105 is set at config to something greater 0, it is used instead of
the default value.

Adjusst nanobts_omlattr_test.c accordingly.

Change-Id: I3d9687619ba4de35f5d2eff3026d903534b2bbd4
2018-01-19 16:03:16 +01:00
Andreas Eversberg 5d45c0732a Allow assignment to TCH channel with signalling only mode
This makes sense, if silent call is used. Assignment allows to change from
SDCCH (or whatever was available) to given TCH rate.

Change-Id: I2efe9d7ab429e902581ebb9e0e006f2aec6d8972
2018-01-19 16:03:16 +01:00
Andreas Eversberg 3106c16b4f Do not perform assignment, if the new channel equals the current one
This can happen, if a TCH/H was requested, but because it is not available,
a TCH/F is allocated. If the old channel was TCH/F already, it makes no
sense to assign it.

Change-Id: I284125483fc14b8f82e32ee61aa3866746238eae
2018-01-19 16:03:16 +01:00
Andreas Eversberg 7df80d38f3 HO: Add handover decision debugging category
Change-Id: Iaf99d4e9ae08c38bf364dbb37d42098f976f6b8c
2018-01-19 16:03:16 +01:00
Andreas Eversberg e0cba56dad HO: If handover logic is used to do assignment, signal assignment result
Change-Id: I465caef03626e67d9b3a21bdf730589b9852c211
2018-01-19 16:03:16 +01:00
Andreas Eversberg 869121c09a HO: Always update rqd_ta after receiving measurement report
The up-to-date rqd_ta is required for assignment command. If the phone
moves, the timing advance might change. The rqd_ta will be updated by
each measurement report.

Change-Id: If1a592e590cfed55ff3dca5be89e2946e8017a22
2018-01-19 16:03:16 +01:00
Andreas Eversberg 7c41cd1ac5 HO: Changed availablilty of ts_is_usable() from static to extern
Change-Id: I3471e38327c4b98490faed9b604fb76438ba9954
2018-01-19 16:03:16 +01:00
Neels Hofmeyr f9b8cb19e2 fixup: neigh_meas_avg: fix condition to reduce window size
Change-Id: Ia2269be448436d676289c84b9b05da7f51ee4a85
2018-01-19 16:03:16 +01:00
Neels Hofmeyr 186e478164 fixup: neigh_meas_avg: detect invalid window size as <=0, log if invalid
Change-Id: I8c5d0642aeb4fbee73a035b9f73cf3a09b1bcf90
2018-01-19 16:03:16 +01:00
Andreas Eversberg 11e31c7066 HO: Count neighbor measurements and reduce window of neigh_meas_avg
Always start with a counter of 0 for a new measurement report. If the
neigh_meas_avg is caluclated over the given window, the window is
reduced, if there are less measurement reports received so far.

Change-Id: I1c74f27f9663a3083610c985a080fca331c19bd3
2018-01-19 16:03:16 +01:00
Andreas Eversberg 970b43486f HO: Count the actual meas.rep. get_meas_rep_avg fails if not reached
get_meas_rep_avg will return -EINVAL, if the required number of
measurements are not reached. There will be no handover possible until the
given number of measurements are available.

Change-Id: Ibc4410b4e162cdb6c070128d2c63946bb79d6d65
2018-01-19 16:03:16 +01:00
Andreas Eversberg 4d3baa6bdf Fix of checking TCH rate at chan_compat_with_mode
In case of current channel equals TCH/F and we request half rate, we
must return 0, so the calling function will trigger assignment.

Change-Id: Ibb4cb9aef1a1146f984d7c969bfba53c647cae07
2018-01-19 16:03:16 +01:00
Andreas Eversberg 6082a377f5 HO: Assign SDCCH on channel request
This is needed, so channel can be negotiated before the actual channel
type is assigned.

In case there is no SDCCH available, try to assign what ever the MS requested.
If this is not possible try to assign TCH/F. If this is still not possible,
reject channel request.

Change-Id: I10fc9f60c58c6b7ed424a86ce23bf6b9802c9eb1
2018-01-19 16:03:16 +01:00
Andreas Eversberg c8a7823b4b Fix: If paging for half rate was requested, use hr, if supported by MS
Change-Id: I6d1c9701808ee542771fee145250927019a2f5f6
2018-01-19 16:03:16 +01:00
Neels Hofmeyr c766c9edad cosmetic: explicitly init ho_ref start value
The static ho_ref seems to be implicitly initialized to zero, but let's make it
explicit for code readability.

Change-Id: I00493bcb7ef3e38fb8e0077c60c5bac7199f1073
2018-01-19 16:03:16 +01:00
Andreas Eversberg a91800034e HO: Add function to count currently ongoing handovers to a given BTS
In order to keep processing power at BTS at a defined level, the handover
decision might want to limit maximum number of slots that require RACH
detection.

Change-Id: I8908e37fe0d8d2eda906cc6301ba0969b25a5575
2018-01-19 16:03:16 +01:00
Neels Hofmeyr 5eaa4fb821 HO: add indicators for inter-cell and async ho, use for chan act type
Change-Id: I2d91765c1f9719c64fd99426a872cecc724215db
2018-01-19 16:03:16 +01:00
Andreas Eversberg a49d7b2684 HO: Send Channel Mode and Multirate IE along with handover command
This is needed, if the channel mode should change when doing handover.
A change in channel mode makes sense, if available resources at the new
BTS are different.

Change-Id: Ib6b17a9be252f1655006ab6773483868017d7926
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
Neels Hofmeyr be1131df42 HO: fix recovery from failed handover
Do not instruct the MGW to move the RTP to the new lchan before we have
received a HANDOVER DETECT.

Before:

  Chan Activ
  Chan Activ Ack
  IPACC-CRCX
   -ACK
  IPACC-MDCX
   -ACK
  MGCP MDCX --> MGW
  ...
  HANDOVER DETECT
  Call continues on new lchan

In above sequence, if the HANDOVER DETECT times out, the MGW has moved to the
new lchan which never becomes used and is released. Furthermore, from the IPACC
MDCX until the HANDOVER DETECT, the RTP stream would break off momentarily.

After:

  Chan Activ
  Chan Activ Ack
  IPACC-CRCX
   -ACK
  IPACC-MDCX
   -ACK
  ...
  HANDOVER DETECT
  MGCP MDCX --> MGW
  Call continues on new lchan

If the HANDOVER DETECT times out, the call happily continues on the old lchan.

This change is inspired by Ivan Kluchnikov's HO work, who implemented a similar
fix in the openbsc.git codebase (branch fairwaves/master-rebase): his patch
moves ipacc_mdcx() to connect RTP to the new lchan from switch_for_handover()
(which triggered on S_ABISIP_CRCX_ACK, i.e. creation of the new lchan) to later
on in ho_detect() a.k.a. the S_LCHAN_HANDOVER_DETECT signal handler:
http://git.osmocom.org/openbsc/commit/?h=fairwaves/master-rebase&id=9507a7a1ea627e07370c9d264816bb190b3b91b8

This patch does essentially the same: remove the mgcp_handover() call from the
MDCX-ACK handling (creation of the new lchan), and add a signal handler for
S_LCHAN_HANDOVER_DETECT to osmo_bsc_mgcp.c to effect the MGW switchover.

Note, it would have been possible to call mgcp_handover() directly from rx of
the HANDOVER DETECT message, but that produces linking fallout in some utils/
projects, which then need to link the mgcp code as well. That is because those
aren't properly separated from the more complex parts of libbsc. Using the
signal is a bit bloaty, but saves the linking hell for now. I've faced a
similar problem twice recently, it would pay off to separate out the simpler
utils/ and ipaccess/ tools so that they don't need to link all of libbsc and
osmo-bsc, at some point (TM).

Change-Id: Iec58c5fcc5697f1775da7ec0111135108ed1fc8f
2018-01-19 16:03:15 +01:00
Neels Hofmeyr 9af36d7844 osmo_bsc_mgcp: cosmetic: introduce mgcp_init(), soak up fsm init
A subsequent patch will add registration of a signal; cosmetically prepare by
creating a common mgcp_init() function. It makes sense for the FSM registration
to move to it.

Change-Id: I510e1081171706eb3d9fb2db50a9aa4f768929b5
2018-01-19 16:03:15 +01:00
Neels Hofmeyr b99e0251a1 vty: add various manual handover and assignment trigger commands
Change-Id: I9745609f2620baa09a693b713d76e355e798abc7
2018-01-19 16:03:01 +01:00
Neels Hofmeyr 70c5fd2bfa vty: cosmetic: use common BTS, TRX, TS, LCHAN strings
Change-Id: Ic015ebd3a330769638dddeab2f52321b0302a5a1
2018-01-19 15:55:14 +01:00
Neels Hofmeyr 0f483f6f9a vty: change handover command's arg LCHAN_NR to <0-7>
Even thought the lchan number range depends on the pchan, using LCHAN_NR allows
passing arbitrary arguments. Limit it to 0-7.

Change-Id: I2c078b420b6183862acb5c18d1230cf8f6c9f0ce
2018-01-19 15:46:02 +01:00
Neels Hofmeyr e5b5a894c2 vty: fix 'show lchan ...' arg [lchan_nr] to [<0-7>]
A lower-case argument is a keyword, not a variable placeholder. Hence the user
would not be able to pass a number, just the "lchan_nr" string itself, hence
this would never work.

Depending on pchan, lchans can range 0..7, so use that instead.

Change-Id: Ib9a0b43b68c4682cd6de24d01c0de421c9ce957a
2018-01-19 15:41:25 +01:00
Stefan Sperling e74038424a Split paging cases in bssmap_handle_paging() off into helper functions.
This is mostly no-op code refactoring which makes it easier to maintain the
code for each paging case and reduces the scope of several local variables.

Also, ensure that paging failures where no matching BTS was found are logged
consistently in all cases. The log level changes from ERROR to NOTICE since
this is not necessarily a fatal condition.

Change-Id: If8fdf425145791f4904a70e295bdc3c7d0f4d5f6
2018-01-17 10:01:53 +00:00
Ivan Kluchnikov 1c8b4a5a77 handover_decision: log HO causes more accurately
Tweaked-by: nhofmeyr@sysmocom.de
Change-Id: Ib0a0787ac8b877ac63455d72886389b546e7a337
2018-01-16 15:29:59 +01:00
Ivan Kluchnikov 864f553d90 handover_decision: Fix condition for power budget handover attempt
Handover attempt for power budget case should be performed every N SACCH frames,
where N = Power Budget Interval.
First measurement report with mr->nr = 0 was used for the first handover attempt
in this case, which is not correct, because first usable report should have
mr->nr = net->handover.pwr_interval-1.
Moreover using the first measurement report with mr->nr = 0 for handover attempt
could lead to unnecessary handover, because usually av_rxlev for first measurement report
from MS is worse than for following reports.

Change-Id: If7f54a4cb179eaa9e5eb147b9477633ac618e69e
2018-01-16 15:28:57 +01:00
Stefan Sperling d2474cad81 Show the BTS number for outgoing paging commands in debug log.
Change-Id: I7b6e03087fc2dfecb6235c5ed1494d3c9b4bbf0e
2018-01-16 13:40:31 +00:00
Stefan Sperling 95543427f9 Implement support for paging based on LAC and CI.
This is a simple combination of the LAC and CI cases which have
already been implemented.

The BSC_Tests.TC_paging_imsi_nochan_lac_ci ttcn3 test passes.

The switch statement in bssmap_handle_paging() is getting a bit large,
and scoping of local variables could be improved. I will focus on
cleaning this up later once paging functionality is complete.

Change-Id: If7f596663a97a1db1a00f115a366f4a5a271c127
Depends: Id83f8b3b1ce80a39417176d99fd09f3b394fd19c
Related: OS#2752
2018-01-16 14:18:21 +01:00
Stefan Sperling c7b017658d Implement support for paging based on a Cell Global Identifier.
This is essentially a case which combines paging by LAI and CI.

Depends: Ic1c72c7f83e53988eb9fedf314b1dc459836833d
Change-Id: Id83f8b3b1ce80a39417176d99fd09f3b394fd19c
Related: OS#2751
2018-01-16 14:17:23 +01:00
Stefan Sperling 714c2f9552 Move BTS selection for paging from osmo_bsc_grace.c into osmo_bsc_bssap.c.
We can now either page an invidual BTS directly or page several BTS in a
given location area. This decision is taken based on the contents of the
cell identifier list in the paging request. Select a set of BTS for paging
while processing the cell identifier list, rather than requiring the
paging layer to loop over all BTS in the MSC.

This change requires some adjustment in bssap_test. In particular,
this test must now add a BTS to its network in order to pass.

The purpose of this change is to make the layering a bit cleaner.
There is one functional change: We no longer abort paging if paging fails
for a particular BTS. Instead, we keep trying to page on other BTS.

Change-Id: Ic1c72c7f83e53988eb9fedf314b1dc459836833d
Suggested-by: Harald Welte
Depends: Ic7772e75c3d7fb0df6e17e118bb33b3248352d4d
Related: OS#2753
2018-01-16 14:14:01 +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
Stefan Sperling 090550f5f8 Implement support for paging based on CI (cell identifier).
This builds upon https://gerrit.osmocom.org/#/c/5698/ which implements
support for paging by LAI.

The ttcn3 test TC_paging_imsi_nochan_ci passes with this code when
run in isolation. It does not pass if another paging test (such as
TC_paging_imsi_nochan_lai) is executed beforehand. This problem
looks similar to the scenario tested in TC_paging_imsi_a_reset.

Change-Id: Ic7772e75c3d7fb0df6e17e118bb33b3248352d4d
Depends: Ic3c62ff0fccea586794ea4b3c275a0685cc9326e
Related: OS#2753
2018-01-15 10:46:43 +00:00
Vadim Yanitskiy 6b103e14ba bsc/gsm_04_80.h: clean up useless declarations
This change removes a few USSD specific declarations, which are
not actually used now, and probably accidentally migrated from
legacy OpenBSC.

Change-Id: I060223349971a7fce169a018bf16eb91f0e20342
2018-01-12 14:06:56 +00:00
Vadim Yanitskiy d783a7574f bsc/gsm_04_80.h: use '#pragma once' instead of includes
This is a common include guard way for Osmocom projects.

Change-Id: Iee73e24a2438b6081a5d569db7d48725b564ee3a
2018-01-12 14:06:55 +00:00
Stefan Sperling 7985f980ed Implement support for CELL_IDENT_NO_CELL.
Change-Id: I941477fee041664bd3d256b272e3cafa9bce4e69
2018-01-11 16:08:23 +00:00
Stefan Sperling 80b88e093d Add TAGS files (produced by 'make tags') to .gitignore file.
Change-Id: If5592cb0b5de018b7b9c06955f2e34d1f666530e
2018-01-11 15:18:08 +00:00
Stefan Sperling 33e9009003 Implement support for paging by LAI.
Also, parse the complete cell identifier list for both LAC and LAI.

Change-Id: Ic3c62ff0fccea586794ea4b3c275a0685cc9326e
Related: OS#2751
2018-01-11 12:50:07 +00:00
Philipp Maier f56a28d1c2 cosmetic: mgcp: remove duplicate logging
do not print an additional log lines when the mgcp FSM gets
halted. This is already done by osmo-fsm

Change-Id: I5aebbcacb68eab3c6afb19991dbf63a02524e4d7
2018-01-10 11:12:12 +00:00
Philipp Maier f9ca0204c4 mgcp: log file and line of calls to handle_error()
When the FSM runs into an error condition handle_error() is called with
a cause code. The information about the error is then printed by handle_error(),
by this we do not get the sourcecode line of the location where the error
actually happend.

Convey the source code line number of the actual error in handle_error()

Change-Id: Ifa7f2a655474826630988572616cd26e1e2f3464
2018-01-10 11:11:53 +00:00
Stefan Sperling 55a954bba1 Support control connection status query for a particular MSC.
Add a new control command 'msc.N.connection_status' which can be used
to query the connection status of a particular MSC with number N.

Keep the old control command 'msc_connection_status', which always
queries MSC 0, for backwards compatibility.

Change-Id: Ibd41474a1be80e782b19ec337c856b5efc593fa8
Related: OS#2729
2018-01-09 11:18:10 +00:00