Change in osmo-bts[master]: common: tx_power: Fix bug in power ramp up below max-initial value

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

laforge gerrit-no-reply at lists.osmocom.org
Thu Aug 20 06:20:51 UTC 2020


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

Change subject: common: tx_power: Fix bug in power ramp up below max-initial value
......................................................................

common: tx_power: Fix bug in power ramp up below max-initial value

See previous commit adding the unit test about the error description and
expected behavior.

The wrong behavior appeared due to step_size_mdB being unsigned and the
whole addition at the left side of the comparison being turned too as
unsigned, hence a small negative value turning into a big positive
value, and tpp->p_total_cur_mdBm not being updated to speed up the power
ramping.

Change-Id: I36a34362ebc90226fd8e1e190f898c3718fd923a
---
M src/common/tx_power.c
M tests/tx_power/tx_power_test.err
M tests/tx_power/tx_power_test.ok
3 files changed, 1 insertion(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/common/tx_power.c b/src/common/tx_power.c
index c5ea7ed..08c4236 100644
--- a/src/common/tx_power.c
+++ b/src/common/tx_power.c
@@ -278,7 +278,7 @@
 		} else {
 			/* We need to step it up. Start from the current value, shortcutting to max-initial. */
 			/* Set attenuation to cause no power change right now */
-			if (tpp->p_total_cur_mdBm + tpp->ramp.step_size_mdB < tpp->ramp.max_initial_pout_mdBm)
+			if (tpp->p_total_cur_mdBm + (int)tpp->ramp.step_size_mdB < tpp->ramp.max_initial_pout_mdBm)
 				tpp->p_total_cur_mdBm = tpp->ramp.max_initial_pout_mdBm - tpp->ramp.step_size_mdB;
 			tpp->ramp.attenuation_mdB = tpp->p_total_tgt_mdBm - tpp->p_total_cur_mdBm;
 
diff --git a/tests/tx_power/tx_power_test.err b/tests/tx_power/tx_power_test.err
index 3ef12c9..72a3d85 100644
--- a/tests/tx_power/tx_power_test.err
+++ b/tests/tx_power/tx_power_test.err
@@ -36,14 +36,6 @@
 (bts=0,trx=1) ramp_timer_cb(cur_pout=33000, tgt_pout=33000, ramp_att=0, therm_att=0, user_gain=0)
 (bts=0,trx=1) ramping TRX board output power to 23000 mdBm.
 (bts=0,trx=1) power_ramp_start(cur=-10000, tgt=10000)
-(bts=0,trx=1) ramp_timer_cb(cur_pout=-8000, tgt_pout=10000, ramp_att=18000, therm_att=0, user_gain=0)
-(bts=0,trx=1) ramping TRX board output power to -8000 mdBm.
-(bts=0,trx=1) ramp_timer_cb(cur_pout=-6000, tgt_pout=10000, ramp_att=16000, therm_att=0, user_gain=0)
-(bts=0,trx=1) ramping TRX board output power to -6000 mdBm.
-(bts=0,trx=1) ramp_timer_cb(cur_pout=-4000, tgt_pout=10000, ramp_att=14000, therm_att=0, user_gain=0)
-(bts=0,trx=1) ramping TRX board output power to -4000 mdBm.
-(bts=0,trx=1) ramp_timer_cb(cur_pout=-2000, tgt_pout=10000, ramp_att=12000, therm_att=0, user_gain=0)
-(bts=0,trx=1) ramping TRX board output power to -2000 mdBm.
 (bts=0,trx=1) ramp_timer_cb(cur_pout=0, tgt_pout=10000, ramp_att=10000, therm_att=0, user_gain=0)
 (bts=0,trx=1) ramping TRX board output power to 0 mdBm.
 (bts=0,trx=1) ramp_timer_cb(cur_pout=2000, tgt_pout=10000, ramp_att=8000, therm_att=0, user_gain=0)
diff --git a/tests/tx_power/tx_power_test.ok b/tests/tx_power/tx_power_test.ok
index ec3ea61..c8f0441 100644
--- a/tests/tx_power/tx_power_test.ok
+++ b/tests/tx_power/tx_power_test.ok
@@ -23,10 +23,6 @@
 CHANGE_POWER(23000)
 power_ramp finished
 Testing tx_power ramping for osmo-bts-trx after lock
-CHANGE_POWER(-8000)
-CHANGE_POWER(-6000)
-CHANGE_POWER(-4000)
-CHANGE_POWER(-2000)
 CHANGE_POWER(0)
 CHANGE_POWER(2000)
 CHANGE_POWER(4000)

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I36a34362ebc90226fd8e1e190f898c3718fd923a
Gerrit-Change-Number: 19703
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200820/62455107/attachment.htm>


More information about the gerrit-log mailing list