aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/measurement.c
AgeCommit message (Collapse)AuthorFilesLines
2018-10-10lchan_meas_check_compute: Log value during incorrect num of SUB ↵Pau Espin Pedrol1-1/+2
measurementes detected Change-Id: I5dacbed5517b2aa2a6bbc66ec125f0bdfd1f5b2b
2018-09-13measurement: fix unit-test test_lchan_meas_process_measurementPhilipp Maier1-2/+2
The unit test that tests lchan_meas_process_measurement() only inputs test data to lchan_meas_process_measurement() but it is not checked if the interval end could be detected or not. - Add a return code to lchan_meas_process_measurement() - Ensure that the return code is checked in the unit-test Change-Id: I9e00ce683e8c44528804f65181dbfed9e85e3aed Related: OS#2975
2018-09-13measurement: remove missed interval end detectionPhilipp Maier1-144/+2
The function is_meas_overdue() was introduced to allow lchan_meas_process_measurement() to detect when the end of a measurement interval has been missed. Interval ends may be missed when the SACCH block of the related measurement interval gets lost. This is due to the fact that the SACCH block is used as a trigger to start the measurement result computation. The idea behind is_meas_overdue() was to check the frame number of the current measurement against the frame number of the previous measurement in order to see if there was a measurement for SACCH in between or not. Unfortunately SACCH and TCH Voice data is not necessarly processed in order by each phy. Depending on the phy there may be a jitter between the timing of SACCH and TCH Voice. Depending on the phy this jitter may be enough to mess up the timing so that we see a SACCH block earlier than expected. So we can not use the current frame number of TCH Voice measurements to check for missed SACCH blocks. Change-Id: Idfdbf64c1f965f35c12559b3995e2b746c74ee9e Related: OS#3502 Related: OS#2975
2018-09-13cosmetic: fix typo in commentPhilipp Maier1-1/+1
Change-Id: I6a1147e2a3858475c99c99ceb33d7d416f3cac6c
2018-09-06measurement: display fn_mod when measuremnet is addedPhilipp Maier1-7/+32
When adding a new measurement also log the frame number by the modulus of the measurement interval to simplify debuggung Change-Id: I77a4d947dab32de0d5717ebf13bd8de6179dfe6a
2018-08-30measurement: substitue missing measurementsPhilipp Maier1-40/+226
At the moment the measurement calculation of osmo-bts works by collecting the measurement reports the phy emits during a measurement interval. Normally one would expect a well defind fixed number here, but some phys will not emit a measurement report for lost blocks. Also blocks and their reports may get lost because of cpu overload etc. The computation that is executed at the end of the measurement interval computes over all received measurement. This evenutally means that missing measurements will not taken into account and the result will look better than it is in reality. To fix this, the interval must be of a defined size and in cases where less measurements as expected were collected, the algorithm must assume they have been received with a 100%BER and take that into account. However, all RSSI and TA/TOA related computations should continue to rely on actual measurement data. - make sure the algorithm works over a fixed interval - replace missing measurements with 100%BER - fix and extend unit-tests Change-Id: Idd30fc07603ad7d042c1fb416e247c3bf7d35c8b Related: OS#2987
2018-08-29cosmetic: rename *_meas_rep_fn10* to *_meas_rep_fn10*_by_*sPhilipp Maier1-16/+16
The lookup table that control the measurement interval endings do not make clear what their indexes refer to. Lets give them more distinct names. rename sdcch8_meas_rep_fn102 to sdcch8_meas_rep_fn102_by_ss rename sdcch4_meas_rep_fn102 to sdcch4_meas_rep_fn102_by_ss rename tchf_meas_rep_fn104 to tchf_meas_rep_fn104_by_ts rename tchh0_meas_rep_fn104 to tchh0_meas_rep_fn104_by_ts rename tchh1_meas_rep_fn104 to tchh1_meas_rep_fn104_by_ts Change-Id: I3dc891e1860109f803c1bfa46445e8fef35586d9 Related: OS#2975
2018-08-29measurement: fix is_meas_overdue() and increase testcoveragePhilipp Maier1-7/+15
The tests TC_meas_res_sign_sdcch4 and TC_meas_res_sign_sdcch8 are failing mainly because lchan->ts->nr is confused with lchan->nr. There is also a small problem with one of the formulas that compute fn_missed_end. - Add explainatory comment to the lookup tables on what the index is refering to - use lchan-nr instead of lchan->ts->nr when dealing with SDCCH/4/8 - simplfy and fix the formula - increase the testcoverage of the unit tests, give SDCCH/4/8 also a thorough check. Change-Id: I5d555a21003943bf720c53f3a611029ba45339a9 Related: OS#2975
2018-08-29measurement: add unit tests for ts45008_83_is_sub()Philipp Maier1-2/+3
The function ts45008_83_is_sub() is an integral part of the measurement calculation as it automatically tags incoming measurements as SUB measurements. This is important in the context of DTX. Unfortunately there is no unit test for this function yet. - Add unit test for ts45008_83_is_sub() Change-Id: Ia26774859f4bf31baee075896905079368bddd42 Related: OS#3502
2018-08-29measurement: fix sub frame table for TCH/H, SS1Philipp Maier1-1/+1
The Table that lists the fn%104 frame number masks that define which of the incoming measurements to be recognized as SUB measurements contains one wrong number. For comparison see also: 3GPP TS 05.08, chapter 8.3 Aspects of discontinuous transmission (DTX) - Change 29 to 20 in ts45008_83_tch_hs1[] Change-Id: Id3698551d94866f418e662b9fe81429b16e2621c Related: OS#3502
2018-08-29measurement: add unit tests for is_meas_complete()Philipp Maier1-2/+4
We do not test is_meas_complete() individually yet, but it is an integral part of the measurement processings since this function decides where a measurement interval ends. - Add unit tests that test TCH/F, TCH/H, SDCCH/4 and STDCH/8 Change-Id: I8f89d9e7092cd65ba4d5c5649140692dcc20bdd6 Related: OS#2987
2018-08-22measurement: fix measurement interval end detectionPhilipp Maier1-3/+1
for SDDCH4 channels, the detection is not working correctly since the function uses the lookup table for SDCCH8 interval endings there. This needs to be corrected. Also there are two unnecessary assignments in the code which should be removed. - use correct table (sdcch4_meas_rep_fn102 instead of sdcch8_meas_rep_fn102. - remove unnecessary assignments to last_fn_mod Change-Id: If8a269ecd3f9fa4eeadf379114db816ef5c77d77 Related: OS#2975
2018-08-20measurement: make sure measurement interval end is detectedPhilipp Maier1-6/+150
the measurement interval end is detected by using the measurement indication that is related to the SACCH block as a trigger to start the computation. If the measurement indication for the SACCH gets lost because the block could not be received then the processing is not executed. This may cause wrong results or when it happens condecutively an overflow of the measurement sample buffer. - Store the frame number of the last received measurement indication - Use the stored frame number to check if an interval was crossed when the next measurement indication is received. If we detect that we missed the interval, catch up by running the computation and start the next interval. Change-Id: I3a86cd8185cc6b94258373fe929f0c2f1cf27cfa Related: OS#2975
2018-08-20measurement: make sure state is reset on chan act.Philipp Maier1-0/+8
At the moment only lchan_meas_reset is reset on channel activation. All other states are not reset. This may lead to irretations in the first measurement interval if there are still leftover messages from a previous connection. Lets ensure everything is reset to zero by zeroing out the whole .meas struct in struct lchan. - Add a centralized function that does the reset - Call that function from rsl_tx_chan_act_ack() in rsl.c Change-Id: I880ae3030df6dcd60c32b7144c3430528429bdea Related: OS#2975 Related: OS#2987
2018-08-17cosmetic: unify measurement sample handling in one functionPhilipp Maier1-0/+13
In l1sap.c we call lchan_new_ul_meas() and lchan_meas_check_compute() directly in sequence. Lets unify thos two steps inside measurement.c so that we only need to call one function from l1sap.c. Change-Id: If48bc7442dfaab8c36b93949f741de6e836e792a Related: OS#2975
2018-06-29Add min/max/std-dev measurement reporting for TOA256Harald Welte1-1/+62
This patch adds extended processing of the high-resolution TOA256 measurement values. It adds reporting of the following values for each RSL MEAS REP for uplink measurements: * minimum TOA256 value during reporting period * maximum TOA256 value during reporting period * standard deviation of TOA256 value during reporting period Change-Id: Iea4a4781481f77c6163d82dcd71a844a5be87bf2
2018-02-27measurement: Keep average of high-accurate ToA value in lchanHarald Welte1-0/+1
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-27measurement.c: higher-precision TA/TOA mathHarald Welte1-5/+5
Change-Id: I0dc8e78545465dfc5c93691a49b86b6b8b56b432
2018-02-26measurement.c: Don't silently copy "FULL" measurements to "SUB"Harald Welte1-2/+5
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-26measurement: Compute RX{LEV,QUAL}-SUB for SDCCH and non-AMR TCHHarald Welte1-3/+99
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-26measurement.c: Fix sdcch4_meas_rep_fn102 / sdcch8_meas_rep_fn102Harald Welte1-15/+14
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-23measurement.c: Hand Frame Number into measurement computationHarald Welte1-4/+4
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-23Revert "measurement: fix measurement computation"Harald Welte1-47/+0
This reverts commit d5fdcfe6d95f52fb76c4f4201969347a062fc9fd, 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
2017-12-02measurment.c: Introduce INFO category for DMEAS loggingHarald Welte1-2/+2
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-02measurement.c: Fix various typos in commentsHarald Welte1-8/+8
Change-Id: Ief208045664769406cd60a92a12c4b44988a98b4
2017-07-10measurement: fix measurment reportPhilipp Maier1-24/+65
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-06-26measurement: improve log outputPhilipp Maier1-4/+7
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-24measurement: Remove dead codeHarald Welte1-37/+0
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 2f028c4e2c29f63df9926435466aa35377947767 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-13measurement: Improve log outputPhilipp Maier1-10/+22
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-09cosmetic: remove unused variablePhilipp Maier1-1/+0
Tha variable ms_timing_offset in lchan_meas_check_compute is not used anymore. Change-Id: I40c393f6864fe72b88a70da265b7775da8fb469c
2017-06-09Revert "measurement: exclude idle channels from uplink measurement"Philipp Maier1-29/+24
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 e0fb3ae52d747b26b6487ec67c79eceaf37a125c. Change-Id: I8acab50cc1bb1cb133831c6a145f4d790e99176c
2017-06-09measurement: fix measurement computationPhilipp Maier1-0/+51
Timing advance is currently not taken into account when computing the measurement results, this commit fixes that Change-Id: I2e0dfd13b53e8aa2822985f12bf2985e683ab553
2017-05-24measurement: exclude idle channels from uplink measurementPhilipp Maier1-24/+29
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-17measurement: make lchan_meas_check_compute() available to l1sap.cPhilipp Maier1-1/+1
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-17measurement: fix measurement reporting periodPhilipp Maier1-3/+35
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-17measurement/cosmetic: Fixup source code commentPhilipp Maier1-1/+15
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-17measurement/cosmetic: Fixup source code commentPhilipp Maier1-1/+14
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-01-06fix: dyn ts: uplink measurement reportNeels Hofmeyr1-1/+1
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
2016-08-30dyn TS: measurement: use correct nr of subslots, rm code dupNeels Hofmeyr1-15/+1
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-10dyn TS: measurement.c: replace fixme with commentNeels Hofmeyr1-1/+1
Change-Id: I04668f6f01a48157a98c6326a9ee48982a09ee62
2016-05-31Use libosmocore function for uplink measurementsMax1-11/+0
Related: OS#1563 Change-Id: Ide47e8e69e0d2d5859c5249b22f4bad22c18aa57 Reviewed-on: https://gerrit.osmocom.org/108 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>
2014-12-30Initial CBCH supportHarald Welte1-0/+4
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-08-25make use of libosmocore 'gsm_meas_rep_unidir'Harald Welte1-8/+10
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.
2013-12-28measurement: Speculative performance changeHolger Hans Peter Freyther1-1/+14
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-05-04measurement: Mark the internal functions as internalHolger Hans Peter Freyther1-2/+2
In terms of assembly code this only removes the ".global FN" from the code. GCC does not attempt to inline it right now.
2013-03-24measurement: Add debug helper when we have a report for an inactive channelHolger Hans Peter Freyther1-0/+5
2012-07-08PCU: Add PCU socket interface to BTS.Andreas Eversberg1-0/+1
A special command line option "-P" is used to enable socket interface and signal available GPRS MO object to BSC.
2011-07-02measurement: fix missing \n at end of log outputHarald Welte1-1/+1
2011-07-01fix various compiler warningsHarald Welte1-1/+1
2011-06-30measurements: avoid division by zeroHarald Welte1-2/+5