Change in osmo-bts[master]: osmo-bts-trx: implement Temporary Overpower for SACCH/FACCH

dexter gerrit-no-reply at lists.osmocom.org
Mon Aug 30 16:03:57 UTC 2021


Hello fixeria,

I'd like you to do a code review. Please visit

    https://gerrit.osmocom.org/c/osmo-bts/+/25284

to review the following change.


Change subject: osmo-bts-trx: implement Temporary Overpower for SACCH/FACCH
......................................................................

osmo-bts-trx: implement Temporary Overpower for SACCH/FACCH

Change-Id: Ie8a626fefccf1eb07271058e5126ec106cb1abcf
Related: SYS#5319
---
M include/osmo-bts/gsm_data.h
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_tchh.c
5 files changed, 42 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/84/25284/1

diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 80f1833..53b3b05 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -401,6 +401,9 @@
 	struct gsm_power_ctrl_params ms_dpc_params;
 	struct gsm_power_ctrl_params bs_dpc_params;
 
+	/* Temporary Overpower for SACCH/FACCH */
+	uint8_t bs_acch_overpower_db;
+
 	struct msgb *pending_rel_ind_msg;
 
 	/* ECU (Error Concealment Unit) state */
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 80a260f..d640647 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -128,6 +128,8 @@
 	struct l1sched_meas_set meas_avg_facch;   /* measurement results for last FACCH */
 	uint16_t		ber10k_facch;	  /* bit error rate for last FACCH */
 
+	uint8_t			dl_facch_bursts;  /* number of remaining DL FACCH bursts */
+
 	/* encryption */
 	int			ul_encr_algo;	/* A5/x encry algo downlink */
 	int			dl_encr_algo;	/* A5/x encry algo uplink */
@@ -272,6 +274,8 @@
 	size_t burst_len;
 };
 
+#define TRX_BR_F_FACCH		(1 << 0)
+
 /*! DL burst request with the corresponding meta info */
 struct trx_dl_burst_req {
 	uint8_t flags;		/*!< see TRX_BR_F_* */
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 6e1e4fb..c69c9dd 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1278,6 +1278,23 @@
 	return func(l1ts, &dbr);
 }
 
+static void trx_sched_acch_overpower(const struct gsm_lchan *lchan,
+				     struct trx_dl_burst_req *br)
+{
+	const struct trx_chan_desc *desc = &trx_chan_desc[br->chan];
+	const uint8_t overpower_db = lchan->bs_acch_overpower_db;
+
+	if (overpower_db == 0)
+		return;
+
+	if (desc->link_id == LID_SACCH || br->flags & TRX_BR_F_FACCH) {
+		if (br->att > overpower_db)
+			br->att -= overpower_db;
+		else
+			br->att = 0;
+	}
+}
+
 /* process downlink burst */
 void _sched_dl_burst(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
 {
@@ -1316,9 +1333,11 @@
 	br->mod = l1cs->dl_mod_type;
 
 	/* BS Power reduction (in dB) per logical channel */
-	if (l1cs->lchan != NULL)
+	if (l1cs->lchan != NULL) {
 		br->att = l1cs->lchan->bs_power_ctrl.current;
-	else /* Ensure no attenuation in the absence of lchan (e.g. on PDCH) */
+		/* Temporary Overpower for SACCH/FACCH bursts */
+		trx_sched_acch_overpower(l1cs->lchan, br);
+	} else /* Ensure no attenuation in the absence of lchan (e.g. on PDCH) */
 		br->att = 0;
 
 	/* encrypt */
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index 8e6298c..d2b39d2 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -544,10 +544,11 @@
 	}
 
 	/* encode bursts (prioritize FACCH) */
-	if (msg_facch)
+	if (msg_facch) {
 		gsm0503_tch_fr_encode(*bursts_p, msg_facch->l2h, msgb_l2len(msg_facch),
 			1);
-	else if (tch_mode == GSM48_CMODE_SPEECH_AMR)
+		chan_state->dl_facch_bursts = 8;
+	} else 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.
 		 */
@@ -574,6 +575,11 @@
 
 	br->burst_len = GSM_BURST_LEN;
 
+	if (chan_state->dl_facch_bursts > 0) {
+		chan_state->dl_facch_bursts--;
+		br->flags |= TRX_BR_F_FACCH;
+	}
+
 	LOGL1SB(DL1P, LOGL_DEBUG, l1ts, br, "Transmitting burst=%u.\n", br->bid);
 
 	return 0;
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index bfebb66..cf0d65d 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -434,6 +434,7 @@
 	if (msg_facch) {
 		gsm0503_tch_hr_encode(*bursts_p, msg_facch->l2h, msgb_l2len(msg_facch));
 		chan_state->dl_ongoing_facch = 1; /* first of two TCH frames */
+		chan_state->dl_facch_bursts = 6;
 	} else if (chan_state->dl_ongoing_facch) /* second of two TCH frames */
 		chan_state->dl_ongoing_facch = 0; /* we are done with FACCH */
 	else if (tch_mode == GSM48_CMODE_SPEECH_AMR)
@@ -463,6 +464,11 @@
 
 	br->burst_len = GSM_BURST_LEN;
 
+	if (chan_state->dl_facch_bursts > 0) {
+		chan_state->dl_facch_bursts--;
+		br->flags |= TRX_BR_F_FACCH;
+	}
+
 	LOGL1SB(DL1P, LOGL_DEBUG, l1ts, br, "Transmitting burst=%u.\n", br->bid);
 
 	return 0;

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ie8a626fefccf1eb07271058e5126ec106cb1abcf
Gerrit-Change-Number: 25284
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210830/c2f61e27/attachment.htm>


More information about the gerrit-log mailing list