Commit Graph

2924 Commits

Author SHA1 Message Date
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
Vadim Yanitskiy 14b00bb8b2 scheduler: remove redundant OSMO_ASSERT() statements
It's guaranteed by the calling function bts_model_l1sap_down() that
the prim's operation is PRIM_OP_REQUEST and that the msg is present.

Change-Id: I6a01bba7b5eb337ae1552c442d74447565c52e25
2022-04-09 19:48:55 +03:00
Vadim Yanitskiy 94f7b4753a power_ctrl_params_def_reset(): set .ctrl_interval for both UL/DL
For the sake of consistency and code readability, initialize the
power loop control interval (P_Con_INTERVAL) for both Uplink and
Downlink directions in the same function.

Change-Id: If7c804e51eb104d9fe73294a3867ab3b551d83c3
2022-04-08 20:39:35 +00:00
Vadim Yanitskiy dd7bed3415 osmo-bts-trx: rx_tchf_fn(): clarify indexes in the AMR CMI lookup table
Change-Id: If81ff0bd449fe20da43cc3d96dadf38568507054
Related: SYS#5916
2022-04-08 19:05:45 +03:00
Vadim Yanitskiy 94806cee7b osmo-bts-trx: rx_tchh_fn(): fix indexes in the AMR CMI lookup table
In change [1] I didn't take into account that the TCH/H burst buffer
is 6 bursts wide, and that we're decoding 2 bursts late:

  +---+---+---+---+---+---+
  | a | b | c | d | e | f |  Burst 'a' received first, 'f' last
  +---+---+---+---+---+---+
   ^^^^^^^^^^^^^^^           Speech frame (bursts 'a' .. 'd')
   ^^^^^^^^^^^^^^^^^^^^^^^   FACCH frame  (bursts 'a' .. 'f')

The lookup table for TCH/H was calculated with the assumption that
in rx_tchh_fn() the 'bi->fn' indicates TDMA frame number for burst
'd', but in reality it holds the frame number of burst 'f'.

Change-Id: I4f22cf49fd52ed26f8017f76461059a701c181e1
Fixes: [1] I46def864729c8f9063af201750456771ea5558d5
Related: SYS#5916
2022-04-08 19:01:40 +03:00
Vadim Yanitskiy c4368ce3ab osmo-bts-trx: move AMR CMI lookup tables to the respective files
It makes no sense to have these tables in the header file, because
they're not used anywhere outside of the respective lchan handlers.

Change-Id: Ibdebfb9b1ef78c960b08240ebdb4c7af92cbed11
Related: SYS#5916
2022-04-08 18:37:08 +03:00
Vadim Yanitskiy f5b756e484 osmo-bts-trx: rx_tchh_fn(): fix meas reporting in signalling mode
In change [1] I broke measurement reporting for TCH/H in signalling
mode.  The problem is that in rx_tchh_fn() we started to invalidate
the Uplink RSSI for FACCH regardless of the channel mode: speech or
signalling.  In speech mode, the averaged measurements are carried
over by the two BFIs.  In signalling mode we send no BFIs, so:

* let's use the proper averaging mode S6N6 (not S6N4), and
* send the averaged measurements together with the FACCH.

This change fixes BTS_Tests.TC_meas_res_sign_tchh[_toa256].

Change-Id: If98aa1f0f7255f20344460bdd07e2c896dd6e56f
Fixes: [1] I7902b4709bc3f418174e8373f52e87bb31cdc826
Related: SYS#5853
2022-04-07 20:36:36 +03:00
Vadim Yanitskiy 5ce5c7db9b osmo-bts-trx: rx_{tchh,tchf}_fn(): use tch_mode directly
There is no reason not to use 'chan_state->tch_mode' directly in
the 'switch' statement.  If a logical channel is in signalling
mode, then both 'chan_state->{rsl,tch}_cmode' are set to
RSL_CMOD_SPD_SIGN and GSM48_CMODE_SIGN, respectively.

Change-Id: I9e5e2c891c80c32fc522b53c9371b71ea32dd54d
Related: SYS#5853
2022-04-07 20:27:46 +03:00
Vadim Yanitskiy 5a8413166f osmo-bts-trx: rx_{tchh,tchf}_fn(): use AMR CMI lookup tables
3GPP TS 45.009 defines that Codec Mode Indications shall be sent
with speech frames having specific TDMA frame numbers of their
*first* bursts, which are defined in tables 3.2.1.3-{1,2,3,4}.

Performance-wise it's batter to have these tables implemented as
arrays, rather then using the 'switch' statement.  We can simplify
things even further and have TDMA frame numbers corresponding to
the *last* bursts in them.  This eliminates the need of doing an
additional last-to-first mapping, so that bi->fn can be used.

Change-Id: I46def864729c8f9063af201750456771ea5558d5
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy 12b3921a4a osmo-bts-trx: rx_{tchf,tchh}_fn(): get TDMA FN from meas history
Once we have an Uplink speech or FACCH frame decoded, we need to
hand it over to the upper layers indicating TDMA frame number of
the *first* burst corresponding to the beginning of a block.

Currently we use libosmogsm's gsm0502_fn_remap() API to calculate
the first TDMA frame number from the given last frame number.
This API involves iterating over the pre-calculated offset tables
for different channel and payload types, and thus imposes some
additional CPU cycles.  Another downside of the current approach
is that we have to perform such lookups several times for each
decoded L2 frame, e.g. for FACCH on TCH/AHS we do it three times!

In this patch I propose an alternative approach of storing TDMA
frame numbers in the measurement history, together with the
associated samples.  This way we can easily get N-th frame number
from there without performing any additional computations, other
than what we already do during the measurement processing.

Change-Id: Id9a2b7b0f1a1ad7cfbbab862faf521e135c90605
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy 333e35439d osmo-bts-trx: rx_{tchf,tchh}_fn(): ensure complete set of bursts
The idea of this change is to avoid attempting to decode the burst
buffer unless it's filled up completely.  This eliminates expected
decoding errors in the beginning of lchan's lifetime.  Moreover
this allows us to be sure that the measurement history is complete,
so that we can abuse it to store TDMA frame numbers later.

Note that even in the absence of NOPE indications (TRXDv0 case)
we can still be sure that the burst mask has no gaps due to lost
bursts, because they are compensated by trx_sched_calc_frame_loss().

Change-Id: I56bebe1374eb803e3c1e9f08dda4da50a074ab0b
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy 6d04bd95ee osmo-bts-trx: rx_{tchf,tchh}_fn(): shift Rx burst buffer on bid=0
For both TCH/F and TCH/H, the receive burst buffer needs to be
periodically shifted leftwards due to the nature of block-diagonal
interleaving.  Currently we do this on receipt of bid=3 for TCH/F
and bid=1 for TCH/H, right after attempting to decode the buffer.

If for some reason we return early before attempting to decode the
buffer, the content of that buffer might not be shifted and some
bursts might be overwritten.  This can be easily avoided by doing
the shifting on receipt of bid=0 for both TCH/H and TCH/F.

Change-Id: I0bd69f5a8f5c665fb5f00c127bc3fe1d91167abb
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy b8b6066450 osmo-bts-trx: rx_{tchf,tchh}_fn(): also use meas_avg for BFI
In the current implementation of both TCH/F and TCH/H lchans, we
set the 'bfi_flag' to true only if decoding fails.  Perhaps this
was not the case when I wrote [1], so using meas_avg might result
in using uninitialized memory.  This is not the case anymore.

Pass the *averaged* measurememnts regardless of decoding result.

Change-Id: I23f767364a018d30d04885990adf69b50b2c9738
Related: [1] I2b02b51fea5664f161382a4ddc63dbf14ffc9ac5
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy da433bba7b osmo-bts-trx: rx_tchh_fn(): get rid of chan_state->meas_avg_facch
FACCH/H takes out two speech frames, so we send two BFIs once we
have received it in rx_tchh_fn().  The upper layers responsible
for handling of the Uplink measurements expect a fixed amount of
measurement samples, so currently we do:

* send a FACCH frame with the associated measurememnts (S6N6),
* send the 1st BFI with invalidated measurements (RSSI=0),
* send the 2nd BFI with the stored measurememnts of FACCH.

This is achieved by preserving a copy of the FACCH measurememnts
in chan_state->meas_avg_facch and then using it two bursts later.

The same goal can be achieved a lot easier by sending the associated
measurements with both BFIs as if no FACCH was received:

* send a FACCH frame with invalidated measurememnts (RSSI=0),
* send the 1st BFI with the associated measurememnts (S6N4),
* send the 2nd BFI with the associated measurememnts (S6N4).

This eliminates the need to store anything outside of the existing
measurement history and simplifies the code a lot.  Also, this
eliminates the need for using a dedicated averaging mode S6N6.

Varified by running BTS_Tests.TC_meas_res_speech_tchh_facch.

Change-Id: I7902b4709bc3f418174e8373f52e87bb31cdc826
Related: I1ad9fa3815feb2b4da608ab7df716a87ba1f2f91
2022-04-05 13:45:31 +00:00
Vadim Yanitskiy bd7ef4101b osmo-bts-trx: rx_tchh_fn(): indicate BER10k=0 for FACCH BFIs
It makes no sense to store BER10k value of an Uplink FACCH frame
in order to indicate it in a BFI later on.  Given that these BFIs
are generated artificially, it's fine to indicate BER10k=0.

Change-Id: I24d12892760dca0ad0a5c2abca9fc66523d9e614
Related: I1ad9fa3815feb2b4da608ab7df716a87ba1f2f91
2022-04-05 13:45:31 +00:00
Pau Espin 7a2f307246 doc: rsl: Fix description of 'IP Connection Statistics' IE
Related: SYS#5915
Change-Id: Ic524d73a0c47fde528b78f9dfe7b72b7286550e1
2022-04-04 19:27:59 +02:00
Vadim Yanitskiy 5bb7031366 fix gsm_bts_get_cbch(): CBCH can be allocated on Cn
According to 3GPP TS 45.002, table 3, unlike the CCCH+SDCCH/4+CBCH
combination, which can only be allocated on C0/TS0, the SDCCH/8+CBCH
can be allocated on C0..n/TS0..3.  In other words, having CBCH on
e.g. C1/TS2 is perfectly legal.  This is why in gsm_bts_get_cbch()
we should check all transceivers, not just the C0.

Without this change osmo-bts does not send CBCH Load Indications
at all if the CBCH is allocated on C1..n.

Change-Id: Ib5976783b53521047fbdfc18e0e236e8bce8eaae
Related: osmo-bsc.git Ie79ccff4f8f0f1134757ec0c35e18b58081cc158
Related: SYS#5905
2022-03-31 19:57:10 +03:00
Vadim Yanitskiy b147878f9e trx_sched_ul_burst(): get rid of the 'switch' statement
Both TRXC_RACH and TRXC_PTCCH are handled in the rx_rach_fn(),
so we can eliminate the need of having a 'switch' statement in
the general (perfrmance critical) code path.

Change-Id: I66d8785a63215af37a77e258039549e4e6292e49
2022-03-22 18:28:15 +00:00
Vadim Yanitskiy 35e601a322 osmo-bts-trx: rx_tchh_fn(): use proper meas averaging mode
Compared to TCH/F, TCH/H is a bit special in a way that:

* speech frames are interleaved over 4 consecutive bursts,
* while FACCH frames are interleaved over 6 consecutive bursts.

This is why in rx_tchh_fn() we allocate a buffer large enough to
store up to 6 bursts.  Let's say we have that buffer filled up
completely with all 6 bursts (from 'a' to 'f').  Now attempting
to decode them may yield either a speech frame or a FACCH frame:

  +---+---+---+---+---+---+
  | a | b | c | d | e | f |  Burst 'a' received first, 'f' last
  +---+---+---+---+---+---+
   ^^^^^^^^^^^^^^^           Speech frame (bursts 'a' .. 'd')
   ^^^^^^^^^^^^^^^^^^^^^^^   FACCH frame  (bursts 'a' .. 'f')

For FACCH we use measurement averaging mode SCHED_MEAS_AVG_M_S6N6,
so that 6 last samples are averaged - so far so good.  For speech
we use SCHED_MEAS_AVG_M_S4N4, so that 4 last samples corresponding
to bursts 'c', 'd', 'e', 'f' are averaged - this is wrong.

We actually need to average the *first* 4 samples corresponding to
bursts 'a', 'b', 'c', 'd' in the case of speech.  Let's add and use
a new averaging mode SCHED_MEAS_AVG_M_S6N4 for that.

Change-Id: Iea6f4e5471550f4c2b57aaebeac83c80e879489d
2022-03-18 03:53:08 +03:00