aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx/trx_vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo-bts-trx/trx_vty.c')
-rw-r--r--src/osmo-bts-trx/trx_vty.c433
1 files changed, 250 insertions, 183 deletions
diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c
index c52908e0..9056f027 100644
--- a/src/osmo-bts-trx/trx_vty.c
+++ b/src/osmo-bts-trx/trx_vty.c
@@ -1,4 +1,4 @@
-/* VTY interface for sysmoBTS */
+/* VTY interface for osmo-bts-trx */
/* (C) 2013 by Andreas Eversberg <jolly@eversberg.eu>
*
@@ -42,37 +42,35 @@
#include <osmo-bts/logging.h>
#include <osmo-bts/vty.h>
#include <osmo-bts/scheduler.h>
+#include <osmo-bts/bts.h>
#include "l1_if.h"
#include "trx_if.h"
-#include "loops.h"
+#include "amr_loop.h"
-#define OSMOTRX_STR "OsmoTRX Transceiver configuration\n"
+#define X(x) (1 << x)
-static struct gsm_bts *vty_bts;
+#define OSMOTRX_STR "OsmoTRX Transceiver configuration\n"
DEFUN(show_transceiver, show_transceiver_cmd, "show transceiver",
SHOW_STR "Display information about transceivers\n")
{
- struct gsm_bts *bts = vty_bts;
struct gsm_bts_trx *trx;
struct trx_l1h *l1h;
+ unsigned int tn;
- if (!transceiver_available) {
- vty_out(vty, "transceiver is not connected%s", VTY_NEWLINE);
- } else {
- vty_out(vty, "transceiver is connected%s", VTY_NEWLINE);
- }
-
- llist_for_each_entry(trx, &bts->trx_list, list) {
+ llist_for_each_entry(trx, &g_bts->trx_list, list) {
struct phy_instance *pinst = trx_phy_instance(trx);
- char *sname = osmo_sock_get_name(NULL, pinst->phy_link->u.osmotrx.trx_ofd_clk.fd);
+ struct phy_link *plink = pinst->phy_link;
+ char *sname = osmo_sock_get_name(NULL, plink->u.osmotrx.trx_ofd_clk.fd);
l1h = pinst->u.osmotrx.hdl;
vty_out(vty, "TRX %d %s%s", trx->nr, sname, VTY_NEWLINE);
talloc_free(sname);
vty_out(vty, " %s%s",
- (l1h->config.poweron) ? "poweron":"poweroff",
+ trx_if_powered(l1h) ? "poweron":"poweroff",
VTY_NEWLINE);
+ vty_out(vty, "phy link state: %s%s",
+ phy_link_state_name(phy_link_state_get(plink)), VTY_NEWLINE);
if (l1h->config.arfcn_valid)
vty_out(vty, " arfcn : %d%s%s",
(l1h->config.arfcn & ~ARFCN_PCS),
@@ -89,7 +87,28 @@ DEFUN(show_transceiver, show_transceiver_cmd, "show transceiver",
vty_out(vty, " bsic : %d%s", l1h->config.bsic,
VTY_NEWLINE);
else
- vty_out(vty, " bisc : undefined%s", VTY_NEWLINE);
+ vty_out(vty, " bsic : undefined%s", VTY_NEWLINE);
+
+ /* trx->ts[tn].priv is NULL in absence of the A-bis connection */
+ if (trx->bb_transc.rsl.link == NULL)
+ continue;
+
+ for (tn = 0; tn < ARRAY_SIZE(trx->ts); tn++) {
+ const struct gsm_bts_trx_ts *ts = &trx->ts[tn];
+ const struct l1sched_ts *l1ts = ts->priv;
+ const struct trx_sched_multiframe *mf;
+
+ OSMO_ASSERT(l1ts != NULL);
+ mf = &trx_sched_multiframes[l1ts->mf_index];
+
+ vty_out(vty, " timeslot #%u (%s)%s",
+ tn, mf->name, VTY_NEWLINE);
+ vty_out(vty, " pending DL prims : %u%s",
+ llist_count(&l1ts->dl_prims), VTY_NEWLINE);
+ vty_out(vty, " interference : %ddBm%s",
+ l1ts->chan_state[TRXC_IDLE].meas.interf_avg,
+ VTY_NEWLINE);
+ }
}
return CMD_SUCCESS;
@@ -100,20 +119,25 @@ static void show_phy_inst_single(struct vty *vty, struct phy_instance *pinst)
{
uint8_t tn;
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
+ struct gsm_bts_trx *trx = pinst->trx;
- vty_out(vty, "PHY Instance %s%s",
- phy_instance_name(pinst), VTY_NEWLINE);
+ vty_out(vty, "PHY Instance '%s': bound to %s%s",
+ phy_instance_name(pinst),
+ gsm_trx_name(trx),
+ VTY_NEWLINE);
+
+ if (trx != NULL) {
+ const int actual = get_p_actual_mdBm(trx, trx->power_params.p_total_tgt_mdBm);
+ const int max = get_p_max_out_mdBm(trx);
+ vty_out(vty, " tx-attenuation : %d dB%s",
+ (max - actual) / 1000, 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);
@@ -125,16 +149,23 @@ static void show_phy_inst_single(struct vty *vty, struct phy_instance *pinst)
else
vty_out(vty, " maxdlynb : undefined%s", VTY_NEWLINE);
for (tn = 0; tn < TRX_NR_TS; tn++) {
- if (!((1 << tn) & l1h->config.slotmask))
+ if (!((1 << tn) & l1h->config.slotmask)) {
vty_out(vty, " slot #%d: unsupported%s", tn,
VTY_NEWLINE);
- else if (l1h->config.slottype_valid[tn])
- vty_out(vty, " slot #%d: type %d%s", tn,
- l1h->config.slottype[tn],
- VTY_NEWLINE);
- else
+ continue;
+ } else if (!l1h->config.setslot_valid[tn]) {
vty_out(vty, " slot #%d: undefined%s", tn,
VTY_NEWLINE);
+ continue;
+ }
+
+ vty_out(vty, " slot #%d: type %d", tn,
+ l1h->config.setslot[tn].slottype);
+ if (l1h->config.setslot[tn].tsc_valid)
+ vty_out(vty, " TSC-s%dc%d",
+ l1h->config.setslot[tn].tsc_set,
+ l1h->config.setslot[tn].tsc_val);
+ vty_out(vty, "%s", VTY_NEWLINE);
}
}
@@ -163,96 +194,146 @@ DEFUN(show_phy, show_phy_cmd, "show phy",
return CMD_SUCCESS;
}
-DEFUN(cfg_phy_ms_power_loop, cfg_phy_ms_power_loop_cmd,
+DEFUN_HIDDEN(test_send_trxc,
+ test_send_trxc_cmd,
+ "test send-trxc-cmd <0-255> CMD [.ARGS]",
+ "Various testing commands\n"
+ "Send an arbitrary TRX command\n"
+ "Transceiver number\n"
+ "TRXC command\n" "TRXC command arguments\n")
+{
+ const struct gsm_bts_trx *trx;
+ const struct phy_instance *pinst;
+ struct trx_l1h *l1h;
+ int rc;
+
+ trx = gsm_bts_trx_num(g_bts, atoi(argv[0]));
+ if (trx == NULL) {
+ vty_out(vty, "%% Could not find TRX%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ pinst = trx_phy_instance(trx);
+ l1h = pinst->u.osmotrx.hdl;
+
+ if (argc > 2) {
+ char *cmd_args = argv_concat(argv, argc, 2);
+ rc = trx_ctrl_cmd(l1h, 0, argv[1], "%s", cmd_args);
+ talloc_free(cmd_args);
+ } else {
+ rc = trx_ctrl_cmd(l1h, 0, argv[1], "");
+ }
+
+ return (rc == 0) ? CMD_SUCCESS : CMD_WARNING;
+}
+
+DEFUN_USRATTR(cfg_trx_nominal_power, cfg_trx_nominal_power_cmd,
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "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]);
+
+ l1if_trx_set_nominal_power(trx, val);
+ l1h->config.nominal_power_set_by_vty = true;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN_USRATTR(cfg_trx_no_nominal_power, cfg_trx_no_nominal_power_cmd,
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "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, "
"should be 6dB or more above noise floor)\n")
{
- struct phy_link *plink = vty->index;
+ vty_out(vty, "'%s' is deprecated, MS Power Control is now managed by BSC%s",
+ self->string, VTY_NEWLINE);
- plink->u.osmotrx.trx_target_rssi = atoi(argv[0]);
- plink->u.osmotrx.trx_ms_power_loop = true;
+ uint8_t rxlev = dbm2rxlev(atoi(argv[0]));
+ g_bts->ms_dpc_params.rxlev_meas.lower_thresh = rxlev;
+ g_bts->ms_dpc_params.rxlev_meas.upper_thresh = rxlev;
return CMD_SUCCESS;
}
-DEFUN(cfg_phy_no_ms_power_loop, cfg_phy_no_ms_power_loop_cmd,
+DEFUN_DEPRECATED(cfg_phy_no_ms_power_loop, cfg_phy_no_ms_power_loop_cmd,
"no osmotrx ms-power-loop",
NO_STR OSMOTRX_STR "Disable MS power control loop\n")
{
- struct phy_link *plink = vty->index;
-
- plink->u.osmotrx.trx_ms_power_loop = false;
+ vty_out(vty, "'%s' is deprecated, MS Power Control is now managed by BSC%s",
+ self->string, VTY_NEWLINE);
return CMD_SUCCESS;
}
-DEFUN(cfg_phy_timing_advance_loop, cfg_phy_timing_advance_loop_cmd,
+DEFUN_DEPRECATED(cfg_phy_timing_advance_loop, cfg_phy_timing_advance_loop_cmd,
"osmotrx timing-advance-loop", OSMOTRX_STR
"Enable timing advance control loop\n")
{
- struct phy_link *plink = vty->index;
-
- plink->u.osmotrx.trx_ta_loop = true;
+ vty_out(vty, "'%s' is deprecated, Timing Advance loop is now active by default%s",
+ self->string, VTY_NEWLINE);
return CMD_SUCCESS;
}
-DEFUN(cfg_phy_no_timing_advance_loop, cfg_phy_no_timing_advance_loop_cmd,
+DEFUN_DEPRECATED(cfg_phy_no_timing_advance_loop, cfg_phy_no_timing_advance_loop_cmd,
"no osmotrx timing-advance-loop",
NO_STR OSMOTRX_STR "Disable timing advance control loop\n")
{
- struct phy_link *plink = vty->index;
-
- plink->u.osmotrx.trx_ta_loop = false;
+ vty_out(vty, "'%s' is deprecated, Timing Advance loop is now active by default%s",
+ self->string, VTY_NEWLINE);
return CMD_SUCCESS;
}
-DEFUN(cfg_phyinst_maxdly, cfg_phyinst_maxdly_cmd,
- "osmotrx maxdly <0-31>",
- OSMOTRX_STR
- "Set the maximum acceptable delay of an Access Burst (in GSM symbols)."
- " Access Burst is the first burst a mobile transmits in order to establish"
- " a connection and it is used to estimate Timing Advance (TA) which is"
- " then applied to Normal Bursts to compensate for signal delay due to"
- " distance. So changing this setting effectively changes maximum range of"
- " the cell, because if we receive an Access Burst with a delay higher than"
- " this value, it will be ignored and connection is dropped.\n"
- "GSM symbols (approx. 1.1km per symbol)\n")
+DEFUN_USRATTR(cfg_phyinst_maxdly, cfg_phyinst_maxdly_cmd,
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "osmotrx maxdly <0-63>",
+ OSMOTRX_STR
+ "Set the maximum acceptable delay of an Access Burst\n"
+ "Delay in GSMK symbol periods (approx. 550m per symbol)\n")
{
struct phy_instance *pinst = vty->index;
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
l1h->config.maxdly = atoi(argv[0]);
l1h->config.maxdly_valid = 1;
- l1h->config.maxdly_sent = 0;
- l1if_provision_transceiver_trx(l1h);
+ l1h->config.maxdly_sent = false;
return CMD_SUCCESS;
}
-
-DEFUN(cfg_phyinst_maxdlynb, cfg_phyinst_maxdlynb_cmd,
- "osmotrx maxdlynb <0-31>",
- OSMOTRX_STR
- "Set the maximum acceptable delay of a Normal Burst (in GSM symbols)."
- " USE FOR TESTING ONLY, DON'T CHANGE IN PRODUCTION USE!"
- " During normal operation, Normal Bursts delay are controlled by a Timing"
- " Advance control loop and thus Normal Bursts arrive to a BTS with no more"
- " than a couple GSM symbols, which is already taken into account in osmo-trx."
- " So changing this setting will have no effect in production installations"
- " except increasing osmo-trx CPU load. This setting is only useful when"
- " testing with a transmitter which can't precisely synchronize to the BTS"
- " downlink signal, like e.g. R&S CMD57.\n"
- "GSM symbols (approx. 1.1km per symbol)\n")
+DEFUN_ATTR_USRATTR(cfg_phyinst_maxdlynb, cfg_phyinst_maxdlynb_cmd,
+ CMD_ATTR_HIDDEN, /* expert mode command */
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "osmotrx maxdlynb <0-63>",
+ OSMOTRX_STR
+ "Set the maximum acceptable delay of a Normal Burst\n"
+ "Delay in GMSK symbol periods (approx. 550m per symbol)\n")
{
struct phy_instance *pinst = vty->index;
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
l1h->config.maxdlynb = atoi(argv[0]);
l1h->config.maxdlynb_valid = 1;
- l1h->config.maxdlynb_sent = 0;
- l1if_provision_transceiver_trx(l1h);
+ l1h->config.maxdlynb_sent = false;
return CMD_SUCCESS;
}
@@ -277,7 +358,7 @@ DEFUN(cfg_phyinst_slotmask, cfg_phyinst_slotmask_cmd,
return CMD_SUCCESS;
}
-DEFUN(cfg_phyinst_power_on, cfg_phyinst_power_on_cmd,
+DEFUN_DEPRECATED(cfg_phyinst_power_on, cfg_phyinst_power_on_cmd,
"osmotrx power (on|off)",
OSMOTRX_STR
"Change TRX state\n"
@@ -286,21 +367,26 @@ DEFUN(cfg_phyinst_power_on, cfg_phyinst_power_on_cmd,
struct phy_instance *pinst = vty->index;
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
+ vty_out (vty, "'osmotrx power' is deprecated, use OML's standard "
+ "Administrative State instead to control each TRX "
+ "('rf_locked' VTY cmd in osmo-bsc)%s", VTY_NEWLINE);
+
if (strcmp(argv[0], "on"))
- vty_out(vty, "OFF: %d%s", trx_if_cmd_poweroff(l1h), VTY_NEWLINE);
+ vty_out(vty, "OFF: %d%s", trx_if_cmd_poweroff(l1h, NULL), VTY_NEWLINE);
else {
- vty_out(vty, "ON: %d%s", trx_if_cmd_poweron(l1h), VTY_NEWLINE);
+ vty_out(vty, "ON: %d%s", trx_if_cmd_poweron(l1h, NULL), VTY_NEWLINE);
}
return CMD_SUCCESS;
}
-DEFUN(cfg_phy_fn_advance, cfg_phy_fn_advance_cmd,
- "osmotrx fn-advance <0-30>",
- OSMOTRX_STR
- "Set the number of frames to be transmitted to transceiver in advance "
- "of current FN\n"
- "Advance in frames\n")
+DEFUN_ATTR(cfg_phy_fn_advance, cfg_phy_fn_advance_cmd,
+ "osmotrx fn-advance <0-30>",
+ OSMOTRX_STR
+ "Set the number of frames to be transmitted to transceiver in advance "
+ "of current FN\n"
+ "Advance in frames\n",
+ CMD_ATTR_IMMEDIATE)
{
struct phy_link *plink = vty->index;
@@ -309,12 +395,13 @@ DEFUN(cfg_phy_fn_advance, cfg_phy_fn_advance_cmd,
return CMD_SUCCESS;
}
-DEFUN(cfg_phy_rts_advance, cfg_phy_rts_advance_cmd,
- "osmotrx rts-advance <0-30>",
- OSMOTRX_STR
- "Set the number of frames to be requested (PCU) in advance of current "
- "FN. Do not change this, unless you have a good reason!\n"
- "Advance in frames\n")
+DEFUN_ATTR(cfg_phy_rts_advance, cfg_phy_rts_advance_cmd,
+ "osmotrx rts-advance <0-30>",
+ OSMOTRX_STR
+ "Set the number of frames to be requested (PCU) in advance of current "
+ "FN. Do not change this, unless you have a good reason!\n"
+ "Advance in frames\n",
+ CMD_ATTR_IMMEDIATE)
{
struct phy_link *plink = vty->index;
@@ -323,61 +410,49 @@ DEFUN(cfg_phy_rts_advance, cfg_phy_rts_advance_cmd,
return CMD_SUCCESS;
}
-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")
+DEFUN_USRATTR(cfg_phyinst_rxgain, cfg_phyinst_rxgain_cmd,
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "osmotrx rx-gain <0-50>",
+ OSMOTRX_STR
+ "Set the receiver gain in dB\n"
+ "Gain in dB\n")
{
struct phy_instance *pinst = vty->index;
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
l1h->config.rxgain = atoi(argv[0]);
l1h->config.rxgain_valid = 1;
- l1h->config.rxgain_sent = 0;
- l1if_provision_transceiver_trx(l1h);
+ l1h->config.rxgain_sent = false;
return CMD_SUCCESS;
}
-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")
+DEFUN_ATTR(cfg_phyinst_tx_atten, cfg_phyinst_tx_atten_cmd,
+ "osmotrx tx-attenuation (oml|<0-50>)",
+ OSMOTRX_STR
+ "Set the transmitter attenuation\n"
+ "Use NM_ATT_RF_MAXPOWR_R (max power reduction) from BSC via OML (default)\n"
+ "Fixed attenuation in dB, overriding OML (default)\n",
+ CMD_ATTR_IMMEDIATE)
{
struct phy_instance *pinst = vty->index;
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
- 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_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_instance *pinst = vty->index;
- struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
+ if (strcmp(argv[0], "oml") == 0)
+ l1h->config.forced_max_power_red = -1;
+ else
+ l1h->config.forced_max_power_red = atoi(argv[0]);
- l1h->config.power_oml = 1;
- l1h->config.power_valid = 1;
- l1h->config.power_sent = 0;
- l1if_provision_transceiver_trx(l1h);
+ if (pinst->trx && pinst->trx->mo.nm_state.operational == NM_OPSTATE_ENABLED)
+ l1if_trx_start_power_ramp(pinst->trx, NULL);
return CMD_SUCCESS;
}
-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")
+DEFUN_USRATTR(cfg_phyinst_no_rxgain, cfg_phyinst_no_rxgain_cmd,
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "no osmotrx rx-gain",
+ NO_STR OSMOTRX_STR "Unset the receiver gain in dB\n")
{
struct phy_instance *pinst = vty->index;
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
@@ -387,22 +462,11 @@ DEFUN(cfg_phyinst_no_rxgain, cfg_phyinst_no_rxgain_cmd,
return CMD_SUCCESS;
}
-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_instance *pinst = vty->index;
- struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
-
- l1h->config.power_valid = 0;
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_phyinst_no_maxdly, cfg_phyinst_no_maxdly_cmd,
- "no osmotrx maxdly",
- NO_STR OSMOTRX_STR
- "Unset the maximum delay of GSM symbols\n")
+DEFUN_USRATTR(cfg_phyinst_no_maxdly, cfg_phyinst_no_maxdly_cmd,
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "no osmotrx maxdly",
+ NO_STR OSMOTRX_STR
+ "Unset the maximum delay of GSM symbols\n")
{
struct phy_instance *pinst = vty->index;
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
@@ -412,10 +476,11 @@ DEFUN(cfg_phyinst_no_maxdly, cfg_phyinst_no_maxdly_cmd,
return CMD_SUCCESS;
}
-DEFUN(cfg_phyinst_no_maxdlynb, cfg_phyinst_no_maxdlynb_cmd,
- "no osmotrx maxdlynb",
- NO_STR OSMOTRX_STR
- "Unset the maximum delay of GSM symbols\n")
+DEFUN_USRATTR(cfg_phyinst_no_maxdlynb, cfg_phyinst_no_maxdlynb_cmd,
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "no osmotrx maxdlynb",
+ NO_STR OSMOTRX_STR
+ "Unset the maximum delay of GSM symbols\n")
{
struct phy_instance *pinst = vty->index;
struct trx_l1h *l1h = pinst->u.osmotrx.hdl;
@@ -472,9 +537,10 @@ DEFUN(cfg_phy_base_port, cfg_phy_base_port_cmd,
return CMD_SUCCESS;
}
-DEFUN(cfg_phy_setbsic, cfg_phy_setbsic_cmd,
- "osmotrx legacy-setbsic", OSMOTRX_STR
- "Use SETBSIC to configure transceiver (use ONLY with OpenBTS Transceiver!)\n")
+DEFUN_USRATTR(cfg_phy_setbsic, cfg_phy_setbsic_cmd,
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "osmotrx legacy-setbsic", OSMOTRX_STR
+ "Use SETBSIC to configure transceiver (use ONLY with OpenBTS Transceiver!)\n")
{
struct phy_link *plink = vty->index;
plink->u.osmotrx.use_legacy_setbsic = true;
@@ -486,9 +552,10 @@ DEFUN(cfg_phy_setbsic, cfg_phy_setbsic_cmd,
return CMD_SUCCESS;
}
-DEFUN(cfg_phy_no_setbsic, cfg_phy_no_setbsic_cmd,
- "no osmotrx legacy-setbsic",
- NO_STR OSMOTRX_STR "Disable Legacy SETBSIC to configure transceiver\n")
+DEFUN_USRATTR(cfg_phy_no_setbsic, cfg_phy_no_setbsic_cmd,
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "no osmotrx legacy-setbsic",
+ NO_STR OSMOTRX_STR "Disable Legacy SETBSIC to configure transceiver\n")
{
struct phy_link *plink = vty->index;
plink->u.osmotrx.use_legacy_setbsic = false;
@@ -496,30 +563,31 @@ DEFUN(cfg_phy_no_setbsic, cfg_phy_no_setbsic_cmd,
return CMD_SUCCESS;
}
-DEFUN(cfg_phy_trxd_max_version, cfg_phy_trxd_max_version_cmd,
- "osmotrx trxd-max-version (latest|<0-15>)", OSMOTRX_STR
- "Set maximum TRXD format version to negotiate with TRX\n"
- "Use latest supported TRXD format version (default)\n"
- "Maximum TRXD format version number\n")
+DEFUN_USRATTR(cfg_phy_trxd_max_version, cfg_phy_trxd_max_version_cmd,
+ X(BTS_VTY_TRX_POWERCYCLE),
+ "osmotrx trxd-max-version (latest|<0-15>)", OSMOTRX_STR
+ "Set maximum TRXD format version to negotiate with TRX\n"
+ "Use latest supported TRXD format version (default)\n"
+ "Maximum TRXD format version number\n")
{
struct phy_link *plink = vty->index;
int max_ver;
if (strcmp(argv[0], "latest") == 0)
- max_ver = TRX_DATA_FORMAT_VER;
+ max_ver = TRX_DATA_PDU_VER;
else
max_ver = atoi(argv[0]);
- if (max_ver > TRX_DATA_FORMAT_VER) {
+ if (max_ver > TRX_DATA_PDU_VER) {
vty_out(vty, "%% Format version %d is not supported, maximum supported is %d%s",
- max_ver, TRX_DATA_FORMAT_VER, VTY_NEWLINE);
+ max_ver, TRX_DATA_PDU_VER, VTY_NEWLINE);
return CMD_WARNING;
}
- plink->u.osmotrx.trxd_hdr_ver_max = max_ver;
+ plink->u.osmotrx.trxd_pdu_ver_max = max_ver;
return CMD_SUCCESS;
}
-void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink)
+void bts_model_config_write_phy(struct vty *vty, const struct phy_link *plink)
{
if (plink->u.osmotrx.local_ip)
vty_out(vty, " osmotrx ip local %s%s",
@@ -528,12 +596,6 @@ void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink)
vty_out(vty, " osmotrx ip remote %s%s",
plink->u.osmotrx.remote_ip, VTY_NEWLINE);
- if (plink->u.osmotrx.trx_ms_power_loop)
- vty_out(vty, " osmotrx ms-power-loop %d%s", plink->u.osmotrx.trx_target_rssi, VTY_NEWLINE);
- else
- vty_out(vty, " no osmotrx ms-power-loop%s", VTY_NEWLINE);
- vty_out(vty, " %sosmotrx timing-advance-loop%s", (plink->u.osmotrx.trx_ta_loop) ? "" : "no ", VTY_NEWLINE);
-
if (plink->u.osmotrx.base_port_local)
vty_out(vty, " osmotrx base-port local %"PRIu16"%s",
plink->u.osmotrx.base_port_local, VTY_NEWLINE);
@@ -549,24 +611,22 @@ void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink)
if (plink->u.osmotrx.use_legacy_setbsic)
vty_out(vty, " osmotrx legacy-setbsic%s", VTY_NEWLINE);
- if (plink->u.osmotrx.trxd_hdr_ver_max != TRX_DATA_FORMAT_VER)
- vty_out(vty, " osmotrx trxd-max-version %d%s", plink->u.osmotrx.trxd_hdr_ver_max, VTY_NEWLINE);
+ if (plink->u.osmotrx.trxd_pdu_ver_max != TRX_DATA_PDU_VER)
+ vty_out(vty, " osmotrx trxd-max-version %d%s", plink->u.osmotrx.trxd_pdu_ver_max, VTY_NEWLINE);
}
-void bts_model_config_write_phy_inst(struct vty *vty, struct phy_instance *pinst)
+void bts_model_config_write_phy_inst(struct vty *vty, const 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.forced_max_power_red == -1)
+ vty_out(vty, " osmotrx tx-attenuation oml%s", VTY_NEWLINE);
+ else
+ vty_out(vty, " osmotrx tx-attenuation %d%s",
+ l1h->config.forced_max_power_red, VTY_NEWLINE);
if (l1h->config.maxdly_valid)
vty_out(vty, " osmotrx maxdly %d%s", l1h->config.maxdly, VTY_NEWLINE);
if (l1h->config.maxdlynb_valid)
@@ -584,21 +644,30 @@ void bts_model_config_write_phy_inst(struct vty *vty, struct phy_instance *pinst
VTY_NEWLINE);
}
-void bts_model_config_write_bts(struct vty *vty, struct gsm_bts *bts)
+void bts_model_config_write_bts(struct vty *vty, const struct gsm_bts *bts)
{
}
-void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx)
+void bts_model_config_write_trx(struct vty *vty, const 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)
+int bts_model_vty_init(void *ctx)
{
- vty_bts = bts;
-
install_element_ve(&show_transceiver_cmd);
install_element_ve(&show_phy_cmd);
+ install_element(ENABLE_NODE, &test_send_trxc_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);
@@ -614,9 +683,7 @@ int bts_model_vty_init(struct gsm_bts *bts)
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_phyinst_power_on_cmd);
install_element(PHY_INST_NODE, &cfg_phyinst_maxdly_cmd);