Change in osmo-bts[master]: measurement: move repeated_dl_facch_active_decision() here

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Fri Oct 22 13:54:24 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/25892 )

Change subject: measurement: move repeated_dl_facch_active_decision() here
......................................................................

measurement: move repeated_dl_facch_active_decision() here

For the sake of consistency, call repeated_dl_facch_active_decision()
from handle_ms_meas_report(), so we have all functions using the
measurement results for Downlink executed in a single place.

Change-Id: Ibd5377ce642e49161f320ac8c33e9f966b3ddfaf
Related: SYS#5114, SYS#5319
---
M include/osmo-bts/l1sap.h
M src/common/l1sap.c
M src/common/measurement.c
M src/common/rsl.c
4 files changed, 76 insertions(+), 78 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h
index f78d114..93c532f 100644
--- a/include/osmo-bts/l1sap.h
+++ b/include/osmo-bts/l1sap.h
@@ -144,7 +144,4 @@
 
 int is_ccch_for_agch(struct gsm_bts_trx *trx, uint32_t fn);
 
-void repeated_dl_facch_active_decision(struct gsm_lchan *lchan,
-				       const uint8_t *l3, size_t l3_len);
-
 #endif /* L1SAP_H */
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index f5d2364..a6cd21d 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1026,80 +1026,6 @@
 	return msg;
 }
 
-/* Decide if repeated FACCH should be applied or not. If RXQUAL level, that the
- * MS reports is high enough, FACCH repetition is not needed. */
-void repeated_dl_facch_active_decision(struct gsm_lchan *lchan, const uint8_t *l3,
-				       size_t l3_len)
-{
-	const struct gsm48_meas_res *meas_res;
-	uint8_t upper;
-	uint8_t lower;
-	uint8_t rxqual;
-	bool prev_repeated_dl_facch_active = lchan->repeated_dl_facch_active;
-
-	/* This is an optimization so that we exit as quickly as possible if
-	 * there are no FACCH repetition capabilities present. However If the
-	 * repeated FACCH capabilities vanish for whatever reason, we must be
-	 * sure that FACCH repetition is disabled. */
-	if (!lchan->repeated_acch_capability.dl_facch_cmd
-	    && !lchan->repeated_acch_capability.dl_facch_all) {
-		lchan->repeated_dl_facch_active = false;
-		goto out;
-	}
-
-	/* Threshold disabled (always on) */
-	if (lchan->repeated_acch_capability.rxqual == 0) {
-		lchan->repeated_dl_facch_active = true;
-		goto out;
-	}
-
-	/* When the MS sets the SRR bit in the UL-SACCH L1 header
-	 * (repeated SACCH requested) then it makes sense to enable
-	 * FACCH repetition too. */
-	if (lchan->meas.l1_info.srr_sro) {
-		lchan->repeated_dl_facch_active = true;
-		goto out;
-	}
-
-	/* Parse MS measurement results */
-	if (l3_len <= sizeof(struct gsm48_meas_res *) + 2)
-		goto out;
-	if (l3[0] != GSM48_PDISC_RR)
-		goto out;
-	if (l3[1] != GSM48_MT_RR_MEAS_REP)
-		goto out;
-	l3 += 2;
-	meas_res = (struct gsm48_meas_res *)l3;
-
-	/* If the RXQUAL level at the MS drops under a certain threshold
-	 * we enable FACCH repetition. */
-	upper = lchan->repeated_acch_capability.rxqual;
-	if (upper > 2)
-		lower = lchan->repeated_acch_capability.rxqual - 2;
-	else
-		lower = 0;
-
-	/* When downlink DTX is applied, use RXQUAL-SUB, otherwise use
-	 * RXQUAL-FULL. */
-	if (meas_res->dtx_used)
-		rxqual = meas_res->rxqual_sub;
-	else
-		rxqual = meas_res->rxqual_full;
-
-	if (rxqual >= upper)
-		lchan->repeated_dl_facch_active = true;
-	else if (rxqual <= lower)
-		lchan->repeated_dl_facch_active = false;
-
-out:
-	if (lchan->repeated_dl_facch_active == prev_repeated_dl_facch_active)
-		return;
-	if (lchan->repeated_dl_facch_active)
-		LOGPLCHAN(lchan, DL1P, LOGL_DEBUG, "DL-FACCH repetition: inactive => active\n");
-	else
-		LOGPLCHAN(lchan, DL1P, LOGL_DEBUG, "DL-FACCH repetition: active => inactive\n");
-}
-
 /* Special dequeueing function with SACCH repetition (3GPP TS 44.006, section 11) */
 static inline struct msgb *lapdm_phsap_dequeue_msg_sacch(struct gsm_lchan *lchan, struct lapdm_entity *le)
 {
diff --git a/src/common/measurement.c b/src/common/measurement.c
index 0a8a182..3a17869 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -789,6 +789,80 @@
 	return (lchan->ms_t_offs >= 0) || (lchan->p_offs >= 0);
 }
 
+/* Decide if repeated FACCH should be applied or not. If RXQUAL level, that the
+ * MS reports is high enough, FACCH repetition is not needed. */
+static void repeated_dl_facch_active_decision(struct gsm_lchan *lchan,
+					      const struct gsm48_hdr *gh)
+{
+	const struct gsm48_meas_res *meas_res;
+	uint8_t upper;
+	uint8_t lower;
+	uint8_t rxqual;
+	bool prev_repeated_dl_facch_active = lchan->repeated_dl_facch_active;
+
+	/* This is an optimization so that we exit as quickly as possible if
+	 * there are no FACCH repetition capabilities present. However If the
+	 * repeated FACCH capabilities vanish for whatever reason, we must be
+	 * sure that FACCH repetition is disabled. */
+	if (!lchan->repeated_acch_capability.dl_facch_cmd
+	    && !lchan->repeated_acch_capability.dl_facch_all) {
+		lchan->repeated_dl_facch_active = false;
+		goto out;
+	}
+
+	/* Threshold disabled (always on) */
+	if (lchan->repeated_acch_capability.rxqual == 0) {
+		lchan->repeated_dl_facch_active = true;
+		goto out;
+	}
+
+	/* When the MS sets the SRR bit in the UL-SACCH L1 header
+	 * (repeated SACCH requested) then it makes sense to enable
+	 * FACCH repetition too. */
+	if (lchan->meas.l1_info.srr_sro) {
+		lchan->repeated_dl_facch_active = true;
+		goto out;
+	}
+
+	/* Parse MS measurement results */
+	if (gh == NULL)
+		goto out;
+	/* Check if this is a Measurement Report */
+	if (gh->proto_discr != GSM48_PDISC_RR)
+		goto out;
+	if (gh->msg_type != GSM48_MT_RR_MEAS_REP)
+		goto out;
+	meas_res = (const struct gsm48_meas_res *) gh->data;
+
+	/* If the RXQUAL level at the MS drops under a certain threshold
+	 * we enable FACCH repetition. */
+	upper = lchan->repeated_acch_capability.rxqual;
+	if (upper > 2)
+		lower = lchan->repeated_acch_capability.rxqual - 2;
+	else
+		lower = 0;
+
+	/* When downlink DTX is applied, use RXQUAL-SUB, otherwise use
+	 * RXQUAL-FULL. */
+	if (meas_res->dtx_used)
+		rxqual = meas_res->rxqual_sub;
+	else
+		rxqual = meas_res->rxqual_full;
+
+	if (rxqual >= upper)
+		lchan->repeated_dl_facch_active = true;
+	else if (rxqual <= lower)
+		lchan->repeated_dl_facch_active = false;
+
+out:
+	if (lchan->repeated_dl_facch_active == prev_repeated_dl_facch_active)
+		return;
+	if (lchan->repeated_dl_facch_active)
+		LOGPLCHAN(lchan, DL1P, LOGL_DEBUG, "DL-FACCH repetition: inactive => active\n");
+	else
+		LOGPLCHAN(lchan, DL1P, LOGL_DEBUG, "DL-FACCH repetition: active => inactive\n");
+}
+
 /* Called every time a Measurement Result (TS 08.58 8.4.8) is received from
  * lower layers and has to be forwarded to BSC */
 int handle_ms_meas_report(struct gsm_lchan *lchan,
@@ -853,6 +927,8 @@
 	if (gh)
 		lchan_bs_pwr_ctrl(lchan, gh);
 
+	repeated_dl_facch_active_decision(lchan, gh);
+
 	/* Reset state for next iteration */
 	lchan->tch.dtx.dl_active = false;
 	lchan->meas.flags &= ~LC_UL_M_F_OSMO_EXT_VALID;
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 3cbfff6..11f2f86 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -3586,7 +3586,6 @@
 			return 0;
 		}
 
-		repeated_dl_facch_active_decision(lchan, msgb_l3(msg), msgb_l3len(msg));
 		rc = handle_ms_meas_report(lchan, (struct gsm48_hdr *)msgb_l3(msg), msgb_l3len(msg));
 		msgb_free(msg);
 		return rc;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/25892
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ibd5377ce642e49161f320ac8c33e9f966b3ddfaf
Gerrit-Change-Number: 25892
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211022/d2a08891/attachment.htm>


More information about the gerrit-log mailing list