Commit Graph

126 Commits

Author SHA1 Message Date
Max 6384c73fbf Support sending SI13 to PCU
* explicitly set SAPI when sending data_ind to PCU
* drop unused receiving code for BCCH SAPI
* send SI13 when PCU is connected
* send SI13 when new SI is received

Change-Id: I9e83ef792585aa962f99897d9973cef12f186bcf
Related: OS#2400
2017-08-31 14:44:45 +02:00
Max 152c2f489c si2q: do not consider count update as error
The number of SI2quater messages might be updated dynamically by
BSC (via 'bts 0 resend-system-information' command for example). Log it
but do not return error.

Related: OS#2357
Change-Id: I9625be879c672e20543cc40af288828143ffb983
2017-07-11 16:22:29 +00:00
Max 4962ed1811 RSL: receive and send multiple SI2q messages
* change BCCH Info handler to explicitly support multiple SI2quater
  messages sent from BSC
* change SI scheduler to send SI2q in round-robin way

That's resubmission of 340cff51f4 and
186c6bac07 with memory initialization
order change to fix the issue detected by osmo-gsm-tester - see OS#2338.

Change-Id: Ib595733cde108387bc7ee76b1b11ada6a235f13c
Related: OS#1660, OS#2338
2017-06-28 07:56:32 +00:00
Neels Hofmeyr 61f9158eaf Revert "RSL: receive and send multiple SI2q messages"
This reverts commit 340cff51f4.

osmo-gsm-tester detected a regression due to this commit, when running
osmo-bts-trx. The modems timed out when waiting for them to register with the
osmo-bts-trx network. osmo-bts-sysmo is apparently not affected. No further
details on the failure cause are known yet. The failure is shown for example by
http://jenkins.osmocom.org/jenkins/view/osmo-gsm-tester/job/osmo-gsm-tester_run/868/

Change-Id: I15bca30ddc09a7a3044096626016f6130d07636c
2017-06-24 00:49:26 +02:00
Neels Hofmeyr 1ba0cfe9c0 Revert "RSL: check for abnormal SI2q values"
This reverts commit 186c6bac07.

osmo-gsm-tester detected a regression due to commit
340cff51f4, which above commit apparently depends
on. Revert this along to avoid conflicts.

Change-Id: I456e9add788393ca781213cef31b5bc3d48fd531
2017-06-24 00:48:23 +02:00
Max 186c6bac07 RSL: check for abnormal SI2q values
Check for impossible index and count values of SI2q messages. The limit
is defined in 3GPP TS 44.018 Table 10.5.2.33b.1

Change-Id: I351f8e8641a1cb9548154803da70bfde46ee180d
Fixes: CID 170749
2017-06-16 20:17:37 +02:00
Max 340cff51f4 RSL: receive and send multiple SI2q messages
* change BCCH Info handler to explicitly support multiple SI2quater
  messages sent from BSC
* change SI scheduler to send SI2q in round-robin way

Change-Id: I3aeb90804edab1b0325c3eb7347526ae995dbf51
Related: OS#1660
2017-06-15 19:18:47 +00:00
Philipp Maier 0e7886d379 measurement: Improve log output
The debug log does not print much information about the measured
rxlev and rxqual values. This commit adds debug output to make
measurement debugging simpler

Change-Id: Ic871eed6dcbc7d10aca6cd11dbc803b3e6da449f
2017-06-13 10:06:24 +00:00
Philipp Maier d5fdcfe6d9 measurement: fix measurement computation
Timing advance is currently not taken into account when computing
the measurement results, this commit fixes that

Change-Id: I2e0dfd13b53e8aa2822985f12bf2985e683ab553
2017-06-09 08:54:54 +00:00
Harald Welte 05ba5c2a10 Consistently check for minimum attribute/TLV length in RSL and OML
Make more use of TLVP_PRES_LEN() instead of plain TLVP_PRESENT() and
implicitly assuming a certain length of the information element.

What this obviously doesn't introduce is some kind of error
generation/reporting in case the minimum length is not fulfilled.  An IE
that's too small is silently ignored by TLVP_PRES_LEN() and treated as
if the IE wouldn't exist in the first place.

Change-Id: If5c4eee65711c49bc8ba4675221b1d5fd16198e9
2017-05-29 19:55:30 +00:00
Max 9563039a2a Prepare for extended SI2quater support
SI2quater support as per 3GPP TS 44.018 will require chnages to the way
System Information is stored because it uses 1:n instead of 1:1 mapping
between SI type and generated SI content. This should not affect other
SI types though. To facilitate this transition:

* convert the code to always use GSM_LCHAN_SI helper instead of
  accessing buffer directly
* move duplicated code to inline function
* add logging for buffer truncation and corresponding length values

Requires I74e4e3cb86364cec869a1472a41b4a95af0d50dd in OpenBSC.

Change-Id: Ie97be6ead6ce6d2d425fbfac8429bb90afb95acc
Related: RT#8792
2017-05-09 09:10:45 +00:00
Max b4bf603c98 Add MS TO to RSL measurements
Add optional MS timing offset (3GPP TS 45.010 § 1.2) to RSL MEASUREMENT
RESULT (3GPP TS 48.058 § 8.4.8). The value is calculated either directly
from corresponding BTS measurement or from 3GPP TS 48.058 § 9.3.17
Access Delay (for known TA) and is invalidated after RSL report is sent
until new measurement indication or RACH is received.

Change-Id: I4dfe5c48834a083e757d5de3236a02e15a238b28
Related: OS#1574
2017-04-26 12:42:09 +02:00
Alexander Chemeris d5414cc30e rsl: Output RTP stats before closing the socket.
It's useful to know RTP statistics (number of packets lost, jitter, etc)
when looking at voice call quality issues. Right now this information is
not avialable anywhere and this looks like the best place to start.

Change-Id: Ife9f27c43157b4a1bf71aba41cd7b0f5f41ac99f
2017-02-10 12:23:38 +00:00
Neels Hofmeyr d15dc832c9 SACCH SI: assert that SI enum vals fit in bit mask
In case our SI enums ever move past 31, this static assert will warn us to
enlarge osmo_si_shifted.

Change-Id: I4185d7de590329ff5f523b241721c586ffdbcd8b
2017-02-08 19:34:14 +01:00
Neels Hofmeyr 1631266993 SACCH: fix sending of SI with an enum value > 7
In copy_sacch_si_to_lchan(), the variable to hold the bit mask for SI-is-valid
was chosen as uint8_t, and as a result none of the SIs with an enum value >= 8
would ever be sent. Use int for enum value and uint32_t for the bit mask.

Fixes: #1945
Change-Id: I85fa9a50691601bcd103845c6811caa061a39824
2017-02-08 19:34:06 +01:00
Neels Hofmeyr 3c144069da fix missing ~ in bit logic for lchan->si.valid in rsl_rx_sacch_inf_mod()
Upon rx of a SACCH INFO Modify for an lchan that has no L3 INFO IE, clear only
the si.valid bit in question, instead of clearing all but the one in question.

BTW, It first looked like it could be, but is *not* the cause for OS#1945
(SI5ter never sent to MS).

Change-Id: I0df20b6643b0bfd219ce1df594075838d8406719
2017-02-08 18:00:57 +01:00
Jean-Francois Dionne eb4a3392e1 Fix SACCH channel release indication not sent to BSC after location update.
Based on GSM 04.08 3.4.13 RR connection release procedure, after the network
sends a deactivate SACCH it receives DISC from MS which cause BTS to
send RLL release indication to BSC in order to stop T3109 timer. It has been
found that after a location update BSC never receives RLL release indication
which causes a T3109 timeout because no TCH is currently allocated. This fix
ensures RLL release indication to be sent to BSC when no TCH is allocated
in the particular case of a location update.

Change-Id: Ibe2a365641eb8c9a7f0a462b7393ec3fd28cc366
2017-02-03 17:18:04 -05:00
Minh-Quang Nguyen 16b4179fbe rsl: Fix dropping of LAPDm UA message.
In some cases, when successive mobile originated calls are made, the LAPDm UA
message gets lost because the channel is relased to early. Too overcome the
problem we do not send relase indications immediately. Instead a flag will be
set and the message stored and sent on the next TCH-RTS-IND.

This commit adds the functionality to store the release indication msg, to
rsl.c. It also addes the mechanism to forward the release indication to l1sap.c
See also coresponding change in openbsc.git:
Change-Id I15fc1ef8e9e83f009bde96de9a8e95702cffbce6

This patch is is a slightly improved/reformatted version of:
95d1f15ad1

Change-Id: Ie4f70c75f0137b4bd72d579b3a32575bac2fca38
2017-02-01 16:35:42 +00:00
Max 871e0bec7e OML: internalize failure reporting
* make oml_tx_failure_event_rep() static and use osmo_signal_dispatch()
  wrapped into oml_fail_rep() to trigger event reports outside of oml.c
  instead of directly calling into OML layer
* remove unnecessary formatting from text messages

Related: OS#1615
Change-Id: I738555c547926e97b325ab53763c0076c42309bc
2017-01-25 13:24:52 +01:00
Philipp Maier 563b744b38 RSL: add assertions to check args of public API
The public functions in rsl.c do not check for null pointers,
add assertions to catch null pointers early.

Change-Id: I63f127ce70a4127180f90238f564b63e355216ec
2017-01-10 14:13:56 +00:00
Philipp Maier 792573dc97 RSL: drop obsolete NULL check
rsl_rx_paging_cmd() checks if the pointer *trx is NULL, this check
does not make much sense since *trx has already been dereferenced
without checking earlier in the code. Furthermore *trx is also a
mandatory parameter which must not be NULL.

Fixes: coverity scan CID#159534
Change-Id: I17dfb42ff404b2a1e18354fb7a7278089b407a79
2017-01-10 11:53:50 +00:00
Max ec11a85929 Alarm on various errors
Send OML Failure Report for unsupported BTS attributes and other errors.

Change-Id: Ic163bcfb6361a8ebd39e0bc0f238ef51e2cb214e
Related: OS#1615
2017-01-08 11:09:58 +00:00
Max fbe655f320 Optionally use adaptive RTP jitter buffering
* add vty option to manually enable adaptive RTP jitter
  buffering (disabled by default) on per-bts level
* use this setting on per-lchan level when setting jitter parameters via
  vty at runtime
* check and log result of osmo_rtp_socket_set_param()
* note: older libosmo-abis will ignore this setting which will be
  properly detected via return value
* if jitter buffer is disabled by configuring "rtp jitter-buffer 0" than
  adaptive buffering is disabled as well but it will be used if jitter
  buffer is set to different value for a givel lchan via vty

Change-Id: I489f3c419039f40b57c2ef0641c176478b8d3566
2016-12-16 14:04:50 +01:00
Max 4a85828462 Fix AGCH/PCH proportional allocation
Do not assume that 1 == BS_AG_BLKS_RES but take that information from
SI3. Note: due to current implementation quirks we activate channels
before SI3 obtained, than we deactivate channels upon receiving SI3 and
activate them again. This might not be necessary once we migrate to
proper OML state machines.

This affects lc15 and sysmo hw.

Change-Id: I11377b12680ac3b2f77f80e742b6f0af63fc9c1e
Related: OS#1575
2016-12-01 15:25:26 +00:00
Max 36153239bf Remove duplicated code
Remove lchan deactivation related code duplication to facilitate future
use for dynamic CCCH re-activation.

Change-Id: Id0d3b19dbfaa16d1734321a07a6eb0355bfd77c9
2016-12-01 15:20:42 +00:00
Max babd05661d DTX DL: use FSM for AMR
Use dedicated FSM to handle all DTX DL related events:
- add explicit checks if DTX DL is enabled (fixes regression for non-DTX
setup introduced in 654175f33b)
- fix handling of AMR CMI for SPEECH frames
- add FSM for DTX DL
- sync with corresponding changes in OpenBSC's
- handle FACCH-related DTX ONSET events

This affects both lc15 and sysmobts and requires corresponding change in
OpenBSC (Change-Id: Idac8609faf9b5ced818fde899ccfc6ed0c42e8fd).

Change-Id: I74a0b42cb34d525b8a70d264135e82994ca70d31
2016-10-13 06:58:06 +00:00
Philipp Maier 93f3102da9 rsl: improving the log output
to show more details about the payload type and the connection

Change-Id: Ifaa253e5baed5ca364dfbc046a7cb559f106bfbd
2016-10-12 10:17:43 +00:00
Yves Godin c1b86d80d1 DTX: fix 1st RTP packet drop
Use "impossible" dummy value to initialize last_fn to prevent dropping
of 1st RTP frame due to timestamp jump.

Fixes: OS#1803
Change-Id: I485af21f6761048d12dc7f5552fcdd46daf786ed
2016-10-11 15:50:29 +00:00
Neels Hofmeyr b4969cc915 log causing rx event for lchan_lookup errors
Add log_name to lchan_lookup() and pass such from the various RSL rx events
that call it to validate the RSL chan_nr.

Change-Id: I0d9923f47ac655b204169eec302d607412d5754d
2016-09-19 02:12:23 +00:00
Neels Hofmeyr d44f0772f9 dyn TS: if PCU is not connected, allow operation as TCH
Before this patch, Osmocom style TCH/F_TCH/H_PDCH dyn TS were paralyzed if no
PCU was running. The state of the dyn TS would lock up in the PDCH activation
phase since the PCU never completed the process.

Make more robust, i.e. don't concern the BSC with PDCH activation failures.
This matches the way plain PDCH TS work: besides declaring the TS as PDCH, the
BSC is not involved and is not told about errors.

During PDCH deactivation, still wait for the PCU to tear down the PDTCH SAPIs,
but in case no PCU is connected, send a rel ack right away.

Thus, the BSC will happily switch Osmocom style dynamic timeslots to and from
PDCH mode, using the dyn TS as voice channels as needed, and not caring about
possible PDCH failures. GPRS starts working right away as soon as a PCU
connects, regardless of dyn TS having been used for voice any number of times,
and without another switchover needed.

In detail:

In rsl_rx_chan_activ(), upon receiving a PDCH activation, send an RSL chan act
ack right away, unconditionally (with an explaining comment). Do not concern
the Abis link with PDCH activation failures.

Since we're acking right away now, drop the chan act ack that would follow
after the PCU activation: as before dyn TS, only send acks and nacks for
rel_act_kind == LCHAN_REL_ACT_RSL (PDCH runs as LCHAN_REL_ACT_PCU).

In dyn_ts_pdch_release, indicate that the PCU is not connected by means of
returning 1. In rsl_rx_rf_chan_rel(), use this indicator to send a rel ack
right away if the PCU is not connected.

Change-Id: I2a0b9730197786b99ff3bc1f08c75f7d279cb1f7
2016-09-09 06:45:27 +00:00
Neels Hofmeyr bf6bae2b23 common/rsl: move decision whether to chan act ack/nack to common function
Prepare for a dyn TS patch that needs to call rsl_tx_chan_act_ack() directly
without the rel_act_kind decision.

Add function rsl_tx_chan_act_acknack() to wrap rsl_tx_chan_act_ack() and
rsl_tx_chan_act_nack(). Move the decision whether to drop the ack/nack, based
on lchan->rel_act_kind, to the new function, losing some code dup.

Change all callers to use the new function; drop the two older ones from rsl.h
and make them static.

Note: for nack, the exception for dyn TS in PDCH mode was missing
(rsl_tx_chan_act_nack() had only the rel_act_kind != LCHAN_REL_ACT_RSL
condition, but should also have had the dyn TS exception as in
rsl_tx_chan_act_ack()). I already know that this exception will again be
removed in an upcoming commit, but for patch readability it logically makes
sense to add it here. To easily include the nack case, drop the check for which
pchan the dyn TS is operating as, because a rel_act_kind == LCHAN_REL_ACT_PCU
implies that it is either already in or trying to become PDCH mode.

Change-Id: I57ba60c670730c6d7877a6a9b96ece0a7679a0bb
2016-09-02 04:12:16 +02:00
Neels Hofmeyr 21ffe07894 dyn TS: common TCH/F_TCH/H_PDCH implementation
common/l1sap: For dyn TS, the BSC will issue RSL Chan Activ requests with a
non-standard chan_nr. While the rest of the code now understands that, the L1
phy will not. Translate to standard PDCH (== TCH/F).

common/oml: use dyn TS' current pchan mode for lchans config.

common/pcu_sock: detect desired PDCH mode of dyn TS.

common/rsl: implement reconnection chain of a TS for changing its pchan:

* rsl_rx_chan_activ():
** Add dyn_pchan_from_chan_nr() to derive the requested pchan from the RSL
   chan_nr IE.
** Notice the need for a pchan change and invoke dyn_ts_l1_reconnect() (s.b.)
** Make Chan Mode IE presence optional, because the non-standard PDCH
   activation message is simpler and does not require it.
** Do PDCH activation via PCU.

* Add dyn_ts_l1_reconnect(): store state and disconnect the L1 channel;
  then wait for cb_ts_disconnected().

* Add osmo_dyn_ts_disconnected() to cb_ts_disconnected():
  verify state and connect with the new pchan type; then wait for
  cb_ts_connected().

* Add osmo_dyn_ts_connected() to cb_ts_connected(), which re-issues
  the cached chan activation message from before disconnecting the L1 channel.

* Also send an rf chan rel/act ack for dyn TS upon PDCH de/act via PCU.

* Add dyn_ts_pdch_release(): on channel release of a dyn TS in PDCH mode,
  release via the PCU. Call from rsl_rx_rd_chan_rel().

Change-Id: I463bb6b4e57674f091c3badba9257374961c52c7
2016-07-25 22:13:44 +02:00
Neels Hofmeyr 6e656748b7 code dup: join [rsl_]lchan_lookup() from libbsc and osmo-bts
lchan_lookup in openbsc abis_rsl.c and rsl_lchan_lookup() rsl.c are the
same code, except for the log context, which is only set in abis_rsl.c.
The common code was factored out to gsm_data_shared.c in openbsc.git.

Use the *rc return code argument to keep the logging part in the newly
introduced thin wrapper lchan_lookup() in common/rsl.c. This also removes code
dup for logging

The rsl_lchan_lookup() implementation is removed from osmo-bts, so a recent
openbsc is needed to build this.

Change-Id: Ibc469b75e31560271be8633d524366442d27e6fb
2016-07-25 22:13:44 +02:00
Neels Hofmeyr c57304b65e dyn PDCH: code dup: use conf_lchans_as_pchan()
For ip.access dyn PDCH, call conf_lchans_as_pchan() instead of dup'ing the
pchan-to-lchan switch.

Change-Id: I979828e08953e83ae579a347334536f52939faf0
2016-07-25 15:22:06 +00:00
Neels Hofmeyr 334df9441a cosmetic: clarify TCH/F_PDCH related naming and comments
We're about to introduce a new kind of dynamic channel, which will also use
parts of the ip.access mode dyn PDCH code paths. Make sure the general parts
have general names and mark ip.access specific parts as such.

Rename dyn_pdch_ts_[dis]connected() to cb_ts_[dis]connected().
Rename dyn_pdch_complete to ipacc_dyn_pdch_complete().
From cb_ts_[dis]connected(), factor out the current code into static
functions ipacc_dyn_pdch_[dis]connected() -- this will make sense once the
new dynamic kind is added to cb_ts_[dis]connected().

Change-Id: I7da5b7cb7b48572671f50e0dec97d9eec3083df1
2016-07-25 16:38:18 +02:00
Neels Hofmeyr ae65ccd0b2 error log: rsl.c: typo x2
Change-Id: I285fdff8260f008d856b9cda811e9fbb936893eb
2016-07-25 16:38:18 +02:00
Neels Hofmeyr 8a2f026cf0 doc: move dyn_pdch.msc to osmo-gsm-manuals.git
Also remove related cruft: .gitignore, msc-README and adjust an in-code
comment that referenced dyn_pdch.msc.

Change-Id: Ie41a453bb5070c1f18793f646dc053a978f43fba
2016-07-25 16:35:53 +02:00
Neels Hofmeyr c2874c4360 dyn PDCH: safeguard: exit if nothing pending in dyn_pdch_ts_disconnected()
The function would currently only be called in cases where one of the if
branches catches on, but for safety's and clarity's sake, don't ts_connect
using as_pchan if no reconnect is pending.

Change-Id: I52c34065254e902bb80662fc04540901b36cb4c3
2016-06-22 23:31:06 +00:00
Max f0d6d6ba02 Use error values instead of number for RSL error
Change-Id: I0aa695c42a4399828fb8e9c08c905870175b7149
2016-06-21 17:52:01 +02:00
Neels Hofmeyr b231e0f6cd error log: two minor clarifications
Change-Id: I95e4331f51f650d5077eb3a8f897f754d5d2b779
2016-06-17 15:50:48 +00:00
Neels Hofmeyr 24a31cfe43 dyn PDCH: implement main dyn PDCH logic in common/
React on IPAC PDCH ACT and DEACT messages and invoke the PCU and bts_model_ts_*
APIs to effect switchover. The dyn PDCH interaction is described in the comment
to rsl_rx_dyn_pdch(), the main entry point for PDCH switchover.

In case the bts_model_ts_* are not implemented (or return other errors),
reply with an IPAC PDCH ACT/DEACT NACK.

Add callbacks that mark steps in the PDCH switchover process,
dyn_pdch_ts_disconnected(), dyn_pdch_ts_connected() and dyn_pdch_complete().

Add hooks in l1sap.c on channel activation and release confirmation, to call
dyn PDCH callbacks.

BTS dyn PDCH implementations should invoke dyn_pdch_ts_disconnected() and
dyn_pdch_ts_connected() when bts_model_ts_disconnect() or
bts_model_ts_connect() are called, respectively. (upcoming for sysmoBTS)

Change-Id: Id2f5f77121a65d6c14eac127b3d4fb50e97a77ab
2016-06-17 15:50:48 +00:00
Neels Hofmeyr e951042475 dyn PDCH: rsl rx dchan: also log ip.access message names
Before, only standard ABIS RSL message names were logged, add ip.access
specific ones.

The IPAC_PDCH_ACT and _DEACT msgs are received with an ABIS_RSL_MDISC_DED_CHAN
discriminator, and not with _MDISC_IPACCESS like the others. Thus rsl_rx_dchan()
should be able to log ip.access message types properly.

Change-Id: I9db6826b515bf565fc7ae24fc0760b60928cc89f
2016-06-17 04:24:57 +02:00
Max c1586388dc Add DTXd support for sysmoBTS and LC15
* set/clear DTXd activity indicator for measurement reporting
* set DTXd status based on information from RSL

Related: OS#1563
Change-Id: I148a75725c4e5089b6f2da6e9adcbe94170d3257
Depends-On: I4a033b03fcd0deb4db7a38273b5407511dbf1d6c
Reviewed-on: https://gerrit.osmocom.org/220
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-06-12 15:42:34 +00:00
Max 201b424b73 Use libosmocore function for uplink measurements
Related: OS#1563
Change-Id: Ide47e8e69e0d2d5859c5249b22f4bad22c18aa57
Reviewed-on: https://gerrit.osmocom.org/108
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-05-31 11:58:08 +00:00
Max b2b1112a6e Add explicit check for SI2quater index and count
Right now we do not support multiple SI2quater messages, so return error
if either index or count is non-zero.
2016-03-17 13:50:31 +01:00
Harald Welte 085569df55 fix large amount of compiler warnings in common and sysmobts code 2016-01-04 20:29:24 +01:00
Harald Welte 44bc9408b1 common/rsl.c: The presence of a valied measurement result is DEBUG
we shouldn't consider the presence of a valid measurement result
as something NOTICEable
2015-12-03 19:54:38 +01:00
Andreas Eversberg c64fa4f888 Change to new structure of multirate at gsm_data_shared.h 2015-09-22 16:41:24 +02:00
Andreas Eversberg 12472df8f0 Add TCH messages to PH-/MPH-/TCH-SAP interface
This part moves TCH handling from osmo-bts-sysmo to common part. The RTP
handling is done at the common part, so they can be used by other BTS
models.
2015-09-22 16:39:04 +02:00
Andreas Eversberg 793e713c4b Move chan act/rel/modify from bts_model to PH-/MPH-/TCH-SAP interface
This part replaces channel activation/deactivation/modification routines
by MPH_INFO messages.
2015-09-22 16:39:03 +02:00