Change in osmo-bts[master]: tx_power: Support controlling BTS with nominal tx pwr < 0dBm

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

pespin gerrit-no-reply at lists.osmocom.org
Fri Jun 19 15:20:12 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/18916 )


Change subject: tx_power: Support controlling BTS with nominal tx pwr < 0dBm
......................................................................

tx_power: Support controlling BTS with nominal tx pwr < 0dBm

Change-Id: I88d59d47837105d52e2b4dfb819511cd360c50a1
---
M src/common/tx_power.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/l1_if.h
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-trx/trx_if.h
5 files changed, 12 insertions(+), 9 deletions(-)



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

diff --git a/src/common/tx_power.c b/src/common/tx_power.c
index b0c959f..e7f7eb3 100644
--- a/src/common/tx_power.c
+++ b/src/common/tx_power.c
@@ -196,8 +196,8 @@
 	/* for now we simply write an error message, but in the future
 	 * we might use the value (again) as part of our math? */
 	if (p_trxout_cur_mdBm != p_trxout_should_mdBm) {
-		LOGPTRX(trx, DL1C, LOGL_ERROR, "bts_model notifies us of %u mdBm TRX "
-			"output power.  However, it should be %u mdBm!\n",
+		LOGPTRX(trx, DL1C, LOGL_ERROR, "bts_model notifies us of %d mdBm TRX "
+			"output power.  However, it should be %d mdBm!\n",
 			p_trxout_cur_mdBm, p_trxout_should_mdBm);
 	}
 
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 07f6e7a..1cc1e91 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -150,13 +150,16 @@
 }
 
 /* Sets the nominal power, in dB */
-void l1if_trx_set_nominal_power(struct gsm_bts_trx *trx, unsigned int nominal_power)
+void l1if_trx_set_nominal_power(struct gsm_bts_trx *trx, int nominal_power)
 {
 	struct phy_instance *pinst = trx_phy_instance(trx);
 	bool nom_pwr_changed = trx->nominal_power != nominal_power;
 
 	trx->nominal_power = nominal_power;
 	trx->power_params.trx_p_max_out_mdBm = to_mdB(nominal_power);
+	/* If we receive ultra-low  nominal Tx power (<0dBm), make sure to update where we are */
+	trx->power_params.p_total_cur_mdBm = OSMO_MIN(trx->power_params.p_total_cur_mdBm,
+						      trx->power_params.trx_p_max_out_mdBm);
 
 	/* If TRX is not yet powered, delay ramping until it's ON */
 	if (!nom_pwr_changed || !pinst->phy_link->u.osmotrx.powered)
@@ -168,12 +171,12 @@
 	l1if_trx_start_power_ramp(trx);
 }
 
-static void l1if_getnompower_cb(struct trx_l1h *l1h, unsigned int nominal_power, int rc)
+static void l1if_getnompower_cb(struct trx_l1h *l1h, int nominal_power, int rc)
 {
 	struct phy_instance *pinst = l1h->phy_inst;
 	struct gsm_bts_trx *trx = pinst->trx;
 
-	LOGPPHI(pinst, DL1C, LOGL_DEBUG, "l1if_getnompower_cb(nominal_power=%u, rc=%d)\n", nominal_power, rc);
+	LOGPPHI(pinst, DL1C, LOGL_NOTICE, "l1if_getnompower_cb(nominal_power=%d, rc=%d)\n", nominal_power, rc);
 
 	l1if_trx_set_nominal_power(trx, nominal_power);
 }
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
index 5f51acb..3fda726 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -114,7 +114,7 @@
 int l1if_provision_transceiver_trx(struct trx_l1h *l1h);
 int l1if_provision_transceiver(struct gsm_bts *bts);
 int l1if_mph_time_ind(struct gsm_bts *bts, uint32_t fn);
-void l1if_trx_set_nominal_power(struct gsm_bts_trx *trx, unsigned int nominal_power);
+void l1if_trx_set_nominal_power(struct gsm_bts_trx *trx, int nominal_power);
 
 static inline struct l1sched_trx *trx_l1sched_hdl(struct gsm_bts_trx *trx)
 {
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 1953f71..3502fbd 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -554,13 +554,13 @@
 {
 	trx_if_cmd_getnompower_cb *cb = (trx_if_cmd_getnompower_cb*) rsp->cb;
 	struct phy_instance *pinst = l1h->phy_inst;
-	unsigned int nominal_power;
+	int nominal_power;
 
 	if (rsp->status)
 		LOGPPHI(pinst, DTRX, LOGL_ERROR, "transceiver NOMTXPOWER failed with status %d\n",
 			rsp->status);
 	if (cb) {
-		sscanf(rsp->params, "%u", &nominal_power);
+		sscanf(rsp->params, "%d", &nominal_power);
 		cb(l1h, nominal_power, rsp->status);
 	}
 	return 0;
diff --git a/src/osmo-bts-trx/trx_if.h b/src/osmo-bts-trx/trx_if.h
index 16b6c76..b2fc326 100644
--- a/src/osmo-bts-trx/trx_if.h
+++ b/src/osmo-bts-trx/trx_if.h
@@ -16,7 +16,7 @@
 
 typedef void trx_if_cmd_poweronoff_cb(struct trx_l1h *l1h, bool poweronoff, int rc);
 typedef void trx_if_cmd_setslot_cb(struct trx_l1h *l1h, uint8_t tn, uint8_t type, int rc);
-typedef void trx_if_cmd_getnompower_cb(struct trx_l1h *l1h, unsigned int nominal_power, int rc);
+typedef void trx_if_cmd_getnompower_cb(struct trx_l1h *l1h, int nominal_power, int rc);
 typedef void trx_if_cmd_setpower_att_cb(struct trx_l1h *l1h, int power_att_db, int rc);
 
 void trx_if_init(struct trx_l1h *l1h);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I88d59d47837105d52e2b4dfb819511cd360c50a1
Gerrit-Change-Number: 18916
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200619/839eb017/attachment.htm>


More information about the gerrit-log mailing list