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
This commit is contained in:
Vadim Yanitskiy 2020-10-16 01:51:03 +07:00 committed by fixeria
parent 4cbc2acde8
commit 8aab8d484b
5 changed files with 0 additions and 122 deletions

View File

@ -103,7 +103,6 @@ struct l1sched_chan_state {
uint8_t ul_mask; /* mask of received bursts */
/* loss detection */
uint8_t lost_frames; /* how many L2 frames were lost */
uint32_t last_tdma_fn; /* last processed TDMA frame number */
uint32_t proc_tdma_fs; /* how many TDMA frames were processed */
uint32_t lost_tdma_fs; /* how many TDMA frames were lost */

View File

@ -788,9 +788,6 @@ int _sched_compose_ph_data_ind(struct l1sched_ts *l1ts, uint32_t fn,
if (l2_len)
memcpy(msg->l2h, l2, l2_len);
if (L1SAP_IS_LINK_SACCH(trx_chan_desc[chan].link_id))
l1ts->chan_state[chan].lost_frames = 0;
/* forward primitive */
l1sap_up(l1ts->ts->trx, l1sap);
@ -828,9 +825,6 @@ int _sched_compose_tch_ind(struct l1sched_ts *l1ts, uint32_t fn,
if (tch_len)
memcpy(msg->l2h, tch, tch_len);
if (l1ts->chan_state[chan].lost_frames)
l1ts->chan_state[chan].lost_frames--;
LOGL1S(DL1P, LOGL_DEBUG, l1ts, chan, l1sap->u.data.fn, "%s Rx -> RTP: %s\n",
gsm_lchan_name(lchan), osmo_hexdump(msgb_l2(msg), msgb_l2len(msg)));
/* forward primitive */

View File

@ -332,59 +332,6 @@ struct msgb *tch_dl_dequeue(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br
uint8_t tch_mode = chan_state->tch_mode;
struct osmo_phsap_prim *l1sap;
/* handle loss detection of received TCH frames */
if (rsl_cmode == RSL_CMOD_SPD_SPEECH
&& ++(chan_state->lost_frames) > 5) {
uint8_t tch_data[GSM_FR_BYTES];
int len;
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, br, "Missing TCH bursts detected, sending BFI\n");
/* indicate bad frame */
switch (tch_mode) {
case GSM48_CMODE_SPEECH_V1: /* FR / HR */
if (br->chan != TRXC_TCHF) { /* HR */
tch_data[0] = 0x70; /* F = 0, FT = 111 */
memset(tch_data + 1, 0, 14);
len = 15;
break;
}
memset(tch_data, 0, GSM_FR_BYTES);
len = GSM_FR_BYTES;
break;
case GSM48_CMODE_SPEECH_EFR: /* EFR */
if (br->chan != TRXC_TCHF)
goto inval_mode1;
memset(tch_data, 0, GSM_EFR_BYTES);
len = GSM_EFR_BYTES;
break;
case GSM48_CMODE_SPEECH_AMR: /* AMR */
len = osmo_amr_rtp_enc(tch_data,
chan_state->codec[chan_state->dl_cmr],
chan_state->codec[chan_state->dl_ft], AMR_BAD);
if (len < 2) {
LOGL1SB(DL1P, LOGL_ERROR, l1ts, br,
"Failed to encode AMR_BAD frame (rc=%d), "
"not sending BFI\n", len);
len = 0;
break;
}
memset(tch_data + 2, 0, len - 2);
break;
default:
inval_mode1:
LOGL1SB(DL1P, LOGL_ERROR, l1ts, br, "TCH mode invalid, please fix!\n");
len = 0;
}
if (len) {
/* Note: RSSI/ToA256 is set to 0 to indicate to the higher
* layers that this is a faked tch_ind */
_sched_compose_tch_ind(l1ts, br->fn, br->chan,
tch_data, len, 0, 10000, 0, 0, 0);
}
}
/* get frame and unlink from queue */
msg1 = _sched_dequeue_prim(l1ts, br);
msg2 = _sched_dequeue_prim(l1ts, br);

View File

@ -207,21 +207,6 @@ got_msg:
/* BURST BYPASS */
/* handle loss detection of SACCH */
if (L1SAP_IS_LINK_SACCH(trx_chan_desc[br->chan].link_id)) {
/* count and send BFI */
if (++(l1ts->chan_state[br->chan].lost_frames) > 1) {
/* TODO: Should we pass old TOA here? Otherwise we risk
* unnecessary decreasing TA */
/* Note: RSSI is set to 0 to indicate to the higher
* layers that this is a faked ph_data_ind */
_sched_compose_ph_data_ind(l1ts, 0, br->chan, NULL, 0,
0, 0, 0, 10000,
PRES_INFO_INVALID);
}
}
/* allocate burst memory, if not already */
if (!*bursts_p) {
*bursts_p = talloc_zero_size(l1ts, 464);

View File

@ -244,53 +244,6 @@ static void tx_tch_common(struct l1sched_ts *l1ts,
uint8_t rsl_cmode = chan_state->rsl_cmode;
uint8_t tch_mode = chan_state->tch_mode;
struct osmo_phsap_prim *l1sap;
#if 0
/* handle loss detection of received TCH frames */
if (rsl_cmode == RSL_CMOD_SPD_SPEECH
&& ++(chan_state->lost_frames) > 5) {
uint8_t tch_data[GSM_FR_BYTES];
int len;
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, br, "Missing TCH bursts detected, sending "
"BFI for %s\n", trx_chan_desc[br->chan].name);
/* indicate bad frame */
switch (tch_mode) {
case GSM48_CMODE_SPEECH_V1: /* FR / HR */
if (br->chan != TRXC_TCHF) { /* HR */
tch_data[0] = 0x70; /* F = 0, FT = 111 */
memset(tch_data + 1, 0, 14);
len = 15;
break;
}
memset(tch_data, 0, GSM_FR_BYTES);
len = GSM_FR_BYTES;
break;
case GSM48_CMODE_SPEECH_EFR: /* EFR */
if (br->chan != TRXC_TCHF)
goto inval_mode1;
memset(tch_data, 0, GSM_EFR_BYTES);
len = GSM_EFR_BYTES;
break;
case GSM48_CMODE_SPEECH_AMR: /* AMR */
len = amr_compose_payload(tch_data,
chan_state->codec[chan_state->dl_cmr],
chan_state->codec[chan_state->dl_ft], 1);
if (len < 2)
break;
memset(tch_data + 2, 0, len - 2);
_sched_compose_tch_ind(l1ts, 0, br->chan, tch_data, len);
break;
default:
inval_mode1:
LOGP(DL1P, LOGL_ERROR, "TCH mode invalid, please "
"fix!\n");
len = 0;
}
if (len)
_sched_compose_tch_ind(l1ts, 0, br->chan, tch_data, len);
}
#endif
/* get frame and unlink from queue */
msg1 = _sched_dequeue_prim(l1ts, br);