Transmit invalid AMR speech blocks instead of dummy FACCH

Every BTS needs to have some graceful handling for the scenario
where it is time to send out a speech frame on TCH DL, but there is
no frame to be sent. One possible solution is to transmit dummy
FACCH, but this option is unattractive for TCH/AHS where FACCH
displaces two speech frames rather than one. A more elegant solution
is to emit a speech frame that is bad, causing the MS receiver to
declare a BFI condition to trigger substitution and muting procedure.
A bad frame is generated by gsm0503_tch_{afs,ahs}_encode() by setting
the payload length to 0.

Depends: libosmocore.git I82ce2adf995a4b42d1f378c5819f88d773b9104a
Related: OS#6049
Change-Id: I056f379715c91ad968f198e112d363a9009dc1c3
This commit is contained in:
Andreas Eversberg 2023-11-24 17:32:31 +01:00 committed by fixeria
parent bc4ca18a31
commit bc6cc67115
2 changed files with 36 additions and 8 deletions

View File

@ -538,15 +538,14 @@ int tx_tchf_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* - If the channel mode is TCH/FS or TCH/EFS, transmit a dummy
* speech block with inverted CRC3, designed to induce a BFI
* condition in the MS receiver.
* - If the channel mode is TCH/AFS, transmit a dummy speech
* block with inverted CRC6, designed to induce a BFI
* condition in the MS receiver.
* - If the channel mode is one of the CSD modes, transmit an
* idle frame as described in 3GPP TS 44.021, sections 8.1.6
* and 10.2.3 (all data, status and E-bits set to binary '1').
* - In all other channel modes, transmit dummy FACCH
* like we always did before.
*
* FIXME: someone who knows AMR needs to look at this problem
* and decide what is the correct BTS Tx behavior for frame
* gaps in TCH/AFS. See OS#6049.
*/
switch (tch_mode) {
case GSM48_CMODE_DATA_12k0:
@ -562,6 +561,21 @@ int tx_tchf_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* fall-through */
case GSM48_CMODE_SIGN:
default:
if (tch_mode == GSM48_CMODE_SPEECH_AMR) {
/* the first FN 4,13,21 defines that CMI is included in frame,
* the first FN 0,8,17 defines that CMR is included in frame.
*/
rc = gsm0503_tch_afs_encode(BUFPOS(bursts_p, 0),
NULL, 0,
!sched_tchf_dl_amr_cmi_map[br->fn % 26],
chan_state->codec,
chan_state->codecs,
chan_state->dl_ft,
chan_state->dl_cmr);
if (rc == 0)
goto send_burst;
}
/* TODO: use randomized padding */
msg_facch = tch_dummy_msgb(GSM_MACBLOCK_LEN, GSM_MACBLOCK_PADDING);
/* dummy LAPDm func=UI frame */

View File

@ -453,15 +453,14 @@ int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* - If the channel mode is TCH/HS, transmit a dummy speech block
* with inverted CRC3, designed to induce a BFI condition in
* the MS receiver.
* - If the channel mode is TCH/AHS, transmit a dummy speech
* block with inverted CRC6, designed to induce a BFI
* condition in the MS receiver.
* - If the channel mode is one of the CSD modes, transmit an
* idle frame as described in 3GPP TS 44.021, sections 8.1.6
* and 10.2.3 (all data, status and E-bits set to binary '1').
* - In all other channel modes, transmit dummy FACCH
* like we always did before.
*
* FIXME: someone who knows AMR needs to look at this problem
* and decide what is the correct BTS Tx behavior for frame
* gaps in TCH/AHS. See OS#6049.
*/
switch (tch_mode) {
case GSM48_CMODE_DATA_6k0:
@ -474,6 +473,21 @@ int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* fall-through */
case GSM48_CMODE_SIGN:
default:
if (tch_mode == GSM48_CMODE_SPEECH_AMR) {
/* the first FN 4,13,21 or 5,14,22 defines that CMI is included
* in frame, the first FN 0,8,17 or 1,9,18 defines that CMR is
* included in frame. */
rc = gsm0503_tch_ahs_encode(BUFPOS(bursts_p, 0),
NULL, 0,
!sched_tchh_dl_amr_cmi_map[br->fn % 26],
chan_state->codec,
chan_state->codecs,
chan_state->dl_ft,
chan_state->dl_cmr);
if (rc == 0)
goto send_burst;
}
/* FACCH/H can only be scheduled at specific TDMA offset */
if (!sched_tchh_dl_facch_map[br->fn % 26]) {
/* FACCH/H is not allowed, send half-filled bursts with even numbered