Commit Graph

35 Commits

Author SHA1 Message Date
Harald Welte 916d508bf6 measurement: Keep average of high-accurate ToA value in lchan
At the end of a measurement processing window, we currently compute
the ToA / timing offset at 1/256th symbol accuracy, but we only print
it to the log.  Let's store the value in the lchan to make it usable
by other code in follow-up patches.

Change-Id: I5f00a16ac966b627d9452a98b8fa70984bed684a
2018-02-27 20:00:16 +01:00
Harald Welte c092f4e1de measurement.c: higher-precision TA/TOA math
Change-Id: I0dc8e78545465dfc5c93691a49b86b6b8b56b432
2018-02-27 19:59:00 +01:00
Harald Welte 0d6c3e8110 measurement.c: Don't silently copy "FULL" measurements to "SUB"
The existing code contained an ugly hack that if we didn't have any
"SUB" measurements we would simply use the "FULL" values.  That's wrong
as TS 45.008 contains quite detailed rules on how the "SUB" values are
to be computed.  In some cases, they are identical to "FULL", but in
most they are not.

Let's remove the hack and replace it with an ERROR message, as clearly
something is wrong if we ever encounter a measurement period end in
which no single "SUB" measurement was received.  The only situation in
which this can occur is if the related uplink burst/block was missing,
so let's set BER to 100% and level to lowest possible.

Change-Id: I358f7b97fd4ea19264a77eff7abef13da7d5fbcd
2018-02-26 15:01:08 +01:00
Harald Welte 3a80a56b9b measurement: Compute RX{LEV,QUAL}-SUB for SDCCH and non-AMR TCH
The rules on how to compute RX{LEV,QUAL}-SUB are rather convoluted, and
depend on the detailed channel type and mode.

For SDCCH and TCH/H in signalling mode, it's easy: No DTX is allowed,
and all measurements are used in SUB.

For non-AMR (TCH/F and TCH/H in non-signalling mode), we need to count
the SACCH block measurements, as well as any
SID/SID_UPDATE/L3_FILL/DUMMY blocks received in the blocks of table
8.3 of TS 45.008.

Only AMR (TCH/AFS + TCH/AHS) are more difficult, as there are no fixed
blocks/bursts/frames that always contain uplink messages, but the L1
will have to determine if a valid SID_UPDATE was received or not.

This patch implements the above rules (except AMR related) in the common
part of OsmoBTS.  The AMR specific bits will have to follow as a later
patch, likely in a BTS specific way, i.e. separate changes to
sysmo/lc15/octphy/trx code.

Related: OS#2978
Change-Id: I16eb3747a1c23df935a4c50dafe46abce512a474
2018-02-26 15:01:08 +01:00
Harald Welte de3b4a248e measurement.c: Fix sdcch4_meas_rep_fn102 / sdcch8_meas_rep_fn102
Since Change-Id: I23fba50f48415314da40cf5bf86fce2ed3e66af6 we were not
reporting measurements for SDCCH channel types due to the wrong
encoding of the sdcch{4,8}_meas_rep_fn102 table.

Let's fix the table by encoding the needed information:

 "What is the modulo-102 remainder of the first burst of the last block
  before fn%102 reaches 37?" (SDCCH/4)

 "What is the modulo-102 remainder of the first burst of the last block
  before fn%102 reaches 12?" (SDCCH/8)

The TS 45.002 Clause 7 tables have to be consulted carefully to
determine this information.

Change-Id: Icf02354872670126ab3297b787b216981ca6c309
Related: OS#2965
2018-02-26 12:33:19 +00:00
Harald Welte 1effad1004 measurement.c: Hand Frame Number into measurement computation
This is currently only used for logging, but will be needed for proper
RX{LEV,QUAL}-SUB reporting in upcoming patches.

Related: OS#2978
Change-Id: I07fd06e8a379cab7c0c2eb111c3f5600037d3c9e
2018-02-23 19:57:44 +01:00
Harald Welte 2de8f6c7ec Revert "measurement: fix measurement computation"
This reverts commit d5fdcfe6d9, which
introduces a new function lchan_meas_update_ordered_TA whose
functionality I still haven't yet managed to fully understand. It
appears to be adjusting the requested timing advance (lchan->rqd_ta) but
outside osmo-bts-trx/loops.c code. This is odd, as rqd_ta is a state
variable of that loops.c code.

So for one part, it is a failure of encapsulation. The TA loop code
should be self-contained, particularly as it is only used for
omso-bts-trx, and not for the other BTS models. The new
lchan_meas_update_ordered_TA() function is used from common code,
applicable to all BTS models.

The resulting interaction between loops.c code and this new (now
reverted) function cause the TA value to only ever grow, despite the MS
never moving at all.

Change-Id: I5a5adac6f18f94a5b51758a5ace8ef6ddfd23e80
Related: OS#2989
2018-02-23 19:57:20 +01:00
Harald Welte 57ce53d8aa measurment.c: Introduce INFO category for DMEAS logging
There's no point in either having full verbosity in DEBUG level
and not logging any measurement related information in INFO.  Let's
at least print the results at the end of each measurement period in INFO
level.

Change-Id: I2c870531478c05ce31cc1015597a068a4a76cf99
2017-12-02 21:06:06 +00:00
Harald Welte 478f2f7696 measurement.c: Fix various typos in comments
Change-Id: Ief208045664769406cd60a92a12c4b44988a98b4
2017-12-02 21:05:34 +01:00
Philipp Maier 65db0f5c41 measurement: fix measurment report
The end of the measurement reporting period is not aligned with the
SACCH block where the results are reported. The tables that are
used to detect the end of the measurement period are therefore
wrong. The frame number of the SACCH block must be used and not the
TDMA frame number (modulo 104) of the measurement reporing interval.

The tables are oriented to the frame number of the first SACCH block,
at the beginning of an interval. However, when a SACCH block is received
it will always contain the result of the recently passed measurement
reporting period.

To match the tables, introduce another lookup table to remap each
SACCH block that ends to the matching beginning block number.

Change-Id: I1eef894e6f15b4449fc8926bebb118624efc7924
2017-07-10 15:30:59 +00:00
Philipp Maier d0846651a3 measurement: improve log output
The code that receives the uplink measurement data from L1 does not
print the number of already received uplink measurements. Since
this is a valuable information when debugging the log output will
now print this information as well.

(Patch by Octasic Inc.)

Change-Id: I79926f25de088571fcc2c14388c72fc968c2d382
2017-06-26 13:48:10 +00:00
Harald Welte 50f8165540 measurement: Remove dead code
We used to have trx_meas_check_compute() and call that from the
bts-specific code in order to iterate over all timeslots and all lchans
in the timeslots if we have to send measurement reports.  This was
executed once per frame, and created unequal CPU load over time, which
in turn might increase different per-ts jitter.

Since 2f028c4e2c in April 2017 we have
lchan_meas_check_compute(), which performs this on a per-lchan basis,
and hence CPU load is distributed over all active timeslots.

Change-Id: I6308cefe4a51e55719ea4ed4d613d3782b805c08
2017-06-24 12:55:11 +02: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 3e2de526b0 cosmetic: remove unused variable
Tha variable ms_timing_offset in lchan_meas_check_compute is not
used anymore.

Change-Id: I40c393f6864fe72b88a70da265b7775da8fb469c
2017-06-09 16:09:21 +02:00
Philipp Maier 67d3b8b136 Revert "measurement: exclude idle channels from uplink measurement"
The offsets used in the lookup tables may be phy dependand. So we
will have to do the alignment in the layer 1 interface of the
phy dependand code before we report the frame number up to the
higher layers.

This reverts commit e0fb3ae52d.

Change-Id: I8acab50cc1bb1cb133831c6a145f4d790e99176c
2017-06-09 16:09:21 +02: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
Philipp Maier e0fb3ae52d measurement: exclude idle channels from uplink measurement
The DATA-IND, received from the physical layer does not only include the actual
uplink data. It also includes the frames which are received when the channel
is idle (which is just noise). This would falsify the measurement results.

Depending on the BTS model, the phy may also filter the idle frames and not
send a DATA-IND at all, when the channel is idle. If this is the case, the
measurement period end can not be detected properly.

The idle frames are located at the very end of each measurement period. In
order to fix the issue, the measurement perioud has to end early. For TCH/F and
TCH/H 1, one frame has to be skipped. For TCH/H 0 two frames are skipped.

Example: For a TCH/F in TS0, the Measurement perioud would end at frame number
103. However, 103 is reserverd as idle frame. So we need to detect the end of
the measurement period at frame number 103 (-1).

Change-Id: I471a767c7974bdacadc3233d0c3e7b7965f6eafa
2017-05-24 22:19:02 +00:00
Philipp Maier 2f028c4e2c measurement: make lchan_meas_check_compute() available to l1sap.c
lchan_meas_check_compute() is a static function measurement.c.
In order to distribute the measurement result calculation events,
we need to be able to call lchan_meas_check_compute() from l1sap.c

Change-Id: Ideffe896613e0feda443bc13dac59dcdbbc605aa
2017-05-17 18:56:51 +02:00
Philipp Maier 67d8c72c2e measurement: fix measurement reporting period
The measurement reporting for the MS on a SDCCH lacks some of
the periods, defined in 3GPP TS 45.008, section 8.4.2. This
adds the missing conditions by adding complete lookup tables.

Change-Id: I23fba50f48415314da40cf5bf86fce2ed3e66af6
2017-05-17 18:56:24 +02:00
Philipp Maier e3de64cd67 measurement/cosmetic: Fixup source code comment
the function is_meas_complete() uses the *_meas_rep_fn104[]
lookup tables, defined at the beginning of the source file.

These lookup tabels contain a lot of magic numbers. This
commit adds a more elaborated comment with a reference
to the specification/section in order make the values
understandable.

Change-Id: Ic6e4037f965772e6b851c67662d5e7bf64cc04eb
2017-05-17 14:42:00 +02:00
Philipp Maier 22704a88e2 measurement/cosmetic: Fixup source code comment
the function ber10k_to_rxqual() has only a very brief
comment with the spec reference. This commit adds a more
explainatory comment that makes it easier to understand
from where the ber10k constants are taken.

Change-Id: I3d3488c97d0bffa7d449d3675afcc75b2a6a2703
2017-05-17 14:41:52 +02:00
Neels Hofmeyr bfd42c2b0a fix: dyn ts: uplink measurement report
Fix pchan value used for uplink measurement decisions for dynamic channels in
TCH mode.

Fixes this error log message flooding the osmo-bts log when a dyn ts is serving
a voice call:

  <0004> ../../../src/common/measurement.c:104 (bts=0,trx=0,ts=3,ss=0) no space for uplink measurement

Change-Id: Id19316701fd8de6f295eeae0272eea0c315ab1b7
2017-01-06 10:32:19 +00:00
Neels Hofmeyr 3b2e5de3ae dyn TS: measurement: use correct nr of subslots, rm code dup
In measurement.c, fix the number of sublots for TCH/F_TCH/H_PDCH, by using
ts_subslots() from gsm_data_shared.c. The local dup of subslots_per_pchan[] is
no longer needed. (depends on recent commit to openbsc.git for ts_sublots())

Change-Id: I9d9df470c49487bffd56dde42c7bec0da2f50642
2016-08-30 07:35:47 +00:00
Neels Hofmeyr 63849ebf71 dyn TS: measurement.c: replace fixme with comment
Change-Id: I04668f6f01a48157a98c6326a9ee48982a09ee62
2016-08-10 18:06:20 +02: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
Harald Welte b15d2c9d2f Initial CBCH support
This should handle OML channel combinations with CBCH and activate the
CBCH SAPI towards the DSP correspondingly.  What is still missing is
sending any actual information over the CBCH in respons to the
PH-RTS.ind coming up from L1.
2014-12-30 00:28:31 +01:00
Harald Welte 68b9b376cf make use of libosmocore 'gsm_meas_rep_unidir'
Back in March 2013, some structures and defines related to decoded
measurement reports have been moved from openbsc to libosmocore
(libosmocore e128f4663104ed64e33e362cff2566f36d65e658) so that they can
be used also from osmo-bts.  This finally follows up on that.

You need openbsc 7ff4f0e0fc692bfab829da50edb104e58b271e7e or later.
2014-08-25 09:22:00 +02:00
Holger Hans Peter Freyther 19e87d332f measurement: Speculative performance change
Most timeslots do not have eight lchan. Use the subslots_per_lchan
map to reduce the number of iterations. Looking at the ARM assembly
showed that no loop-unrolling was done so this could be a speed up.
2013-12-28 09:37:59 +01:00
Holger Hans Peter Freyther 9be5f8c9c0 measurement: Mark the internal functions as internal
In terms of assembly code this only removes the ".global FN" from
the code. GCC does not attempt to inline it right now.
2013-05-04 13:12:20 +02:00
Holger Hans Peter Freyther fb0c9f0613 measurement: Add debug helper when we have a report for an inactive channel 2013-03-24 09:05:04 +01:00
Andreas Eversberg 744f745d7a PCU: Add PCU socket interface to BTS.
A special command line option "-P" is used to enable socket interface
and signal available GPRS MO object to BSC.
2012-07-08 20:50:02 +02:00
Harald Welte b17a47e6e1 measurement: fix missing \n at end of log output 2011-07-02 22:44:27 +02:00
Harald Welte f15cef94f7 fix various compiler warnings 2011-07-01 18:22:01 +02:00
Harald Welte 062d96e38b measurements: avoid division by zero 2011-06-30 17:31:54 +02:00
Harald Welte 6818881d72 implement baseic uplink measurement processing + reporting
* gather measurements from each PH-DATA.ind
* check every TDMA frame about meas period expiration
* compute averages after period expired
* put MS DL MEAS REP into RSL MEAS RES messages, include UL meas

bugs:
* L3 INFO content seems to have some offset
* is_sub is not set anywhere
* measurement periods might have up/downlink offset
2011-06-29 10:36:07 +02:00