Commit Graph

2942 Commits

Author SHA1 Message Date
Vadim Yanitskiy 284f16e7d7 measurement: fix matching of SUB frames by TDMA FN
3GPP TS 45.008, section 8.3 defines active TDMA frame subsets for
TCH channels, which shall always be transmitted even during the
silence periods in DTX mode of operation.  Each frame number
listed in this section corresponds to a single burst.

The Uplink measurements always contain TDMA FN of the *first* burst
of a block, so it does not make sense to match the given FN against
all FNs in the respective subset.  Instead, we should match only
specific FNs in accordance with the block mapping rules defined in
3GPP TS 45.002, section 7, table 1.

In the active subset for TCH/F there is only one *complete* block
starting at FN=52.  Incomplete blocks {52, 53, 54, 55} and {56, 57,
58, 59} contain only 50% of the useful bits (partial SID) and thus
~50% BER, so we don't treat them as SUB.

In the active subsets for TCH/H there are two *complete* blocks
for each sub-slot.  Their respective first FNs can be efficiently
defined in a lookup table (see ts45008_dtx_tchh_fn_map[]).  Note
that we can use a single lookup table for both sub-slots of TCH/H
because their TDMA FNs do not overlap.

This patch fixes unexpected SUB-RxQual values > 0 on TCH channels
with DTXu enabled and other than AMR (HR, FR, EFR) codec in use.

Change-Id: I8cc3a755a8ad4dc564439aab2298c1e97ac0592d
Related: SYS#5853
2022-05-10 16:49:16 +03:00
Vadim Yanitskiy 991f3f64d9 measurement: move SACCH detection to process_l1sap_meas_data()
SACCH detection can be simplified by checking the RSL Link ID in
process_l1sap_meas_data().  This eliminates the need to lookup
the multiframe position by calling trx_sched_is_sacch_fn(), which
definitely takes more CPU time than just L1SAP_IS_LINK_SACCH().

Calling trx_sched_is_sacch_fn() is still required for BTS models
reporting the measurements via PRIM_MPH_INFO (legacy way),
separately from the related Uplink blocks.

This patch can be summarized as follows:

* detect SACCH and set .is_sub=1 in process_l1sap_meas_data();
** for PRIM_MPH_INFO use trx_sched_is_sacch_fn();
** for PRIM_PH_DATA use L1SAP_IS_LINK_SACCH();
* do not call trx_sched_is_sacch_fn() from ts45008_83_is_sub();
* modify the unit test - test_ts45008_83_is_sub_single();
** remove test_ts45008_83_is_sub_is_sacch().

Change-Id: I507e96ee34ac0f8b7a2a6f16a8c7f92bc467df60
Related: SYS#5853
2022-05-10 16:30:39 +03:00
Vadim Yanitskiy 0ad31d8956 measurement: log SUB/FULL as text in lchan_new_ul_meas()
Change-Id: Idfaf8ad2ac0fd4da57a0981563e6ad6104fa4e41
Related: SYS#5853
2022-05-10 01:19:18 +03:00
Vadim Yanitskiy 7bf970ede4 tests/meas: improve test_ts45008_83_is_sub_is_sub()
This function should also take lchan type into account.

Change-Id: I6920a04e0a6c846647fa1b6b3a3c80bbd6617b99
Related: SYS#5853
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy d399f49261 tests/meas: improve logging in test_ts45008_83_is_sub_single()
* Print unexpected TDMA FNs, each on a separate new line.
* Do not abort() on mismatch, keep running.

Change-Id: I32c104b139f32a39c8347de19de6ad7caec811de
Related: SYS#5853
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy 523b6de593 struct bts_ul_meas: reflect C/I units in field name s/c_i/ci_cb/
Change-Id: If07f7f2a3ea996cbfc6a9087fa34402e38a7fd9f
Related: SYS#5853
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy cf09b0cb50 scheduler: trx_sched_is_sacch_fn(): make ts pointer const
Change-Id: I48a1a549d7c1553bccaa01cdc818873a4c6cdf0a
2022-05-10 01:19:17 +03:00
Vadim Yanitskiy 8aab8d484b osmo-bts-trx: drop Uplink loss detection from Downlink path
Attempting to detect missing Uplink frames in the *Downlink* path
is an ugly hack, that was needed before we had proper per-lchan
detection of missing bursts and NOPE indications in TRXDv1.

* [1] per-lchan detection of missing bursts was fixed in Aug 2018.
* [2] TRXDv1 support was introduced in Jul 2019.

Today is 2022 and it makes no sense to keep this hack.  Even if
the transceiver does not support TRXDv1, per-lchan detection
will compensate the missing Uplink bursts.

Change-Id: Ic292d180ba64206fb4d88adb284f9f9d058b4587
Related: [1] I70d05b67a35ddcbdd1b6394dbd7198404a440e76
Related: [2] If61c71d20d590bf07bfd019afb33000a0b6135bd
2022-05-06 12:55:18 +00:00
Vadim Yanitskiy 4cbc2acde8 pcu_sock: comment out {dl,ul}_tbf_ext related warnings
The gitlog shows that these warnings were added in
744f745d7a by jolly (in 2012!).

As nobody has bothered for the past ten years, degrade them to comments.

Change-Id: Iebf9961cffbd7aa20b263f7dc0016a44782dec60
Related: osmo-bsc.git I9ef7e18f56aa86b48f0ffeec58406260736170f3
2022-04-29 13:32:04 +03:00
Vadim Yanitskiy e178269890 osmo-bts-trx: rx_{tchh,tchf}_fn(): improve logging of AMR DTX frames
Change-Id: I0ec06113fff2a89d7810cd4d8c26d6e0c74f93bd
Related: SYS#5853
2022-04-29 08:02:30 +00:00
Oliver Smith d99e20f97a src/common/bts.c: set BTS_FEAT_CCN
OsmoBSC assumed since If91d85331d402c3ab9c32b70c2c66cd7ba6ceb28 that
OsmoBTS has CCN (NACC, Network Assisted Cell Change). With OsmoBSC
Idf2d933aa8b03b1f708e56a08707fe6c620a97aa, instead of hardcoding some
features for OsmoBTS in OsmoBSC, only the features reported by the
BTS are used. Therefore report that BTS_FEATURE_CCN is supported in
OsmoBTS.

For previous OsmoBSC versions, this fixes the message:
  Get Attributes Response: reported feature 'CCN' is not supported, while we thought it is.

Related: SYS#5922, OS#5538
Change-Id: Ic407e3be82afe61ed64b1cecf3dc94d2caff380a
2022-04-26 15:15:05 +02:00
Oliver Smith 162ca199e0 src/common/bts.c: set BTS_FEAT_PAGING_COORDINATION
I did not realize with my previous patch that there's a common place
where features available for all backends should be enabled. So move it
there.

Related: SYS#5922, OS#5538
Change-Id: Id688ddae5cd714355fcc5324f33c9397fecae261
2022-04-25 11:27:54 +02:00
Oliver Smith 8630f898b2 model_init: order features alphabetically, part 2
Order the ones I've overlooked as well.

Related: SYS#5922, OS#5538
Change-Id: I0aa344de9ea4849de0fcd7b44bfaa70274af594b
2022-04-25 11:14:30 +02:00
Oliver Smith 0f075a1e2d model_init: set BTS_FEAT_PAGINATION_COORDINATION
According to osmo-bsc I0e80ca5afc06737273b6699bde6e325e454b57f6, the
PAGING_COORDINATION feature should be well supported in osmo-bts. Adjust
the bts_model_init functions to report this to the BSC, so it properly
sets this in SI13 and so we can avoid this notice in the log:
  Get Attributes Response: reported feature 'PAGING_COORDINATION' is not supported, while we thought it is.

Related: SYS#5922, OS#5538
Change-Id: Ib06829501f4221a7f7b0344ec7991ceba74e7641
2022-04-21 17:36:53 +02:00
Oliver Smith 7d2193b467 model_init: order features alphabetically
Make it easier to compare the lists of features.

Related: SYS#5922, OS#5538
Change-Id: I67887d89912d963fbbe90590c8467cbbd2566e09
2022-04-21 17:36:46 +02:00
Vadim Yanitskiy 11fb108221 osmo-bts-trx: check if scheduling of [dummy] FACCH/H is allowed
Currently (without this patch) if tch_dl_dequeue() yields nothing we're
scheduling dummy FACCH/H *regardless* if it's permitted to start at the
given TDMA FN or not.  This may result in misaligned FACCH transmission,
so the MS will not able to decode anything and will report BER>0.

With this patch applied we schedule FACCH/H if it's allowed to start
at the current TDMA FN;  otherwise send half-filled bursts with even
numbered bits contaning 232 encoded bits of the previous L2 frame
and 232 odd numbered bits all set to 0.

This patch does not guard against sporadic gaps in the Downlink TCH
queue.  However when tch_dl_dequeue() constantly yields nothing, e.g.
when we end up with a codec mismatch, then this additional check saves
us from starting misaligned FACCH/H transmission.  If we start at a wrong
TDMA offset, then all subsequent FACCH frames will be scheduled at wrong
offsets and thus none of them will be decoded by the MS.

Change-Id: I6f8af140a6ccf3d5fd7b98f6cb5c18e2c5e2f61b
Related: SYS#5919, OS#4823
2022-04-21 06:23:48 +00:00
Vadim Yanitskiy 0fb9517fed VTY: fix NULL-pointer dereference in 'show transceiver'
Change-Id: I403a027f064a4898eb74a11381bab3c884ec8ccf
2022-04-21 00:23:05 +03:00
Vadim Yanitskiy 1422a80cae osmo-bts-trx: fix scheduling of dummy FACCH/H and FACCH/F
* dl_ongoing_facch must be set for correct FACCH/H scheduling;
* dl_facch_bursts must be set for FACCH overpower to work.

Change-Id: Ief12eb67ad80de3b71f5226858dc2e0c8ae76948
Related: SYS#5919, OS#4823
2022-04-20 19:51:25 +00:00
Vadim Yanitskiy 5a9eaf7088 osmo-bts-trx: tx_tchh_fn(): make handling of FACCH/H cleaner
If set, chan_state->dl_ongoing_facch indicates that we're sending
the 2 (out of 6) middle bursts of FACCH/H.  In this case there is
no room for encoding an additional frame, because both even and
odd numbered bits are occupied by a previously encoded FACCH/H.

Right after calling tch_dl_dequeue():

* do not check the dequeued message against NULL,
* do not compare the message length to GSM_MACBLOCK_LEN,
* immediately free() it and jump to the sending part.

Change-Id: Ib923b8f5cc1063e9fc18acd2bdd003fd09f4b70f
Related: SYS#5919, OS#4823
2022-04-20 19:51:25 +00:00
Vadim Yanitskiy fbbc019f7d osmo-bts-trx: prioritize FACCH in s/tx_tch_common()/tch_dl_dequeue()/s
Unlike SACCH, FACCH has no dedicated slots on the multiframe layout.
It's multiplexed together with TCH (speech or data) frames basically
by replacing (stealing) them.  This is common for both TCH/F and
TCH/H, with the only difference that FACCH/H steals two TCH frames
(not just one) due to a longer interleaving period.

Let's implement the multiplexing in the common function, which is
used to dequeue to be transmitted frames - this slightly reduces
code duplication.  Use a new name, so that it's clear what it does.

Change-Id: I9822b1a17185d5487f0f6d3ed0203e806c053d7d
Related: SYS#5919, OS#4823
2022-04-20 19:51:25 +00:00
Pau Espin 0f3d7ea35b bts-trx: sched_lchan_tchh.c: Workaround gcc false positive error
Manual analysis of code didn't end up in finding any issue, so this
seems a false positive (I can really understand gcc failing to do proper
job here, this function has way to many jumps here and there.

"""
/sched_lchan_tchh.c:88:13: error: ‘rc’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   88 |         int rc, amr = 0;
      |             ^~
"""

Change-Id: Ifebaee63a9dad04976ffb4438c32360687ef095a
2022-04-20 16:09:31 +02:00
Vadim Yanitskiy 8b83a4a70f osmo-bts-trx: amr_loop: do not miss C/I samples
Keep collecting C/I samples even if the MS has not yet applied
previously requested codec mode.  The C/I ratio is expected to
stay more or less the same, no matter which codec mode is used.

Change-Id: Ieb5473ead7200f652b5d0e339e4e252d6567482d
Related: SYS#5917, OS#4984
2022-04-20 15:39:30 +03:00
Vadim Yanitskiy b1d5b8639c osmo-bts-trx: amr_loop: log if AMR mode remains unchanged
Change-Id: I0272d11cfaad0e1c13d2858b3bc61d6527898018
Related: SYS#5917, OS#4984
2022-04-20 15:18:32 +03:00
Vadim Yanitskiy 64192c26e6 osmo-bts-trx: amr_loop: allow upgrading codec mode > 0
With the current implementation the AMR loop is unable to upgrade
the current codec mode unless it reaches the worst possible value.
The problem is in the 'else' statement connection both 'if's.

Change-Id: I4c0fb28813373c3d4addd28c66f5136d2c4f9ed8
Related: SYS#5917, OS#4984
2022-04-20 15:18:32 +03:00
Vadim Yanitskiy 95f2201148 osmo-bts-trx: amr_loop: improve logging in trx_loop_amr_input()
Currently we're logging AMR mode *indexes*, not the actual modes.
Let's make it cleaner for the user by logging both mode and index.

Change-Id: I4feb3a3823799a290a50a48275e45f3331874d1a
Related: SYS#5917, OS#4984
2022-04-20 12:18:08 +00:00
Vadim Yanitskiy 44cb0113cf osmo-bts-trx: use C/I in the AMR link adaptation loop
Change-Id: Ide84bf864f56020c0265cfb9731615d4f7bad7f5
Related: SYS#5917, OS#4984
2022-04-20 12:18:08 +00:00
Vadim Yanitskiy cfabf6275e osmo-bts-trx: amr_loop: simplify trx_loop_amr_set()
Change-Id: Ibeed00ef48450edfe1e0d4e179fb4c777b11beb9
Related: SYS#5917, OS#4984
2022-04-20 12:18:08 +00:00
Vadim Yanitskiy 5c95312487 common: fix coding style: if is not a function
Change-Id: I890d7734c83d108d3c2cd2c7699ace880f13ca8b
2022-04-19 04:04:36 +03:00
Vadim Yanitskiy fe21e88630 struct amr_multirate_conf: remove ms_mode[], raname bts_mode[]
Looks like this structure was copied from openbsc/osmo-bsc as-is.
The ms_mode[] makes no sense in the context of BTS, so remove it
and rename bts_mode[] to mode[] for the sake of brevity.

Change-Id: I7442360ed857554440a0b9854f2d2bbab9dc5a71
Related: SYS#5917, OS#4984
2022-04-17 13:14:59 +00:00
Vadim Yanitskiy c350b9a9f6 tests: use 'check_PROGRAMS' instead of 'noinst_PROGRAMS'
When using 'check_PROGRAMS', autoconf/automake generates smarter
Makefiles, so that the test programs are not being compiled during
the normal 'make all', but only during 'make check'.

Change-Id: I18ebb7395024a490da743c0bcb20959e6e9c7017
2022-04-15 01:01:16 +03:00
Vadim Yanitskiy 56585bb351 amr: fix parsing of threshold and hysteresis in amr_parse_mr_conf()
Change-Id: I8febb60b0ad91903c7869871f41d1c123dbe5ce3
Related: SYS#5917, OS#4984
2022-04-13 18:04:20 +03:00
Vadim Yanitskiy 4765a5d195 tests/amr: add a unit test for amr_parse_mr_conf()
This unit test demonstrates a problem in amr_parse_mr_conf(): the
threshold and hysteresis values are parsed incorrectly.  They are
expected to match what we have in amr_fr_bts_mode_def[]:

  Mode[0] = 0/13/4
  Mode[1] = 2/25/4
  Mode[2] = 5/37/4

This will be fixed in a follow-up patch.

Change-Id: Iab7e8878e62f598959e80fcb7e729b7f496962a2
Related: SYS#5917, OS#4984
2022-04-13 18:04:20 +03:00
Vadim Yanitskiy f576e673a3 tests/amr/Makefile.am: use proper binary name prefix 'amr_test_'
Both misc_test_{SOURCES,LDADD} were simply ignored because
binary 'misc_test' is not listed in noinst_PROGRAMS...

Change-Id: Ia1739bab76261ff6d50824462b8ed2e0b34fb464
Related: SYS#5917, OS#4984
2022-04-13 18:04:20 +03:00
Vadim Yanitskiy cf3d314501 rsl: use hard-coded defaults if the MultiRate conf IE is absent
This configuration will be used as a fall-back when the MultiRate
configuration IE is not included in the CHAN ACT/MODIFY messages.

Change-Id: Ie96af636105ee1ffe2d9a0bd9eea375faebad149
Related: osmo-bsc.git Ic5f8d55d250976d8d4c9cae2d89480fd52326717
Related: SYS#5917, OS#4984
2022-04-13 18:04:20 +03:00
Vadim Yanitskiy c02876eae2 osmo-bts-trx: bts_report_interf_meas(): remove unused fn param
Change-Id: Iec25b28e418ce1f66bbc7e0696a3ceebb02e9c82
2022-04-13 15:03:20 +00:00
Vadim Yanitskiy bab872cc0d l1sap: l1sap_chan_act(): remove unused *tp argument
Change-Id: I2030f05b55fc9370e71ff12b26ffe1142f4acfc8
2022-04-13 15:03:20 +00:00
Vadim Yanitskiy 7af62e2d0f l1sap: l1sap_chan_act(): alloc DTX FSM only for TCH
Change-Id: Ieb5728b7a9e7d7c58449deaa5a6c4d8755b6e213
2022-04-13 15:03:20 +00:00
Vadim Yanitskiy 9ae443d368 osmo-bts-virtual: remove unused 'codec_mode_request' argument
Change-Id: If5001d7b19820478d0e88fea3126e5dd4fbd2634
2022-04-13 15:03:20 +00:00
Vadim Yanitskiy 468c9e0a90 rsl: misc / cosmetic fixes for tx_ipac_XXcx_nack()
Change-Id: Ia7367cdfc6e1b1ebaabdf21e0a050fc1543968b2
2022-04-13 15:01:21 +00:00
Vadim Yanitskiy 128039a163 rsl: always check return value of rsl_tlv_parse()
Change-Id: I07cbd2849d83af28eb0458547f0eacc81347df23
2022-04-13 15:01:21 +00:00
Vadim Yanitskiy 851047b759 logging: use a different color tone for DLOOP
Normal blue (34) is really hard to read on terminals with dark
background.  Let's use light blue (94) instead.

Change-Id: Iadc9b8fb74ec17455435893a532c2f12e02cb804
2022-04-13 17:23:55 +03:00
Vadim Yanitskiy ab4ab48178 rsl: parse_multirate_config(): check if AMR codec is used
3GPP TS 48.058 defines the MultiRate configuration IE as optional,
and states that it's "included if the Channel Mode indicates that a
multi-rate codec is used".  If I understand this correctly, it may
be omitted even if a multi-rate codec is requested.  Otherwise it
would have been defined as a conditional IE.

For now let's print a warnig if this IE was expected, but missing.
We may need to apply some hard-coded defaults in this case.

If this IE is present, but the Channel Mode indicates a codec other
than AMR, let's send NACK with cause=RSL_ERR_OPT_IE_ERROR, assuming
that the CHAN ACT/MODIFY message is malformed.

Change-Id: I6ddc0b46a268ed56ac727cda57d0d68b2746fd59
Related: SYS#5917, OS#4984
2022-04-12 02:28:35 +03:00
Vadim Yanitskiy e3ff3bc4e0 rsl: rsl_rx_chan_{activ,modif}: do not sent an Error Report
Sending an Error Report along with a NACK makes no sense.

Change-Id: Idae55645c34970f839bb0eef61a7326a1026b20c
Related: SYS#5917, OS#4984
2022-04-12 01:12:28 +03:00
Vadim Yanitskiy 9b0c60ea63 rsl: de-duplicate parsing of MultiRate configuration IE
Change-Id: I98e10c3e947b9a4605e9db5bf7f499dc24bccad7
Related: SYS#5917, OS#4984
2022-04-12 00:49:18 +03:00
Vadim Yanitskiy 7bb3024764 osmo-bts-trx: amr_loop: remove unneeded #includes
Change-Id: I6d181f19711dc14695abd0f8e2586329e91aa68d
Related: SYS#5917, OS#4984
2022-04-11 23:42:29 +03:00
Vadim Yanitskiy 9ab2472851 osmo-bts-trx: use '#pragma once' in amr_loop.h
Change-Id: I98e42485955de4a261b6c8d865e84c313c1145d5
Related: SYS#5917, OS#4984
2022-04-11 23:39:58 +03:00
Vadim Yanitskiy 5cbd18cfce osmo-bts-trx: rename 'loops.[ch]' to 'amr_loop.[ch]'
There is nothing else except the AMR link adaptation loop in these files.

Change-Id: Iff2c0d32da5cd89824197d05f4732ce974c12f28
Related: SYS#5917, OS#4984
2022-04-11 20:06:51 +03:00
Vadim Yanitskiy 3ed84cc26b osmo-bts-{trx,virtual}: tx_tchh_fn(): remove FACCH/H alignment check
This check is redundant because it's guaranteed in rts_tchh_fn()
that FACCH/H is always scheduled at the correct frame offset.

Change-Id: I2f0c26f6007455aa1e3e8b27bc9d173f6b1f8c38
Related: SYS#5916, OS#5518
2022-04-10 19:07:16 +03:00
Vadim Yanitskiy 3ac0cf8c39 osmo-bts-trx: rx_tchh_fn(): use a lookup table for FACCH/H
Since change [1], in rts_tchh_fn() we're using a lookup table for
DL FACCH/H.  Let's do the same for UL FACCH/H in rx_tchh_fn().

Change-Id: I7c4e3befdd33bef4d89a04a4c7cb1a2d4078c156
Related: [1] I3dba243e5a1b7c8008ef0178ea18ed885256c50d
Related: SYS#5916, OS#5518
2022-04-10 19:04:29 +03:00
Vadim Yanitskiy 93e3a220b1 scheduler: rts_tchh_fn(): use a lookup table for FACCH/H
Unlike TCH/F, TCH/H imposes some additional requirements on the FACCH
transmission, so that a signalling block can be transmitted only at
specific TDMA frame numbers defined in 3GPP TS 45.002, table 1.

This is why in rts_tchh_fn() we need to check the given TDMA frame
number and tell rts_tch_common() whether FACCH/H is permitted or
not.  The check is based on a magic formula, which I find a bit
hard to read and understand.  Let's better use a lookup table.

Change-Id: I3dba243e5a1b7c8008ef0178ea18ed885256c50d
Related: SYS#5916, OS#5518
2022-04-10 18:25:53 +03:00