fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/20674 )
Change subject: osmo-bts-trx: drop Uplink loss detection from Downlink path ......................................................................
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 --- M include/osmo-bts/scheduler.h M src/common/scheduler.c M src/osmo-bts-trx/sched_lchan_tchf.c M src/osmo-bts-trx/sched_lchan_xcch.c M src/osmo-bts-virtual/scheduler_virtbts.c 5 files changed, 0 insertions(+), 122 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h index eab904c..51b1846 100644 --- a/include/osmo-bts/scheduler.h +++ b/include/osmo-bts/scheduler.h @@ -103,7 +103,6 @@ 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 */ diff --git a/src/common/scheduler.c b/src/common/scheduler.c index d166909..6564e5a 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -788,9 +788,6 @@ 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 @@ 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 */ diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c index 20abfe1..6a90327 100644 --- a/src/osmo-bts-trx/sched_lchan_tchf.c +++ b/src/osmo-bts-trx/sched_lchan_tchf.c @@ -332,59 +332,6 @@ 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); diff --git a/src/osmo-bts-trx/sched_lchan_xcch.c b/src/osmo-bts-trx/sched_lchan_xcch.c index 1d529f2..e936621 100644 --- a/src/osmo-bts-trx/sched_lchan_xcch.c +++ b/src/osmo-bts-trx/sched_lchan_xcch.c @@ -207,21 +207,6 @@
/* 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); diff --git a/src/osmo-bts-virtual/scheduler_virtbts.c b/src/osmo-bts-virtual/scheduler_virtbts.c index a9edb3a..d20cc39 100644 --- a/src/osmo-bts-virtual/scheduler_virtbts.c +++ b/src/osmo-bts-virtual/scheduler_virtbts.c @@ -244,53 +244,6 @@ 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);