Commit Graph

663 Commits

Author SHA1 Message Date
Vadim Yanitskiy b9f3e14ba6 common/rsl.c: tweak log message in lapdm_rll_tx_cb()
During the investigation of OS#3559, it was discovered that the
log message, which warns that an RSL message was dropped due to
inactive logical channel, has incorrect log level - LOGL_INFO.

This is not informative kind of message, so let's increase the
log level, and additionally let's print the hexdump of message
and it's length.

Change-Id: I26eac5e4466c493ffe08dbb89de20f5e1c2bb85d
2018-09-19 13:15:19 +07:00
Harald Welte 9ce4d91948 CBCH: Some more scheduler_mframe cleanup
As the CBCH replaces SDCCH sub-slot-2 in downlink, we should mark
the uplink as IDLE, just as the associated SACCH in uplink and downlink.

Also, there are no burst_numbers in IDLE slots.

Change-Id: Ib8565d1d0080bfce5d2aec77609709a445a2171c
2018-09-17 22:47:45 +02:00
Harald Welte 6434ba9f90 CBCH: sprinkle some OMSO_ASSERT() and guard against talloc failure
Change-Id: I85fdecbf20de83a6f925765a46b5cd14765da03e
2018-09-17 21:36:59 +02:00
Harald Welte c799c70c59 CBCH: Add FIXME comments on queue overflow/underflow handling
Change-Id: Ida97f25ab4bf7e4d0f03b13396cb37cdfe99ef40
2018-09-17 21:36:59 +02:00
Harald Welte 3c87f5c3ea get_lchan_by_chan_nr(): Fix resolution of CBCH
The CBCH (as per GSM specs) always maps on sub-slot 2 of either
the SDCCH/4 or SDCCH/8 that it replaces.  However, the way how we
express it as RSL-style channel number (0xC8) doesn't allow room
for any sub-slots.  The top 5 bits are used for expressing CBCH, while
the bottom 3 bits are used for the timeslot number (TN).

So when transforming from channel number to lchan, we must handle the
CBCH case specially by using a hard-coded sub-slot number of 2.

Change-Id: I44e2f763d5d25311167f435f2ca7e030b2a3f009
Related: OS#1617
2018-09-17 21:36:59 +02:00
Harald Welte 7c82b4a872 l1sap/scheduler: Consistently print chan_nr as hex number
It's very confusing if some log messages log chan_nr as decimal, while
most log it as hexadecimal.  Let's standardize on hex everywhere.

Change-Id: Ia6566d5bbee8124fb7c689c962ce34d714208503
2018-09-17 20:53:37 +02:00
Philipp Maier 27a86005f3 measurement: fix unit-test test_lchan_meas_process_measurement
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-13 14:27:12 +00:00
Philipp Maier c78759055a measurement: remove missed interval end detection
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-13 14:27:12 +00:00
Philipp Maier 6d701d0e05 cosmetic: fix typo in comment
Change-Id: I6a1147e2a3858475c99c99ceb33d7d416f3cac6c
2018-09-13 14:27:12 +00:00
Keith Whyte 17577b7c00 fix handling of odd pchans in bts_supports_cm()
Convert the if-cascade to a switch().

For any unexpected pchan kind, reject the chan mode immediately instead of
going on to invoke gsm_bts_has_feature on feature = _NUM_BTS_FEAT, and log the
error.

Tweaked-by: neels
Change-Id: Ieaded9258554b15fcc4b7f05d5a8847175b7962f
2018-09-11 00:28:10 +02:00
Keith Whyte 734eb40e72 log: add error log for RSL Chan Mode Modif
Add log context to chan_mode error in rsl_rx_mode_modif().

Tweaked-by: neels
Change-Id: I945cf1ca8660ad5daf097edab1833bbc74b6185f
2018-09-11 00:28:10 +02:00
Neels Hofmeyr cb01259804 fix RSL Chan Mode Modif for dyn TS
Fix the chan mode checking for RSL Chan Mode Modif: do not reject
all modes on dyn TS.

In rsl_rx_mode_modif(), bts_supports_cm() should never
be fed with dynamic pchan kinds (e.g. GSM_PCHAN_TCH_F_TCH_H_PDCH).
Feed instead the return value of ts_pchan() that is to say,
the actual pchan type (e.g. GSM_PCHAN_TCH_F).

Change-Id: I7f0c835b25289931bccf96e982ea5564c8be4192
2018-09-11 00:28:04 +02:00
Harald Welte 386c33fa84 CBCH: Use llist_first_entry_or_null() instead of reinventing it
Change-Id: I376111e71d1c7be35a8fd7e392488adc34e21941
2018-09-09 15:40:58 +00:00
Harald Welte d9a1cd994c CBCH: Implement CBCH support for osmo-bts-{trx,virtual}
This patch adds scheduler support for the channel combinations that
substitute SDCCH index 2 for a CBCH in either a SDCCH/8 or SDCCH/4.

Change-Id: Icc15603079a1709ec094f400a9bcf0008211890f
Closes: OS#1617
2018-09-09 15:40:58 +00:00
Harald Welte 02d99db08b CBCH: Move processing via L1SAP
for some historical reason, CBCH handling was not using the normal
L1SAP boundary.  Let's change that and traverse L1SAP just like for
e.g. BCCH which is quite similar to CBCH handling.

This also has the added benefit of logging CBCH via GSMTAP.

Change-Id: Ibdba4c5e808330f8406f441a97fe0e81170fce97
Closes: OS#3534
2018-09-09 15:40:58 +00:00
Harald Welte dcde6145bf CBCH: Fix rejecting SMS-CB related RSL messages
Normally, the "Common Channel" related RSL messages should actually
contain such a common channel.  However, since cell broadcast is
implemented inside what's essentially a downlink SDCCH, we should add
some explicit exceptions.

Before this patch, any RSL SMS BC CMD would have been discarded and
an RSL Error Indiciation returned.

Change-Id: I2f7f1dd43505cc27cd33489d8b0e8c981cd93880
Closes: OS#3533
2018-09-09 15:40:58 +00:00
Philipp Maier 0b6c1762c5 measurement: display fn_mod when measuremnet is added
When adding a new measurement also log the frame number by the modulus
of the measurement interval to simplify debuggung

Change-Id: I77a4d947dab32de0d5717ebf13bd8de6179dfe6a
2018-09-06 12:33:03 +02:00
Philipp Maier bd3462f355 paging: add unit-test to check different bs_ag_blks_res settings
The parameter bs_ag_blks_res, which is loaded into the BTS via the SI3
setting, defines how many of the CCCH blocks shall be used for AGCH. The
remaining CCCH blocks will then be available as PCH for paging.
Unfortunately there is no unit-test yet that verifies that all of the 8
different settings for bs_ag_blks_res.

- Separate the the decision logic that checks if a given fn is part of
  an AGCH into a function to have it available in the unit-test.
- Add a test that checks all possible bs_ag_blks_res settings.

Change-Id: Ib9652f4013a4da3766852f8f03ce9ec5590f6989
Related: OS#1575
2018-08-31 12:44:31 +00:00
Philipp Maier 9680a4746f measurement: substitue missing measurements
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-30 09:12:59 +02:00
Philipp Maier 42495a156d cosmetic: rename *_meas_rep_fn10* to *_meas_rep_fn10*_by_*s
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-29 17:04:59 +00:00
Philipp Maier 324a3cd66e measurement: fix is_meas_overdue() and increase testcoverage
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-29 17:04:59 +00:00
Philipp Maier 9b41b36e97 measurement: add unit tests for ts45008_83_is_sub()
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-29 17:34:49 +02:00
Philipp Maier 76c292ea5d measurement: fix sub frame table for TCH/H, SS1
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-29 17:34:41 +02:00
Philipp Maier 510158256b measurement: add unit tests for is_meas_complete()
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-29 07:35:57 +00:00
Neels Hofmeyr 08062e6dcc cosmetic: abis.c: typo "exixt"
Change-Id: I678ae63626f05a5bb6d890ff37a09e09739bc104
2018-08-24 18:33:13 +02:00
Stefan Sperling 0b2893f6fc Revert "send TCH/F fill frames in DTX mode (WIP)"
This reverts commit 9bffa87c11.

This commit was not intended to be merged yet.

Change-Id: Ibd8c0899451ae3c17bc07d4e112e32b4897405c9
2018-08-23 13:29:09 +02:00
Philipp Maier 092e4e85b3 measurement: fix measurement interval end detection
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-22 19:52:14 +00:00
Stefan Sperling 9bffa87c11 send TCH/F fill frames in DTX mode (WIP)
Send DTX TCH fill frames according to GSM 05.08, section 8.3.

Change-Id: I7bff00b8cf41dc1b0e6e668173bebce23be0d253
Related: OS#1950
2018-08-22 19:50:33 +00:00
Stefan Sperling 0ab50934d5 fix conditions for sending fill frames during RTS IND
Rewrite an if-statement to better match the description given
in GSM 05.08, and quote the relevant paragraph in a comment.
Since this entire block of code only runs for SDCCH and TCH,
this new condition should provide the same result expect that
in accordance with the standard we now stop sending fill-frames
on a signalling TCH if DTX is in use.

Also note that this code should already cover parts of the
patch proposed at https://gerrit.osmocom.org/c/osmo-bts/+/5753
The changes to osmo-bts-litecell15/l1_if.c proposed there
should be equivalent to the fill-frame logic in this
existing common BTS code which is handling RTS IND.

Change-Id: Ibaf3ecbd0bde4f37e799d5e2f5d00dc695e0139a
Related: OS#1950
2018-08-22 19:50:33 +00:00
Philipp Maier 4553890d70 measurement: make sure measurement interval end is detected
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-20 18:27:28 +02:00
Philipp Maier 9feddb7edf measurement: make sure state is reset on chan act.
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-20 12:19:30 +02:00
Philipp Maier b5a28bd967 cosmetic: unify measurement sample handling in one function
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-08-17 16:24:26 +00:00
Vadim Yanitskiy 5d17b97a5b Clarify frame loss counter for l1sched_chan_state
Each logical channel (e.g. SACCH, SDCCH, etc.) has a counter of
lost L2 frames. Let's use a bit better name for it, and correct
its description in the 'l1sched_chan_state' struct definition.

Change-Id: I92ef95f6b3f647170cfd434a970701406b0a7c82
2018-08-01 02:35:07 +07:00
Stefan Sperling 6575f0c3e9 preserve lchan-specific SI overrides on SACCH FILL
During SACCH FILL processing, update lchan SI values only
for lchans which follow BTS-global default values, keeping
lchan-specific overrides in place.

Change-Id: I515bbd9983fa894507386b241863a9aa4d279497
Fixes: eee7247ebe
Related: OS#3173
2018-07-25 12:57:22 +02:00
Stefan Sperling eee7247ebe update sysinfo copies in all lchans upon SACCH FILL
When a SACCH FILL is received, loop over all lchans and update
their copies of system information data.

This change makes BTS_Tests.TC_sacch_multi_chg pass.

Change-Id: I3e63eeb5fcf320fb029de16e4d327e153cc34567
Related: OS#3173
2018-07-24 19:24:37 +02:00
Pau Espin 20278252b5 scheduler: Log error on fn jump
Change-Id: I28f01e3f7fff6f1fb52a3c593a837f4f924bb2d9
2018-07-20 16:41:15 +02:00
Pau Espin e04e4d423d sched: Log RX->RTP packet like we do in add_l1sap_header
Other backends use already msgb in lower layers and eventually call
add_l1sap_header to push TCH data up the stack.
backends using common/scheduler.c (bts-trx, bts-virt) are the only ones
not yet using msgb in lower layer but only creating the msgb
immediatelly before sending it in _sched_compose_tch_ind. Let's add a
log message there too to have similar output in all BTS backends.

Change-Id: Ia90b051f308abcd8b88b84e861da593844b0d81a
2018-07-20 16:41:15 +02:00
Pau Espin 319b1d5bd7 l1sap: add_l1sap_header: Compact msgb_push ret assignment
Change-Id: Ia427c216cd096d313b234ca244eb71837450e2a9
2018-07-19 16:02:09 +02:00
Pau Espin a9a35419ed rsl: Use value_string to print encryption algo name
Change-Id: I8303364270e73718e57f8efc2f375817b9496ffc
2018-07-06 17:23:54 +02:00
Harald Welte b7b5c4219c Add min/max/std-dev measurement reporting for TOA256
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-06-29 17:53:20 +00:00
Stefan Sperling 0257f52835 log reception of PCU_IF_MSG_PAG_REQ messages from osmo-pcu
osmo-pcu currently sends paging requests in PCU_IF_MSG_DATA_REQ
messages, rather than PCU_IF_MSG_PAG_REQ. Clarify a comment which
already alluded to this, and leave an explicit log entry if a
PCU_IF_MSG_PAG_REQ message is received.

Change-Id: I75fd8f051f943d876b5614fa088fff7e56b310ab
Related: OS#3018
2018-06-25 11:04:37 +02:00
Pau Espin 31b113774b pcu_sock: Log event pcu_sock created
Change-Id: I2aa55e05ac481fee59af5bad87baf707831df088
2018-06-14 17:54:54 +02:00
Pau Espin db330522ea Send DELETE_IND when dropping Imm Assign pending message
This way we give the opportunity to the BSC to release the channel
quicker, otherwise it has to wait until T3101 expires.

Same procedure is already done in rsl.c rsl_rx_imm_ass() when we return
an error (hard limit AGCH queue len reached) from bts_agch_enqueue().

Related: OS#2990
Change-Id: Id9927c0789054ce3ecc7b30380585a1ffe05db5a
2018-06-09 12:02:29 +00:00
Pau Espin 868c67fed3 compact AGCH queue: Drop too msg diff than IMM_ASS_REJ
We saw in a recent prod setup a BSC with saturated channels. Further
investigation lead to a AGCH queue of 1000 (previous hard_limit)
messages, most of them being regular IMM ASSIGN (non REJ). Hence, we
also want to get rid of other messages in the AGCH queue (like regular
IMM ASSIGN).

Furthermore, In this scenario, sending IMM ASS REJ is as important as other
messages given than nowadays we support dynamic wait indicatior
(calculated based on chan load), which means if we reach the MS, we can
tell it to wait for a long time to reach us again, which is desirable.

Change-Id: I022b8948da8be13fb8f4bc36e7c9dab11c35fddb
2018-06-08 17:03:06 +02:00
Pau Espin a1a2556c2a bts_agch_enqueue: Decrease queue len hard_limit from 1000 to 100
In a prod setup, complete channel saturation at the bsc was detected,
and Immediate Assignments were not being answered by the MS once sent by
the BTS.
Further investigation showed that the BTS was all the time printing
messages like this:
"bts.c:540 AGCH: too many messages in queue, refusing message type 0x3f, length = 1001/10"

So it seems the AGCH queue was becoming incredibly full (1000, hard
limit triggered the log), while acgch_queue.max_length was set to 10.

As a result, most probably the Immediate Assignments being sent to the
MS are super old in time, and the MS doesn't known about them anymore
once they are receivied, so no answer is sent back.

Let's try to avoid that by decreasing the hard limit so we never reach
that big queue_len scenario.

The number 100 is selected from data gatherered in agch_test.c which
prints a table of max_length values based on different setups. Some
values can reach around 80 messages, so let's use a slightly bigger hard
limit.

Related: SYS#2695
Change-Id: I272798c959abec123776d2fa8dad5685ec512fbd
2018-06-08 17:00:53 +02:00
Pau Espin ef1356c06c bts.c: Add missing include for gsm48_rr_msg_name
It seems I somehow mischecked that the required include for gsm48_rr_msg_name
was not yet present in the file.

Fixes: 44a35902ad
Change-Id: Ia82bc6a5ff7e3989cf0b85ee689d0c3344720eda
2018-06-08 16:28:17 +02:00
Pau Espin 44a35902ad bts.c: Log name of RR msg type instead of value
Change-Id: Ia35e132e0b6532dfbf09bb33fe9328a9e3e16885
2018-06-06 19:46:25 +02:00
Philipp Maier f1e2d08022 rtp: make port range configurable, assign correct port numbers
The current implementation does not allow the user to specify a port
range in which the BTS is allowed to allocate a local RTP port. Also
the ports the BTS picks do not match the policy described in RFC3550.
An RTP Port must be at an even port number and the matching RTCP
port must be at the following (odd) port number. The BTS currently
picks random port numbers for both.

- Add a VTY command to specify a port range in which the BTS may
  assign local ports.

- Pick ports as described in RFC3550.

Change-Id: Id75f1dfaf898ed8750d28b1c4840e188f4cfdc87
Related: OS#2825 OS#2635
2018-05-25 15:41:35 +02:00
Harald Welte ae3da5f8c3 cosmetic: it's n_r in check_for_first_ciphrd(), not n_s
When we introduced the n_s verification in
2cc37035d7, the variable name n_s was
used for what is actually n_r N(R) read from the LAPDm frame

Change-Id: Iaef1648f35ceae9d7f4cd1d9d5409e05115d199a
2018-05-24 06:08:44 +00:00
Stefan Sperling 5a0f85d00b let osmo-bts log a special notice if OML connection is closed early
A frequent configuration file error is that the unit_id settings of
osmo-bts and osmo-bsc don't match. The BSC already prints an error
in this case. Let the BTS print an error as well.

We use a heuristic for this purpose: If the OML link is dropped within
10 seconds after being established, log a special warning which alerts
the user and recommend a manual configuration file check.

Change-Id: I476ac797458b5a46edea3ae9cfbd491fd7f77f47
Related: OS#3143
2018-05-15 20:58:06 +00:00