[MERGED] osmo-bts[master]: osmo-trx-bts: Fix incorrect setting of RXGAIN and POWER para...

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

Ivan Kluchnikov gerrit-no-reply at lists.osmocom.org
Fri Feb 10 13:36:06 UTC 2017


Ivan Kluchnikov has submitted this change and it was merged.

Change subject: osmo-trx-bts: Fix incorrect setting of RXGAIN and POWER parameters on second channel (TRX1) of osmo-trx
......................................................................


osmo-trx-bts: Fix incorrect setting of RXGAIN and POWER parameters on second channel (TRX1) of osmo-trx

Move rxgain and tx-attenuation (power) parameters from phy_link layer to phy_inst layer.
Rxgain and tx-attenuation parameters should be set for each phy_inst and send for each osmo-trx channel accordingly via control commands.

Change-Id: I4861a59d10d1ef91954e0c6ea265e66dec08844f
---
M include/osmo-bts/phy_link.h
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/l1_if.h
M src/osmo-bts-trx/main.c
M src/osmo-bts-trx/trx_vty.c
5 files changed, 83 insertions(+), 83 deletions(-)

Approvals:
  Ivan Kluchnikov: Verified
  Harald Welte: Looks good to me, approved



diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
index a7963d0..e644a91 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -44,15 +44,6 @@
 
 			uint32_t clock_advance;
 			uint32_t rts_advance;
-
-			int	rxgain_valid;
-			int	rxgain;
-			int	rxgain_sent;
-
-			int	power_valid;
-			int	power;
-			int	power_oml;
-			int	power_sent;
 		} osmotrx;
 		struct {
 			/* MAC address of the PHY */
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index a42d39a..8c5115b 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -203,17 +203,13 @@
 		}
 
 		/* after power on */
-		if (l1h->phy_inst->num == 0) {
-			if (plink->u.osmotrx.rxgain_valid &&
-			    !plink->u.osmotrx.rxgain_sent) {
-				trx_if_cmd_setrxgain(l1h, plink->u.osmotrx.rxgain);
-				plink->u.osmotrx.rxgain_sent = 1;
-			}
-			if (plink->u.osmotrx.power_valid &&
-			    !plink->u.osmotrx.power_sent) {
-				trx_if_cmd_setpower(l1h, plink->u.osmotrx.power);
-				plink->u.osmotrx.power_sent = 1;
-			}
+		if (l1h->config.rxgain_valid && !l1h->config.rxgain_sent) {
+			trx_if_cmd_setrxgain(l1h, l1h->config.rxgain);
+			l1h->config.rxgain_sent = 1;
+		}
+		if (l1h->config.power_valid && !l1h->config.power_sent) {
+			trx_if_cmd_setpower(l1h, l1h->config.power);
+			l1h->config.power_sent = 1;
 		}
 		if (l1h->config.maxdly_valid && !l1h->config.maxdly_sent) {
 			trx_if_cmd_setmaxdly(l1h, l1h->config.maxdly);
@@ -238,10 +234,8 @@
 	if (!l1h->config.poweron && !l1h->config.poweron_sent) {
 		trx_if_cmd_poweroff(l1h);
 		l1h->config.poweron_sent = 1;
-		if (l1h->phy_inst->num == 0) {
-			plink->u.osmotrx.rxgain_sent = 0;
-			plink->u.osmotrx.power_sent = 0;
-		}
+		l1h->config.rxgain_sent = 0;
+		l1h->config.power_sent = 0;
 		l1h->config.maxdly_sent = 0;
 		l1h->config.maxdlynb_sent = 0;
 		for (tn = 0; tn < TRX_NR_TS; tn++)
@@ -264,11 +258,10 @@
 		l1h->config.tsc_sent = 0;
 		l1h->config.bsic_sent = 0;
 		l1h->config.poweron_sent = 0;
-		if (l1h->phy_inst->num == 0) {
-			plink->u.osmotrx.rxgain_sent = 0;
-			plink->u.osmotrx.power_sent = 0;
-		}
+		l1h->config.rxgain_sent = 0;
+		l1h->config.power_sent = 0;
 		l1h->config.maxdly_sent = 0;
+		l1h->config.maxdlynb_sent = 0;
 		for (tn = 0; tn < TRX_NR_TS; tn++)
 			l1h->config.slottype_sent[tn] = 0;
 		l1if_provision_transceiver_trx(l1h);
@@ -390,10 +383,10 @@
 		l1if_provision_transceiver_trx(l1h);
 	}
 
-	if (plink->u.osmotrx.power_oml && pinst->num == 0) {
-		plink->u.osmotrx.power = trx->max_power_red;
-		plink->u.osmotrx.power_valid = 1;
-		plink->u.osmotrx.power_sent = 0;
+	if (l1h->config.power_oml) {
+		l1h->config.power = trx->max_power_red;
+		l1h->config.power_valid = 1;
+		l1h->config.power_sent = 0;
 		l1if_provision_transceiver_trx(l1h);
 	}
 
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
index f0b2e67..1864857 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -20,6 +20,15 @@
 	uint8_t			bsic;
 	int			bsic_sent;
 
+	int			rxgain_valid;
+	uint8_t			rxgain;
+	int			rxgain_sent;
+
+	int			power_valid;
+	uint8_t			power;
+	int			power_oml;
+	int			power_sent;
+
 	int			maxdly_valid;
 	int			maxdly;
 	int			maxdly_sent;
diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c
index 62e8fe9..dbd8fc4 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -117,7 +117,6 @@
 	plink->u.osmotrx.base_port_remote = 5700;
 	plink->u.osmotrx.clock_advance = 20;
 	plink->u.osmotrx.rts_advance = 5;
-	plink->u.osmotrx.power_oml = 1;
 }
 
 void bts_model_phy_instance_set_defaults(struct phy_instance *pinst)
diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c
index ca347e8..3822b0f 100644
--- a/src/osmo-bts-trx/trx_vty.c
+++ b/src/osmo-bts-trx/trx_vty.c
@@ -100,6 +100,17 @@
 
 	vty_out(vty, "PHY Instance %s%s",
 		phy_instance_name(pinst), VTY_NEWLINE);
+
+	if (l1h->config.rxgain_valid)
+		vty_out(vty, " rx-gain        : %d dB%s",
+			l1h->config.rxgain, VTY_NEWLINE);
+	else
+		vty_out(vty, " rx-gain        : undefined%s", VTY_NEWLINE);
+	if (l1h->config.power_valid)
+		vty_out(vty, " tx-attenuation : %d dB%s",
+			l1h->config.power, VTY_NEWLINE);
+	else
+		vty_out(vty, " tx-attenuation : undefined%s", VTY_NEWLINE);
 	if (l1h->config.maxdly_valid)
 		vty_out(vty, " maxdly : %d%s", l1h->config.maxdly,
 			VTY_NEWLINE);
@@ -129,17 +140,6 @@
 	struct phy_instance *pinst;
 
 	vty_out(vty, "PHY %u%s", plink->num, VTY_NEWLINE);
-
-	if (plink->u.osmotrx.rxgain_valid)
-		vty_out(vty, " rx-gain        : %d dB%s",
-			plink->u.osmotrx.rxgain, VTY_NEWLINE);
-	else
-		vty_out(vty, " rx-gain        : undefined%s", VTY_NEWLINE);
-	if (plink->u.osmotrx.power_valid)
-		vty_out(vty, " tx-attenuation : %d dB%s",
-			plink->u.osmotrx.power, VTY_NEWLINE);
-	else
-		vty_out(vty, " tx-attenuation : undefined%s", VTY_NEWLINE);
 
 	llist_for_each_entry(pinst, &plink->instances, list)
 		show_phy_inst_single(vty, pinst);
@@ -309,7 +309,7 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(cfg_phy_power_on, cfg_phy_power_on_cmd,
+DEFUN(cfg_phyinst_power_on, cfg_phyinst_power_on_cmd,
 	"osmotrx power (on|off)",
 	OSMOTRX_STR
 	"Change TRX state\n"
@@ -356,70 +356,78 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(cfg_phy_rxgain, cfg_phy_rxgain_cmd,
+DEFUN(cfg_phyinst_rxgain, cfg_phyinst_rxgain_cmd,
 	"osmotrx rx-gain <0-50>",
 	OSMOTRX_STR
 	"Set the receiver gain in dB\n"
 	"Gain in dB\n")
 {
-	struct phy_link *plink = vty->index;
+	struct phy_instance *pinst = vty->index;
+	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
 
-	plink->u.osmotrx.rxgain = atoi(argv[0]);
-	plink->u.osmotrx.rxgain_valid = 1;
-	plink->u.osmotrx.rxgain_sent = 0;
+	l1h->config.rxgain = atoi(argv[0]);
+	l1h->config.rxgain_valid = 1;
+	l1h->config.rxgain_sent = 0;
+	l1if_provision_transceiver_trx(l1h);
 
 	return CMD_SUCCESS;
 }
 
-DEFUN(cfg_phy_tx_atten, cfg_phy_tx_atten_cmd,
+DEFUN(cfg_phyinst_tx_atten, cfg_phyinst_tx_atten_cmd,
 	"osmotrx tx-attenuation <0-50>",
 	OSMOTRX_STR
 	"Set the transmitter attenuation\n"
 	"Fixed attenuation in dB, overriding OML\n")
 {
-	struct phy_link *plink = vty->index;
+	struct phy_instance *pinst = vty->index;
+	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
 
-	plink->u.osmotrx.power = atoi(argv[0]);
-	plink->u.osmotrx.power_oml = 0;
-	plink->u.osmotrx.power_valid = 1;
-	plink->u.osmotrx.power_sent = 0;
+	l1h->config.power = atoi(argv[0]);
+	l1h->config.power_oml = 0;
+	l1h->config.power_valid = 1;
+	l1h->config.power_sent = 0;
+	l1if_provision_transceiver_trx(l1h);
 
 	return CMD_SUCCESS;
 }
 
-DEFUN(cfg_phy_tx_atten_oml, cfg_phy_tx_atten_oml_cmd,
+DEFUN(cfg_phyinst_tx_atten_oml, cfg_phyinst_tx_atten_oml_cmd,
 	"osmotrx tx-attenuation oml",
 	OSMOTRX_STR
 	"Set the transmitter attenuation\n"
 	"Use NM_ATT_RF_MAXPOWR_R (max power reduction) from BSC via OML\n")
 {
-	struct phy_link *plink = vty->index;
+	struct phy_instance *pinst = vty->index;
+	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
 
-	plink->u.osmotrx.power_oml = 1;
-	plink->u.osmotrx.power_valid = 1;
-	plink->u.osmotrx.power_sent = 0;
+	l1h->config.power_oml = 1;
+	l1h->config.power_valid = 1;
+	l1h->config.power_sent = 0;
+	l1if_provision_transceiver_trx(l1h);
 
 	return CMD_SUCCESS;
 }
 
-DEFUN(cfg_phy_no_rxgain, cfg_phy_no_rxgain_cmd,
+DEFUN(cfg_phyinst_no_rxgain, cfg_phyinst_no_rxgain_cmd,
 	"no osmotrx rx-gain",
 	NO_STR OSMOTRX_STR "Unset the receiver gain in dB\n")
 {
-	struct phy_link *plink = vty->index;
+	struct phy_instance *pinst = vty->index;
+	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
 
-	plink->u.osmotrx.rxgain_valid = 0;
+	l1h->config.rxgain_valid = 0;
 
 	return CMD_SUCCESS;
 }
 
-DEFUN(cfg_phy_no_tx_atten, cfg_phy_no_tx_atten_cmd,
+DEFUN(cfg_phyinst_no_tx_atten, cfg_phyinst_no_tx_atten_cmd,
 	"no osmotrx tx-attenuation",
 	NO_STR OSMOTRX_STR "Unset the transmitter attenuation\n")
 {
-	struct phy_link *plink = vty->index;
+	struct phy_instance *pinst = vty->index;
+	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
 
-	plink->u.osmotrx.power_valid = 0;
+	l1h->config.power_valid = 0;
 
 	return CMD_SUCCESS;
 }
@@ -488,22 +496,22 @@
 		plink->u.osmotrx.clock_advance, VTY_NEWLINE);
 	vty_out(vty, " osmotrx rts-advance %d%s",
 		plink->u.osmotrx.rts_advance, VTY_NEWLINE);
-	if (plink->u.osmotrx.rxgain_valid)
-		vty_out(vty, " osmotrx rx-gain %d%s",
-			plink->u.osmotrx.rxgain, VTY_NEWLINE);
-	if (plink->u.osmotrx.power_valid) {
-		if (plink->u.osmotrx.power_oml)
-			vty_out(vty, " osmotrx tx-attenuation oml%s", VTY_NEWLINE);
-		else
-			vty_out(vty, " osmotrx tx-attenuation %d%s",
-				plink->u.osmotrx.power, VTY_NEWLINE);
-	}
 }
 
 void bts_model_config_write_phy_inst(struct vty *vty, struct phy_instance *pinst)
 {
 	struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
 
+	if (l1h->config.rxgain_valid)
+		vty_out(vty, "  osmotrx rx-gain %d%s",
+			l1h->config.rxgain, VTY_NEWLINE);
+	if (l1h->config.power_valid) {
+		if (l1h->config.power_oml)
+			vty_out(vty, "  osmotrx tx-attenuation oml%s", VTY_NEWLINE);
+		else
+			vty_out(vty, "  osmotrx tx-attenuation %d%s",
+				l1h->config.power, VTY_NEWLINE);
+	}
 	if (l1h->config.maxdly_valid)
 		vty_out(vty, "  maxdly %d%s", l1h->config.maxdly, VTY_NEWLINE);
 	if (l1h->config.maxdlynb_valid)
@@ -560,14 +568,14 @@
 	install_element(PHY_NODE, &cfg_phy_fn_advance_cmd);
 	install_element(PHY_NODE, &cfg_phy_rts_advance_cmd);
 	install_element(PHY_NODE, &cfg_phy_transc_ip_cmd);
-	install_element(PHY_NODE, &cfg_phy_rxgain_cmd);
-	install_element(PHY_NODE, &cfg_phy_tx_atten_cmd);
-	install_element(PHY_NODE, &cfg_phy_tx_atten_oml_cmd);
-	install_element(PHY_NODE, &cfg_phy_no_rxgain_cmd);
-	install_element(PHY_NODE, &cfg_phy_no_tx_atten_cmd);
 
+	install_element(PHY_INST_NODE, &cfg_phyinst_rxgain_cmd);
+	install_element(PHY_INST_NODE, &cfg_phyinst_tx_atten_cmd);
+	install_element(PHY_INST_NODE, &cfg_phyinst_tx_atten_oml_cmd);
+	install_element(PHY_INST_NODE, &cfg_phyinst_no_rxgain_cmd);
+	install_element(PHY_INST_NODE, &cfg_phyinst_no_tx_atten_cmd);
 	install_element(PHY_INST_NODE, &cfg_phyinst_slotmask_cmd);
-	install_element(PHY_INST_NODE, &cfg_phy_power_on_cmd);
+	install_element(PHY_INST_NODE, &cfg_phyinst_power_on_cmd);
 	install_element(PHY_INST_NODE, &cfg_phyinst_maxdly_cmd);
 	install_element(PHY_INST_NODE, &cfg_phyinst_no_maxdly_cmd);
 	install_element(PHY_INST_NODE, &cfg_phyinst_maxdlynb_cmd);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4861a59d10d1ef91954e0c6ea265e66dec08844f
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Ivan Kluchnikov <kluchnikovi at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Ivan Kluchnikov <kluchnikovi at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list