From 991f3f64d930b249037fb12f63113f727f3666a2 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Wed, 27 Apr 2022 17:45:47 +0300 Subject: 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 --- src/common/l1sap.c | 11 +++++++++-- src/common/measurement.c | 16 ++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 8e71cd4f..b74fd5a8 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -697,6 +697,8 @@ static inline void set_ms_to_data(struct gsm_lchan *lchan, int16_t data, bool se } } +bool trx_sched_is_sacch_fn(const struct gsm_bts_trx_ts *ts, uint32_t fn, bool uplink); + /* measurement information received from bts model */ static void process_l1sap_meas_data(struct gsm_lchan *lchan, const struct osmo_phsap_prim *l1sap, @@ -720,8 +722,10 @@ static void process_l1sap_meas_data(struct gsm_lchan *lchan, .inv_rssi = info_meas_ind->inv_rssi, .ber10k = info_meas_ind->ber10k, .ci_cb = info_meas_ind->c_i_cb, - .is_sub = info_meas_ind->is_sub, }; + /* additionally treat SACCH frames (match by TDMA FN) as SUB frames */ + if (info_meas_ind->is_sub || trx_sched_is_sacch_fn(lchan->ts, fn, true)) + ulm.is_sub = 1; break; case PRIM_TCH: ph_tch_ind = &l1sap->u.tch; @@ -736,6 +740,7 @@ static void process_l1sap_meas_data(struct gsm_lchan *lchan, .ci_cb = ph_tch_ind->lqual_cb, .is_sub = ph_tch_ind->is_sub, }; + /* PRIM_TCH always carries DCCH, not SACCH */ break; case PRIM_PH_DATA: ph_data_ind = &l1sap->u.data; @@ -748,8 +753,10 @@ static void process_l1sap_meas_data(struct gsm_lchan *lchan, .inv_rssi = abs(ph_data_ind->rssi), .ber10k = ph_data_ind->ber10k, .ci_cb = ph_data_ind->lqual_cb, - .is_sub = ph_data_ind->is_sub, }; + /* additionally treat SACCH frames (match by RSL link ID) as SUB frames */ + if (ph_data_ind->is_sub || L1SAP_IS_LINK_SACCH(ph_data_ind->link_id)) + ulm.is_sub = 1; break; default: OSMO_ASSERT(false); diff --git a/src/common/measurement.c b/src/common/measurement.c index d1f99609..aa1f5ae0 100644 --- a/src/common/measurement.c +++ b/src/common/measurement.c @@ -56,20 +56,18 @@ bool ts45008_83_is_sub(struct gsm_lchan *lchan, uint32_t fn) /* See TS 45.008 Sections 8.3 and 8.4 for a detailed descriptions of the rules * implemented here. We only implement the logic for Voice, not CSD */ + /* AMR is special, SID frames may be scheduled dynamically at any time */ + if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) + return false; + switch (lchan->type) { case GSM_LCHAN_TCH_F: switch (lchan->tch_mode) { case GSM48_CMODE_SPEECH_V1: case GSM48_CMODE_SPEECH_EFR: - if (trx_sched_is_sacch_fn(lchan->ts, fn, true)) - return true; if (ARRAY_CONTAINS(ts45008_83_tch_f, fn104)) return true; break; - case GSM48_CMODE_SPEECH_AMR: - if (trx_sched_is_sacch_fn(lchan->ts, fn, true)) - return true; - break; case GSM48_CMODE_SIGN: /* No DTX allowed; SUB=FULL, therefore measurements at all frame numbers are * SUB */ @@ -83,8 +81,6 @@ bool ts45008_83_is_sub(struct gsm_lchan *lchan, uint32_t fn) case GSM_LCHAN_TCH_H: switch (lchan->tch_mode) { case GSM48_CMODE_SPEECH_V1: - if (trx_sched_is_sacch_fn(lchan->ts, fn, true)) - return true; switch (lchan->nr) { case 0: if (ARRAY_CONTAINS(ts45008_83_tch_hs0, fn104)) @@ -98,10 +94,6 @@ bool ts45008_83_is_sub(struct gsm_lchan *lchan, uint32_t fn) OSMO_ASSERT(0); } break; - case GSM48_CMODE_SPEECH_AMR: - if (trx_sched_is_sacch_fn(lchan->ts, fn, true)) - return true; - break; case GSM48_CMODE_SIGN: /* No DTX allowed; SUB=FULL, therefore measurements at all frame numbers are * SUB */ -- cgit v1.2.3