Commit Graph

398 Commits

Author SHA1 Message Date
Neels Hofmeyr d0d204aaa2 cosmetic / linking: move str_to_imsi() out of abis_rsl.c
Move to gsm_04_08_utils.c so that it's possible to use it without
linking/stubbing all of RSL.

Change-Id: I6e90831d7e618ce3c8e7417082a82c97f6681668
2018-06-18 07:53:03 +02:00
Neels Hofmeyr f0ff9a6711 fix dyn TS init: properly identify BTS on OML OPSTART ACK
Commit "dyn ts, bts_ipaccess_nanobts.c: init PDCH on Chan OPSTART ACK"
bf7099262a Icf6e25ff068e8a2600562d52726ead65e864ec02
introduced signal S_NM_OPSTART_ACK and passed the FOM header to identify the BTS
by. But the FOM header's BTS number is zero on each Abis/IP link, and the BTS
and TRX are actually identified by msgb->dst == e1inp_sign_link, member trx. So
the initial implementation associated *all* Channel OPSTART ACKs with BTS 0.

Pass the entire msgb as S_NM_OPSTART_ACK signal argument, implement a
abis_nm_get_ts() to retrieve the proper timeslot and use that during timeslot
init.

Related: OS#3351 OS#3205
Change-Id: I45ce5c24cb62d00f350df1af1be6c11104d74193
2018-06-15 21:00:31 +02:00
Harald Welte 7325d9379d Remove unused logging subsystems DCC and DMGCP
We use the newly-introduced logging_vty_add_deprecated_subsys() from
libosmovty to make sure old config files will still parse even after
this change.

Change-Id: Ib4f67bb00e1d5460e643717b53f6a4d81278dc5d
2018-06-09 17:44:12 +02:00
Neels Hofmeyr 0c1ac9f010 make T10 configurable like the rest of them
Change-Id: I112c0db17d355d57eb08bc67121ccf49fbf53943
2018-06-08 16:16:42 +00:00
Neels Hofmeyr fc622c7241 drop dead code: conn->T10, handled by gscon instead
Change-Id: Ief20cb0f46dd93f46dd765dca307724dc2b3487c
2018-06-08 16:16:42 +00:00
Neels Hofmeyr 0abe84e679 HO: introduce T7, T8, T101 timers
Will be used in upcoming inter-BSC handover.

Change-Id: If9ecccc793426d214019f299b19d6ffa5a186546
2018-06-08 16:16:42 +00:00
Neels Hofmeyr fb75d109a1 cosmetic: penalty timers: constify, tweak doc
Change-Id: I28addc9a16a4c81978290303d368f630a8334228
2018-06-08 16:16:42 +00:00
Neels Hofmeyr c19581f268 remove struct bsc_api
struct bsc_api was used to provide an abstract API for both osmo-bsc and
osmo-msc, between BSC and MSC. That's no longer needed, so get rid of it, to
prevent code turbulences it creates for no reason.

Change-Id: I3fd5888c63a0b4f95520a498320aa105a6d60579
2018-06-07 19:09:06 +02:00
Neels Hofmeyr 958f259f95 dissolve libbsc: move all to src/osmo-bsc, link .o files
Move all of libbsc/ into osmo-bsc/, and separate/move some implementations to
allow linking from utils/* and ipaccess/* without pulling in unccessary
dependencies.

Some utilities use gsm_network and gsm_bts structs, which already include data
structures for fairly advanced uses. Move initialization that only osmo-bsc
needs into new bsc_network_init() and bsc_bts_alloc_register() functions, so
that the leaner tools can use the old gsm_* versions without the need to link
everything (e.g. handover and lchan alloc code).

In some instances, there need to be stubs if to cut off linking "just before
the RSL level" and prevent dependencies from creeping in.
- abis_rsl_rcvmsg(): the only program currently interpreting RSL messages is
  osmo-bsc, the utils are merely concerned with OML, if at all.
- paging_flush_bts(): ip.access nanobts models call this when the RSL link is
  dropped. Only osmo-bsc actually needs to do anything there.
- on_gsm_ts_init(): the mechanism to trigger timeslot initialization is related
  to OML, while this action to take on init would pull in RSL dependencies.
utils/ and ipaccess/ each have a stubs.c file to implement these stubs. Tests
implement stubs inline where required.

From src/utils/, src/ipaccess/ and tests/*/, link in .o files from osmo-bsc/.
In order for this to work, the osmo-bsc subdir must be built before the other
source trees. (An alternative would be to include the .c files as sources, but
that would re-compile them in every source tree. Not a large burden really, but
unless linking .o files gives problems, let's have the quicker build.)

Minor obvious cleanups creep in with this patch, I will not bother to name them
individually now unless code review asks me to.

Rationale:

1) libbsc has been separate to use it for osmo-nitb and osmo-bsc in the old
openbsc.git. This is no longer required, and spreading over libbsc and osmo-bsc
is distracting.

2) Recently, ridiculous linking requirements have made adding new functions
cumbersome, because libbsc has started depending on osmo-bsc/*.c
implementations: on gscon FSM and bssap functions. For example, neither
bs11_config nor ipaccess-config nor bts_test need handover_cfg or BSSMAP
message composition. It makes no sense to link the entire osmo-bsc to it, nor
do we want to keep adding stubs to each linking realm.

Change-Id: I36a586726f5818121abe54d25654819fc451d3bf
2018-06-07 19:09:06 +02:00
Harald Welte 1f1c56c622 LCLS: add VTY config to enable/disable LCLS on per-MSC basis
The user might not want to enable LCLS support for administrative
reasons.  So let's keep it disabled by default, until somebody
explicitly enables it with "lcls-mode mgw-loop".

In the future, we may want to introduce a "lcls-mode bts-loop" where we
don't loop at the BSC-colocated MGW, but where we instruct the BTSs to
feed the RTP directly to each other.  This would require a
falt/transparent IP routing between the BTSs in the RAN.

Change-Id: Ied7985056c8cd182bf16119007a08cc5be14459b
Related: OS#1602
2018-06-03 12:26:42 +02:00
Harald Welte c997ceb750 Add initial 3GPP LCLS support to OsmoBSC
This code contains the following code:
* receive/parse/interpret LCLS specific BSSMAP IEs and PDUs
* osmo_fsm handling the various states and their transitions
* call leg correlation (finding the other subscr_conn with same GCR)
* communication between the two call-leg LCLS FSMs
* detection of supported / unsupported LCLS configurations
* display of GCR / LCLS information in "show conns"
* switch the media streams locally using MDCX to the MGW

Closes: OS#1602
Change-Id: I614fade62834def5cafc94c4d2578cd747a3f9f7
2018-06-02 20:56:17 +02:00
Harald Welte 1876c3108c move 'extern struct gsm_network *bsc_gsmnet" to header file
It's not a good idea to keep extern declarations copied over
half a dozen C files.  Let's move it to a header.

Change-Id: I6f643f1393ba0955d9c0cf1cf78d5c604e7b9451
2018-05-27 20:17:06 +02:00
Harald Welte 68e4be9c84 Remove 'struct bsc_msc_connection' + fix IPA-encapsulated CTRL
The bsc_msc_connection dates back to the old pre-libosmo-sigtran
days, and 90% of the field members weren't used at all (even the
new sigtran specific ones!).  Let's merge what remains into struct
bsc_msc_data.

As a side effect, the already dysfunctional "dest A.B.C.D" VTY
command has been removed from the MSC node.

There's quite a bit of fall-out in the CTRL interface, which was
the code with strongest ties to bsc_msc_connection.  This was
resolved by properly porting CTRL handling over to libosmo-sigtran,
meaning that an IPA/SCCPlite connected MSC can now again send CTRL
GET/SET commands, and can also receive those selective few TRAPs
that old osmo-bsc-sccplite also sent to its MSC[s].

Change-Id: I6b7354f3b23a26bb4eab12213ca3d3b614c8154f
Related: OS#2012
2018-05-27 20:17:02 +02:00
Harald Welte 1c9b8b1917 remove remaining bits of osmo-bsc_nat
osmo-bsc_nat is too heavily tied into legacy SCCPlite code, as it
is not using libosmo-sigtran/osmo_ss7 so far.  It's also full of
customer-specific code and it's shared use of some libbsc code here
has been complicating osmo-bsc development.

The current plan is to continue to use osmo-bsc_nat from openbsc.git
for those legacy users that need it, and not use osmo-bsc_nat in
new 3GPP AoIP setups.  Should we ever get a strong demand for an AoIP
based bsc_nat, we can still revisit this later.

Change-Id: Ia05dc76336a64a7f08962843b9a7cc19f2c83387
2018-05-27 17:48:49 +02:00
Harald Welte 584ab8e11f bsc: Add mgcp_port_to_cic() to determine CIC from RTP Port
Also: Move mgcp_timeslot_to_port() next to it, as they are
more or less the inverse transformation of each other.

Change-Id: Ica908e2bb8fc4e59e0d146b428c93a9efc385688
2018-05-25 18:58:16 +00:00
Harald Welte 3909d99fae vty: Permit selection of other ASP protocol than M3UA
We used to have hard-coded M3UA.  Let's allow the user to configure
this per MSC using a new "asp-protocol (m3ua|sua|ipa)" VTY command.

For SUA this should just work 1:1 without any trouble.  For IPA,
this of course only changes the underlying transport without reflecting
the various differences in terms of BSSMAP ASSIGNMENT, MGCP handling,
etc.

Change-Id: I0800c709e574cedd7f5dd98be81c78782245cd13
Related: OS#2544
2018-05-25 18:58:16 +00:00
Philipp Maier 02d20da183 gscon: remove dead code
The state ST_WAIT_MODE_MODIFY_ACK can never be reached by the
current FSM model.

- Remove ST_WAIT_MODE_MODIFY_ACK and all related code

Change-Id: Iacaae2ee50ca1956066b7dce4517bbc9c2b0897e
Related: OS#2762
2018-05-23 16:04:18 +00:00
Neels Hofmeyr 163f631f08 cosmetic: define TCH_F_PDCH_PENDING_MASK as actual bitwise or
Change-Id: I5266d6e1ea0ea89c66fa481136c31e2f84bcb313
2018-05-23 13:32:02 +02:00
Neels Hofmeyr 59afaa9b8d abis_rsl.h: drop unused rsl_chan_activate() declaration
Change-Id: I28a48dc9a1719793d369468aa9a4bdcf460d201c
2018-05-23 13:32:02 +02:00
Neels Hofmeyr 8da2233426 bsc_api.c: actually log with context
bsc_api.c notoriously lacks log context. Provide gsm_lchan_name() and/or
bsc_subscr_name() in roughly a million instances, using new LOGPLCHAN macro.

Add LOGPLCHAN() to gsm_data.h, to encourage use of it in other .c files.

Change-Id: If469defcc6fe8950dac5df61db3f39d297893318
2018-05-23 07:27:39 +00:00
Pau Espin 20388b781d nat: Add jitter buffer on the uplink receiver
Default usage values are defined in mgcp node, and can be per-BSC
overriden on each bsc node.

This commit is a forward-port of openbsc.git Change-Id
Ibf3932adc07442fb5e9c7a06404853f9d0a20959.

Depends on osmo-mgw.git Change-Id Ie19a64ac09f9d51f2434ad0d7925610fc919a90e.

Change-Id: Ie07b8a577caf731d59d68e3b3510ae2f9fd3dc93
2018-05-22 09:57:42 +00:00
Stefan Sperling 7926d98509 add counter for connection attempts from BTS with unknown unit id
Add a global counter to the BSC which shows the number of failed
connections attempts due to a unit_id mismatch between the BSC
and the BTS.

Change-Id: I58866aff36a1c8463bf84b4392a5124ffeaa32ea
Related: OS#3245
2018-05-22 10:11:34 +02:00
Stefan Sperling 71d524c059 show all global counters of osmo-bsc in vty
The 'show statistics' VTY command was not showing all counters
maintained by osmo-bsc. Instead of printing just two counters
related to paging, print all available counters in a generic way.

Adjust descriptions of some counters for nicer display.

After startup (all counters are zero) is now looks like this:

OsmoBSC# show statistics
       handover:attempted:          0 Received handover attempts.
      handover:no_channel:          0 Sent no channel available responses.
         handover:timeout:          0 Timeouts of timer T3103.
       handover:completed:          0 Received handover completed.
          handover:failed:          0 Received HO FAIL messages.
         paging:attempted:          0 Paging attempts for a subscriber.
          paging:detached:          0 Paging request send failures because no responsible BTS was found.
         paging:responded:          0 Paging attempts with successful response.
OsmoBSC#

Change-Id: I58ae04e1960774d760e3ebb54a4f307c9f753655
Related: OS#3245
2018-05-18 11:38:24 +00:00
Philipp Maier 0b10399937 a_reset: cleanup + remove dead code
The function a_reset_free() is not used anywhere at the code. The
reason for this is that a BSC instance is never cleared once it
is started up. Also the timer number is not according to the spec.

- Remove a_reset_free()
- Fix timer identification number (T4)
- use fi->priv to hold context info
- Fix sourcecode formatting

Change-Id: I72095d52304c520e383755eee6c889bce492cbd4
Related: OS#3102
2018-05-17 20:13:52 +00:00
Neels Hofmeyr 91aa68f762 dyn TS: init only when both RSL and the Channel OM are established
Recent Icf6e25ff068e8a2600562d52726ead65e864ec02 changed the dyn_ts_init() hook
from bootstrap_rsl() to the Channel OPSTART ACK, but this is not sufficient.
Now RBS2k never calls dyn_ts_init(), and we may need to wait for RSL:

Dyn TS should actually be initialized only when *both* OML opstart and RSL link
are established. To that end, introduce a generalized API to query OML and RSL
status and to trigger a timeslot init at the appropriate time.

Add gsm_ts_check_init() to be called both when RSL and OML opstart are
established: trigger gsm_ts_init() only when both are given.

Add gsm_bts_trx_ts->initialized flag to mark whether initialization has already
taken place. Add gsm_bts_mark_all_ts_uninitialized() to conveniently clear this
flag for all TS in a BTS.

Add gsm_bts_model.oml_is_ts_ready() callback so that each BTS implementation
can return the OML status of a timeslot in its own OML implementation.
Actually, currently all BTS models that need this init mechanism store the TS'
OML status in ts->mo.nm_state. While we would in practice correctly init dyn TS
by just looking at ts->mo.nm_state, semantically, the decision whether the TS
is ready is up to the BTS models' specific OML implementations.

From bootstrap_rsl(), call gsm_ts_check_init(), in case the TS OML Opstart has
happened before RSL is established -- applies to all BTS models.

For all BTS models:
- call gsm_{bts,trx}_mark_all_ts_uninitialized() when OM is torn down, to make
  sure the TS init mechanism will work a second time.

For all BTS models supporting dyn TS, i.e. osmo-bts, nanobts and RBS2k:
- implement oml_is_ts_ready().
- call gsm_ts_check_init() when a Channel OM is taken into operation.

Any BTS models that don't set oml_is_ts_ready() will see a ts init as soon as
RSL is bootstrapped (incidentally, the old dyn TS behavior before recent
Icf6e25ff068e8a2600562d52726ead65e864ec02).

This firstly fixes dyn TS for RBS2k by re-adding the initial switch to PDCH,
and furthermore does so only after both OML TS opstart and RSL are through.

This fixes the ttcn3-bsc-tests around dyn TS, since for the osmo-bts-virtual,
the RSL is established only after OML opstart on the TS, which was broken by
Icf6e25ff068e8a2600562d52726ead65e864ec02.

Nokia Site and Siemens BS11 practically do not require this init mechanism,
since all that happens there so far is dyn TS init, and these BTS models do not
support dyn TS of any kind. A future patch may add oml_is_ts_ready().

Related: OS#3205
Change-Id: I99f29d2ba079f6f4b77f0af12d9784588d2f56b3
2018-05-10 04:53:53 +02:00
Neels Hofmeyr bf7099262a dyn ts, bts_ipaccess_nanobts.c: init PDCH on Chan OPSTART ACK
Sending PDCH activation upon RSL bootstrap is too early. Introduce OPSTART ACK
handling to call dyn_ts_init() only when the dynamic timeslot is indeed ready
to receive a PDCH activation.

Related: OS#3205
Change-Id: Icf6e25ff068e8a2600562d52726ead65e864ec02
2018-05-05 01:50:49 +02:00
Neels Hofmeyr f28f1ef9af resurrect meas_feed.c: vty, vty-test
At this point, meas-feed is usable again, however, osmo-bsc is not able to
include the IMSI in every report like osmo-nitb did.

In consequence, the meas-vis and meas-web tools are unable to handle the
current measurement reports: these so far use the IMSI to list reports, and all
reports without an IMSI are collapsed onto the same line, swapping values.

So though osmo-bsc now sends usable measurement reports via meas-feed, two
avenues to improve should be pursued:

OS#3192: the visualization tools should use bts,ts,ss numbers, not IMSI.
OS#2969: osmo-bsc should always know a mobile identity.

Related: OS#2968
Change-Id: I186c7a995dd2b81746c32a58b55da64ed195a1ce
2018-05-04 15:02:24 +00:00
Pau Espin 5198342fb5 gsm_data_shared.h: Remove unused enum gsm_paging_event
Change-Id: I13f30177a4840d68e3d374861fb9c76e9842be2e
2018-04-23 16:57:07 +02:00
Stefan Sperling ea33341cf7 ensure that acc_ramp_init() is only called once
There are plans to register signal handlers in acc_ramp_init(). Once we
do that, the acc_ramp_init() function should only be called once to
avoid duplicate signal handlers on the handler list.

However, the acc_ramp_init() function currently serves a dual-purpose:

 1) Initialize the acc_ramp structure for a bts
 2) Enable or disable ACC ramping

Add new functions to support use case 2, and call acc_ramp_init()
just once while reading the configuration file. The VTY commands
which enable/disable ACC ramping use the new APIs instead.

Also, rename acc_ramp_start() to acc_ramp_trigger() and tweak its
semantics so that it can always be called regardless of what the
current configuration settings are. This prepares us for triggering
ACC ramping upon events other than "RSL link-up".

Change-Id: Ia25bff85d9e5c277da76bffa11d31972e9fdc323
Related: OS2591
2018-04-11 16:53:05 +00:00
Pau Espin 881836a770 bsc_nat: Drop redundant ccon ptr in bsc_cmd_list
It can be obtained from cmd field, so no need to store it in pending.
This way we simplify the ad-hoc struct bsc_cmd_list.

Change-Id: I6de64fc128ad623ca30b9e6cebebaff8de18f95d
2018-04-11 16:52:49 +00:00
Philipp Maier c74a5616bf cosmetic: remove dead code
There is a lot of dead code in osmo_bsc_msc.c that used to handle
the IPA multiplexed SSCP lite A interface.

- remove portions of the dead code
- remove IPA Ping related VTY commands

Change-Id: I5cf3fec31cc774c902f3cfe6d16fb85ef301694a
2018-04-02 19:33:11 +00:00
Neels Hofmeyr cd3bf6249b vty: drop unused vty definitions (*_NODE, msc_*)
Change-Id: I2a6516756bada8cc9375422e4f93891ab8d65ca5
2018-03-22 17:27:57 +00:00
Harald Welte ead291aaf2 bssmap: State correct speech codec in ASSIGNMENT COMPLETE
Correctly compute the TS 48.008 "speech mode" (codec) for AMR on TCH/F.

There are way too many different ways how to express a given voice
codec.  There are two different schemes in TS 48.008 alone, plus one
on TS 48.058 and one in 04.08 / 44.018.  Let's avoid unneeded
conversion (that we might get wrong) and avoid storing information in
a sub-struct of the lchan if we can simply derive it from the lchan
at the time we need it.

Also, move BSSAP related encoding/conversion functions closer to the
user (osmo_bsc_bssap), rather than in libbsc.

Without this patch, TCH/F with AMR was erroneously reported as TCH/H
with AMR in the BSSMAP ASSIGNMENT COMPLETE.  After this patch, it's
reported correctly.

Change-Id: I6feebfae77fdc93a7ce333a25dd9b9267c5a4a2e
Related: OS#3094
Related: OS#3095
Related: OS#3096
2018-03-22 15:15:12 +00:00
Philipp Maier 79745fc0cb cosmetic: fix typo
Change-Id: I36ed82dcb6010b331fe247a60f373d8e2e8a4bfc
Related: OS#2823
2018-03-22 12:55:41 +00:00
Philipp Maier 458d8a19c9 cosmetic: remove unused enum members
The enum gscon_fsm_event has three unused members.

- remove GSCON_EV_RR_HO_ACC, GSCON_EV_RR_HO_COMPL, GSCON_EV_RR_HO_FAIL

Change-Id: I301f7160b9ec8380849f9c9906b41c121a54f49f
Related: OS#2823
2018-03-22 12:55:40 +00:00
Neels Hofmeyr da5b09a08e cosmetic: abis_nm: use osmo_cell_global_id, parse 3-digit MNC
Instead of a local redefinition, use osmo_cell_global_id.

This change is cosmetic because the decoded PLMN is currently actually never
used.

Change-Id: I38ac98a4d25159cfd4f686efbfbaf8f00625a6d8
2018-03-22 04:13:09 +00:00
Harald Welte f94cbf607b RR: Send RR STATUS in case of unsupported/unknown message
This fixes BSC_Tests.TC_err_84_unknown_msg

Related: OS#2903
Change-Id: I7ecb48971c6a162c7f4c749d128c31d0dbc4916f
2018-03-17 21:46:56 +01:00
Harald Welte 3561bd4897 introduce an osmo_fsm for gsm_subscriber_connection
In the current implementation of osmo-bsc, the subscriber connection is
not handled (very) statefully. However, there is some state keeping in the
code that handles the mgcp connection, but there are still to much loose ends
which allow odd situations to happen, which then lead severe error situations
(see also closes tags at the end) This commit adds a number of improvements
to fix those problems.

- Use an osmo-fsm to control the gsm_subscriber_connection state and
  make sure that certain operations can only take place at certain states
  (e.g let connection oriented SCCP traffic only pass when an SCCP connection
  actually exists.

  Remove the old osmo_bsc_mgcp.c code. Use the recently developed MGCP client
  FSM to handle the MGCP connections.

  Also make sure that stuff that already works does not break. This in
  particular refers to the internal handover capability and the respective
  unit-tests.

  See also OS#2823, OS#2768 and OS#2898

- Fix logic to permit assignment to a signalling channel. (OS#2762)

- Introduce T993210 to release lchan + subscr_conn if MSC fails to respond

  The GSM specs don't have an explicit timer for this, so let's introdcue
  a custom timer (hence starting with 99).

  This timeout catches the following situation:
  * we send a SCCP CR with COMPL_L3_INFO from the MS to the MSC,
  * the MSC doesn't respond (e.g. SCCP routing failure, program down, ...)

  The MS is supposed to timeout with T3210, 3220 or 3230.  But the BSC
  shouldn't trust the MS but have some timer on its own.

  SCCP would have a timer T(conn est), but that one is specified to be
  1-2min and hence rather long.

  See also: OS#2775

- Terminate bsc_subscr_conn_fsm on SCCP N-DISC.ind from MSC

  If the MSC is disconnecting the SCCP channel, we must terminate the FSM
  which in turn will release all lchan's and other state.

  This makes TC_chan_rel_hard_rlsd pass, see also OS#2731

  As a side-effect, this fixes TC_chan_act_ack_est_ind_refused(),
  where the MSC is answering with CREF to our CR/COMPL_L3.

- Release subscriber connection on RLL RELEASE IND of SAPI0 on main DCCH

  The subscriber connection isn't really useful for anything after the
  SAPI0 main signalling link has been released.  We could try to
  re-establish, but our best option is probably simply releasing the
  subscriber_conn and anything related to it.

  This will make TC_chan_rel_rll_rel_ind pass, see also OS#2730

This commit has been tested using the BSC_Tests TTCN3 testsuit and the
following tests were passed:

TC_chan_act_noreply
TC_chan_act_ack_noest
TC_chan_act_ack_est_ind_noreply
TC_chan_act_ack_est_ind_refused
TC_chan_act_nack
TC_chan_exhaustion
TC_ctrl
TC_chan_rel_conn_fail
TC_chan_rel_hard_clear
TC_chan_rel_hard_rlsd
TC_chan_rel_a_reset
TC_rll_est_ind_inact_lchan
TC_rll_est_ind_inval_sapi1
TC_rll_est_ind_inval_sapi3
TC_rll_est_ind_inval_sacch
TC_assignment_cic_only
TC_assignment_csd
TC_assignment_ctm
TC_assignment_fr_a5_0
TC_assignment_fr_a5_1_codec_missing
TC_assignment_fr_a5_1
TC_assignment_fr_a5_3
TC_assignment_fr_a5_4
TC_paging_imsi_nochan
TC_paging_tmsi_nochan
TC_paging_tmsi_any
TC_paging_tmsi_sdcch
TC_paging_tmsi_tch_f
TC_paging_tmsi_tch_hf
TC_paging_imsi_nochan_cgi
TC_paging_imsi_nochan_lac_ci
TC_paging_imsi_nochan_ci
TC_paging_imsi_nochan_lai
TC_paging_imsi_nochan_lac
TC_paging_imsi_nochan_all
TC_paging_imsi_nochan_plmn_lac_rnc
TC_paging_imsi_nochan_rnc
TC_paging_imsi_nochan_lac_rnc
TC_paging_imsi_nochan_lacs
TC_paging_imsi_nochan_lacs_empty
TC_paging_imsi_a_reset
TC_paging_counter
TC_rsl_drop_counter
TC_classmark
TC_unsol_ass_fail
TC_unsol_ass_compl
TC_unsol_ho_fail
TC_err_82_short_msg
TC_ho_int

Authors:
Harald Welte <laforge@gnumonks.org>
Philipp Maier <pmaier@sysmocom.de>
Neels Hofmeyr <neels@hofmeyr.de>

Closes: OS#2730
Closes: OS#2731
Closes: OS#2762
Closes: OS#2768
Closes: OS#2775
Closes: OS#2823
Closes: OS#2898
Closes: OS#2936
Change-Id: I68286d26e2014048b054f39ef29c35fef420cc97
2018-03-16 18:49:47 +00:00
Philipp Maier 8c498fc26b gsm_data: use feature list from libosmocore
In order to avoid code duplication the feature list (bit masks) and
the desciptive value strings as well as the function to set and get
the feature bits have been moved to libosmocore.

- use feature list functionality provided by libosmocore

Depends: libosmocore Change-Id Id0c35aef11aa49aa40abe7deef1f9dbd12210776
Change-Id: I3e80517539cc5d0e5d8189d434a5e3cc0fdea1a0
2018-03-12 10:18:05 +00:00
Neels Hofmeyr 4ac7763bc7 pcu_if: implement support for 3-digit MNC
Add the mnc_3_digits member to the info_ind.

Instead of changing to e.g. osmo_plmn_id, add the flag separately, and instead
of bool use a uint8_t, to not raise any struct packing issues and clarify the
flag's size beyond any doubt.

Bump the PCU interface version to 9.
This is one part of the three identical pcuif_proto.h patches:
- I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 (osmo-bts)
- I787fed84a7b613158a5618dd5cffafe4e4927234 (osmo-pcu)
- I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 (osmo-bsc)

Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore)
Change-Id: I78f30aef7aa224b2e9db54c3a844d8f520b3aee0
2018-03-11 00:45:45 +01:00
Neels Hofmeyr f93970b167 implement support for 3-digit MNC with leading zeros
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout
the code base to be able to handle an MNC < 100 that has three digits (leading
zeros).

The changes to abis_test and gsm0408_test show that this code now handles
3-digit MNC correctly, by not dropping the leading zero as 0xf in the encoded
PLMN.

Re-implement CTRL commands 'mcc', 'mnc' and 'mcc-mnc-apply' to preserve the
presence of the third digit of the MNC. Always reply with all leading zeros.
Adjust the expected results in ctrl_test_runner.py, to show that it works.

In VTY and CTRL, the parsing of MCC and MNC is inherently made stricter by use
of osmo_{mcc,mnc}_from_str() -- they will no longer allow surplus characters
and detect errno returned by strtol() (in contrast to atoi()).

Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore),
	 Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore),
	 I020a4f11791c61742a3d795f782805f7b7e8733e (libosmocore)
Change-Id: I8e722103344186fde118b26d8353db95a4581daa
2018-03-07 15:34:48 +00:00
Neels Hofmeyr f7a6329bbd cosmetic: bsc_network_init(): imply default 001-01 PLMN
All callers pass mcc=1, mnc=1, so just have it as default.
(Prepare for net->country_code etc to be replaced by net->plmn)

Change-Id: Ic16bc0bab3f2d4721e86a1a04f9d9f988d777df2
2018-03-05 05:37:54 +01:00
Neels Hofmeyr 4d358c00e1 gsm48_ra_id_by_bts(): struct gsm48_ra_id* instead of buf
Move from using deprecated gsm48_construct_ra(), which uses a buf, to
gsm48_encode_ra(), which uses a gsm48_ra_id argument. Pass struct gsm48_ra_id
around instead of a buf.

struct gsm48_ra_id is the "encoded" representation of the bytes in a typical
MCC-MNC-LAC-RAC (04.08 Routing Area Id IE, 3GPP TS 24.008 § 10.5.5.15). Using
the struct spares using magic numbers for byte offsets.

In the process, fix a sanitizer warning for unaligned access by using memcpy()
instead of pointer assignment:

  osmo-bsc/src/libbsc/abis_nm.c:2857:27: runtime error: store to misaligned address 0x7ffe8e0d6695 for type 'uint16_t', which requires 2 byte alignment

Note that (besides removing a now unnecessary cast) the gsm0408_test and
abis_test tests of RAI / CGI encoding remain stable, which indicates that the
new code is still correct.

Change-Id: I0d3908fb8ca1e2e669d257b5d59b40675fa85d06
2018-03-05 05:35:54 +01:00
Alexander Couzens 1231ebe031 pcuif_proto.h: add features of version 7 (txt indication)
The txt indication has been introduced with version 7, but
forgotten to sync back to this repo.

Change-Id: Iafef7dae8b84f659a1aca1677b30a38a2e5558dc
2018-02-28 02:53:20 +01:00
Alexander Couzens 50eed420e6 pcuif_proto.h: fix whitespaces and indention
Change-Id: Ic676bb046a8ee254b9ee8d0d126ce79e6057cfb3
2018-02-28 02:52:49 +01:00
Stefan Sperling 6442e4327b Add support for Access Control Class ramping.
Access Control Class (ACC) ramping is used to slowly make the cell
available to an increasing number of MS. This avoids overload at
startup time in cases where a lot of MS would discover the new
cell and try to connect to it all at once.

Ramping behaviour can be configured with new VTY commands:

  [no] access-control-class-ramping
  access-control-class-ramping-step-interval (<30-600>|dynamic)
  access-control-class-ramping-step-size (<1-10>)

(The minimum and maximum values for these parameters are hard-coded,
but could be changed if they are found to be inadequate.)

The VTY command 'show bts' has been extended to display the
current ACC ramping configuration.

By default, ACC ramping is disabled.

When enabled, the default behaviour is to enable one ACC per
ramping step with a 'dynamic' step interval. This means the
ramping interval (time between steps) is scaled to the channel
load average of the BTS, i.e. the number of used vs. available
channels measured over a certain amount of time.

Below is an example of debug log output with ACC ramping enabled,
while many 'mobile' programs are concurrently trying to connect
to the network via an osmo-bts-virtual BTS. Initially, all ACCs
are barred, and then only one class is allowed. Then the current
BTS channel load average is consulted for scheduling the next
ramping step. While the channel load average is low, ramping
proceeds faster, and while it is is high, ramping proceeds slower:

(bts=0) ACC RAMP: barring Access Control Class 0
(bts=0) ACC RAMP: barring Access Control Class 1
(bts=0) ACC RAMP: barring Access Control Class 2
(bts=0) ACC RAMP: barring Access Control Class 3
(bts=0) ACC RAMP: barring Access Control Class 4
(bts=0) ACC RAMP: barring Access Control Class 5
(bts=0) ACC RAMP: barring Access Control Class 6
(bts=0) ACC RAMP: barring Access Control Class 7
(bts=0) ACC RAMP: barring Access Control Class 8
(bts=0) ACC RAMP: barring Access Control Class 9
(bts=0) ACC RAMP: allowing Access Control Class 0
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 1
(bts=0) ACC RAMP: step interval set to 354 seconds based on 59% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 2
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average
(bts=0) ACC RAMP: allowing Access Control Class 3
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load average

Change-Id: I0a5ac3a08f992f326435944f17e0a9171911afb0
Related: OS#2591
2018-02-27 14:29:39 +00:00
Neels Hofmeyr 444f9e2bb0 HO: vty: rename ho decision 1 vty to 'handover1' with 'handover' alias
Handover decision 2 arguments are now configured by 'handover2 foo'. To match
that scheme, rename the previously 'handover foo' args for handover decision 1
to 'handover1 foo'.

For backwards compatibility, still provide aliases of the original VTY
commands. Writing back the config will result in 'handover1' though.

Change-Id: I7305ae7c04cc70082cd80d42b2ba32ffa399f51a
2018-02-19 17:11:47 +01:00
Neels Hofmeyr 909e972787 HO: Implement load based handover, as handover_decision_2.c
Change-Id: Ie597eae82722baf32546331e443dd9d94f1f25e6
2018-02-19 17:11:47 +01:00
Neels Hofmeyr 45e46d2c88 HO: introduce ho decision callbacks
Instead of reacting on S_LCHAN* signals in the handover decision code,
introduce callbacks for the handover decision to be invoked by handover_logic.c
at the appropriate time.

The rationale is explained in a comment to struct handover_decision_callbacks,
quoting:

"
All events that are interesting for handover decision are actually communicated
by S_LCHAN_* signals, so theoretically, each handover algorithm could evaluate
those.  However, handover_logic.c cleans up handover operation state upon
receiving some of these signals. To allow a handover decision algorithm to take
advantage of e.g. the struct bsc_handover before it is discarded, the handover
decision event handler needs to be invoked before handover_logic.c discards the
state. For example, if the handover decision wants to place a penalty timer
upon a handover failure, it still needs to know which target cell the handover
failed for; handover_logic.c erases that knowledge on handover failure, since
it needs to clean up the lchan's handover state.

The most explicit and safest way to ensure the correct order of event handling
is to invoke the handover decision algorithm's actions from handover_logic.c
itself, before cleaning up. This struct provides the callback functions for
this purpose.

For consistency, also handle signals in this way that aren't actually in danger
of interference from handover_logic.c (which also saves repeated lookup of
handover state for lchans). Thus, handover decision algorithms should not
register any signal handler at all.
"

Also:
- Publish struct bsc_handover to use it as argument to above callbacks.
- Add enum hodec_id to struct bsc_handover, to be able to signal the
  appropriate hodec algorithm per event.
- Add hodec_id argument to bsc_handover_start*() to be placed in the
  bsc_handover struct.
- Publish the LOGPHO logging macros in handover.h along with struct
  bsc_handover, convenient for logging in callback implementations.

Replace handover_decision.c's signal handler with a registered
handover_decision_callbacks instance.

(Upcoming handover_decision_2 will use all of the callbacks introduced here.)

Change-Id: Id5b64504007fe03e0406a4b395cd0359232b77d2
2018-02-19 17:11:47 +01:00
Neels Hofmeyr ec42264113 HO: clearly mark conn penalty timer member for hodec2
The conn's penalty timers will be used only for handover decision 2, make it
clear by a sub-struct.

hodec2 will also initialize the penalty timer list on demand only, so no need
to always initialize.

Change-Id: Ie6c2bc2b10dc424dfd94a9e11a9a62f51c48aa10
2018-02-19 17:11:29 +01:00