aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Klyuchnikov <kluchnikovi@gmail.com>2017-01-26 14:32:37 +0000
committerIvan Kluchnikov <kluchnikovi@gmail.com>2017-02-10 13:35:41 +0000
commite2e0ed5a8962cd465fd5394815af20a46a1d23d2 (patch)
treed4fef9c15d21007606097831e68e189d2cb2e22d
parentd5414cc30e1568ca18d8dd8bd25d3174567327ec (diff)
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
-rw-r--r--include/osmo-bts/phy_link.h9
-rw-r--r--src/osmo-bts-trx/l1_if.c39
-rw-r--r--src/osmo-bts-trx/l1_if.h9
-rw-r--r--src/osmo-bts-trx/main.c1
-rw-r--r--src/osmo-bts-trx/trx_vty.c108
5 files changed, 83 insertions, 83 deletions
diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
index a7963d05..e644a910 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -44,15 +44,6 @@ struct phy_link {
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 a42d39a0..8c5115b8 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -203,17 +203,13 @@ int l1if_provision_transceiver_trx(struct trx_l1h *l1h)
}
/* 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 @@ int l1if_provision_transceiver_trx(struct trx_l1h *l1h)
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 @@ int l1if_provision_transceiver(struct gsm_bts *bts)
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 @@ static uint8_t trx_set_trx(struct gsm_bts_trx *trx)
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 f0b2e67a..1864857c 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -20,6 +20,15 @@ struct trx_config {
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 62e8fe9a..dbd8fc4d 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -117,7 +117,6 @@ void bts_model_phy_link_set_defaults(struct phy_link *plink)
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 ca347e8d..3822b0f7 100644
--- a/src/osmo-bts-trx/trx_vty.c
+++ b/src/osmo-bts-trx/trx_vty.c
@@ -100,6 +100,17 @@ static void show_phy_inst_single(struct vty *vty, struct phy_instance *pinst)
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);
@@ -130,17 +141,6 @@ static void show_phy_single(struct vty *vty, struct phy_link *plink)
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 @@ DEFUN(cfg_phyinst_slotmask, cfg_phyinst_slotmask_cmd,
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 @@ DEFUN(cfg_phy_rts_advance, cfg_phy_rts_advance_cmd,
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 @@ void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink)
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 @@ int bts_model_vty_init(struct gsm_bts *bts)
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);