aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-05-29 13:29:00 +0200
committerlaforge <laforge@osmocom.org>2020-06-03 17:33:14 +0000
commitdbc837206431dc1ef7fe1f2d245a975c92c727a2 (patch)
tree009f2a0689962600f51a6c59ec4f6d60bfde9040
parent9daa67d0e7f3294918aa632d0a6eb237b2cd87f8 (diff)
bts-trx: vty: Add 'nominal-tx-power' cmd
This value will be soon acquired automatically by osmo-bts-trx by asking over TRXC to new versions of osmo-trx which is the nominal tx power for a given trx. However, to still be able to work correctly against older versions of osmo-trx or other TRX implementation (older or current) not supporting this new TRX comamnd, let's allow the user to force a given value through VTY for Tx power to work correctly. Change-Id: Ib1b6f80d3b54afc42db9d358a79582cc619c6ce4
-rw-r--r--src/osmo-bts-trx/l1_if.h2
-rw-r--r--src/osmo-bts-trx/main.c6
-rw-r--r--src/osmo-bts-trx/trx_vty.c39
3 files changed, 45 insertions, 2 deletions
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
index 73709995..42452d24 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -78,6 +78,8 @@ struct trx_config {
int power_oml;
int power_sent;
+ bool nominal_power_set_by_vty; /* whether nominal trx power was enforced/retreived from VTY config "nominal-tx-power" */
+
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 ab0472e7..3c1c8927 100644
--- a/src/osmo-bts-trx/main.c
+++ b/src/osmo-bts-trx/main.c
@@ -104,8 +104,10 @@ int bts_model_init(struct gsm_bts *bts)
bts->variant = BTS_OSMO_TRX;
bts->support.ciphers = CIPHER_A5(1) | CIPHER_A5(2) | CIPHER_A5(3);
- /* FIXME: this needs to be overridden with the real hardrware
- * value */
+ /* The nominal value is later overwritten through VTY cmd
+ * 'nominal-tx-power' if present.
+ * FIXME: In the future, we want osmo-trx to provide us with this info
+ * through TRXC. */
bts->c0->nominal_power = 23;
gsm_bts_set_feature(bts, BTS_FEAT_GPRS);
diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c
index 9c67a7f0..6dddfe20 100644
--- a/src/osmo-bts-trx/trx_vty.c
+++ b/src/osmo-bts-trx/trx_vty.c
@@ -160,6 +160,36 @@ DEFUN(show_phy, show_phy_cmd, "show phy",
return CMD_SUCCESS;
}
+DEFUN(cfg_trx_nominal_power, cfg_trx_nominal_power_cmd,
+ "nominal-tx-power <-10-100>",
+ "Manually set (force) the nominal transmit output power in dBm\n"
+ "Nominal transmit output power level in dBm\n")
+{
+ struct gsm_bts_trx *trx = vty->index;
+ struct phy_instance *pinst = trx_phy_instance(trx);
+ struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
+ int val = atoi(argv[0]);
+
+ trx->nominal_power = val;
+ l1h->config.nominal_power_set_by_vty = true;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_trx_no_nominal_power, cfg_trx_no_nominal_power_cmd,
+ "no nominal-tx-power",
+ NO_STR
+ "Manually set (force) the nominal transmit output power; ask the TRX instead (default)\n")
+{
+ struct gsm_bts_trx *trx = vty->index;
+ struct phy_instance *pinst = trx_phy_instance(trx);
+ struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
+
+ l1h->config.nominal_power_set_by_vty = false;
+
+ return CMD_SUCCESS;
+}
+
DEFUN_DEPRECATED(cfg_phy_ms_power_loop, cfg_phy_ms_power_loop_cmd,
"osmotrx ms-power-loop <-127-127>", OSMOTRX_STR
"Enable MS power control loop\nTarget RSSI value (transceiver specific, "
@@ -574,6 +604,12 @@ void bts_model_config_write_bts(struct vty *vty, struct gsm_bts *bts)
void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx)
{
+ struct phy_instance *pinst = trx_phy_instance(trx);
+ struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
+
+ if (l1h->config.nominal_power_set_by_vty)
+ vty_out(vty, " nominal-tx-power %d%s", trx->nominal_power,
+ VTY_NEWLINE);
}
int bts_model_vty_init(struct gsm_bts *bts)
@@ -583,6 +619,9 @@ int bts_model_vty_init(struct gsm_bts *bts)
install_element_ve(&show_transceiver_cmd);
install_element_ve(&show_phy_cmd);
+ install_element(TRX_NODE, &cfg_trx_nominal_power_cmd);
+ install_element(TRX_NODE, &cfg_trx_no_nominal_power_cmd);
+
install_element(PHY_NODE, &cfg_phy_ms_power_loop_cmd);
install_element(PHY_NODE, &cfg_phy_no_ms_power_loop_cmd);
install_element(PHY_NODE, &cfg_phy_timing_advance_loop_cmd);