[PATCH] osmo-bts[master]: osmo-bts-trx: Fix MS power control loop.

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/.

Alexander Chemeris gerrit-no-reply at lists.osmocom.org
Fri Aug 18 23:06:50 UTC 2017


Review at  https://gerrit.osmocom.org/3560

osmo-bts-trx: Fix MS power control loop.

The following two commits from 2014-12-06 introduced a new variable to control
MS power - ms_power_ctrl, but kept the old ms_power variable in place. They
have also changed the meaning of the ms_power variable - it now keeps original
RSL configured value. So when much later osmo-trx-bts code was merged to master
the code was compiling fine and this change in the meaning was overlooked.

In osmo-bts:
579651bf300de002731dfd3bd39985c9fd15616c power/sysmobts: Add a manual ms power level control
In OpenBSC:
f6f86b0eec18da165db136b14bf2db87fde4b4ac osmo-bts: Introduce new struct for a power loop in the BTS code

Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1
---
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/loops.c
2 files changed, 12 insertions(+), 12 deletions(-)


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

diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index f69e587..c629a61 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -509,7 +509,7 @@
 
 	LOGP(DMEAS, LOGL_DEBUG, "RX L1 frame %s fn=%u chan_nr=0x%02x MS pwr=%ddBm rssi=%.1f dBFS "
 		"ber=%.2f%% (%d/%d bits) L1_ta=%d rqd_ta=%d toa=%.2f\n",
-		gsm_lchan_name(lchan), fn, chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
+		gsm_lchan_name(lchan), fn, chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.current),
 		rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], lchan->rqd_ta, toa);
 
 	l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi, fn);
diff --git a/src/osmo-bts-trx/loops.c b/src/osmo-bts-trx/loops.c
index 8070e80..8d6e5d7 100644
--- a/src/osmo-bts-trx/loops.c
+++ b/src/osmo-bts-trx/loops.c
@@ -48,7 +48,7 @@
 	uint16_t arfcn = trx->arfcn;
 	int8_t new_power;
 
-	new_power = lchan->ms_power - (diff >> 1);
+	new_power = lchan->ms_power_ctrl.current - (diff >> 1);
 
 	if (diff == 0)
 		return 0;
@@ -66,12 +66,12 @@
 	}
 
 	/* a higher value means a lower level (and vice versa) */
-	if (new_power > lchan->ms_power + MS_LOWER_MAX)
-		new_power = lchan->ms_power + MS_LOWER_MAX;
-	else if (new_power < lchan->ms_power - MS_RAISE_MAX)
-		new_power = lchan->ms_power - MS_RAISE_MAX;
+	if (new_power > lchan->ms_power_ctrl.current + MS_LOWER_MAX)
+		new_power = lchan->ms_power_ctrl.current + MS_LOWER_MAX;
+	else if (new_power < lchan->ms_power_ctrl.current - MS_RAISE_MAX)
+		new_power = lchan->ms_power_ctrl.current - MS_RAISE_MAX;
 
-	if (lchan->ms_power == new_power) {
+	if (lchan->ms_power_ctrl.current == new_power) {
 		LOGP(DLOOP, LOGL_INFO, "Keeping MS new_power of trx=%u "
 			"chan_nr=0x%02x at control level %d (%d dBm)\n",
 			trx->nr, chan_nr, new_power,
@@ -83,11 +83,11 @@
 	LOGP(DLOOP, LOGL_INFO, "%s MS new_power of trx=%u chan_nr=0x%02x from "
 		"control level %d (%d dBm) to %d (%d dBm)\n",
 		(diff > 0) ? "Raising" : "Lowering",
-		trx->nr, chan_nr, lchan->ms_power,
-		MS_PWR_DBM(arfcn, lchan->ms_power), new_power,
+		trx->nr, chan_nr, lchan->ms_power_ctrl.current,
+		MS_PWR_DBM(arfcn, lchan->ms_power_ctrl.current), new_power,
 		MS_PWR_DBM(arfcn, new_power));
 
-	lchan->ms_power = new_power;
+	lchan->ms_power_ctrl.current = new_power;
 
 	return 0;
 }
@@ -159,8 +159,8 @@
 	/* change RSSI */
 	LOGP(DLOOP, LOGL_DEBUG, "Lowest RSSI: %d Target RSSI: %d Current "
 		"MS power: %d (%d dBm) of trx=%u chan_nr=0x%02x\n", rssi,
-		trx_target_rssi, lchan->ms_power,
-		MS_PWR_DBM(trx->arfcn, lchan->ms_power),
+		trx_target_rssi, lchan->ms_power_ctrl.current,
+		MS_PWR_DBM(trx->arfcn, lchan->ms_power_ctrl.current),
 		trx->nr, chan_nr);
 	ms_power_diff(lchan, chan_nr, trx_target_rssi - rssi);
 

-- 
To view, visit https://gerrit.osmocom.org/3560
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Alexander Chemeris <Alexander.Chemeris at gmail.com>



More information about the gerrit-log mailing list