summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2015-05-17 20:52:26 -0400
committerIvan Kluchnikov <kluchnikovi@gmail.com>2015-05-27 16:28:44 +0300
commit90459a0507b7b0fc66a7c764c48c8f244ce66989 (patch)
treee40385f938aaaa9d8acc09d942b8cef626df9f93
parentade03887bbfee19b970dcaed1220cc3a19867eaf (diff)
libmsc: Update 'max_power_red' VTY command.
Changes: * Apply change even if the supplied value is odd, just warn that it is rounded. * Apply change even if the supplied value is higher than the 24dB maximum suggested by the standard, just warn about this. * Apply change to the BTS over OML immediately.
-rw-r--r--openbsc/src/libbsc/bsc_vty.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 9b0f020..9314c6f 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -3283,27 +3283,42 @@ DEFUN(cfg_trx_max_power_red,
"Reduction of maximum BS RF Power (relative to nominal power)\n"
"Reduction of maximum BS RF Power in dB\n")
{
+ int ret = CMD_SUCCESS;
int maxpwr_r = atoi(argv[0]);
struct gsm_bts_trx *trx = vty->index;
+ /* FIXME: check if our BTS type supports more than 24 */
int upper_limit = 24; /* default 12.21 max power red. */
- /* FIXME: check if our BTS type supports more than 12 */
- if (maxpwr_r < 0 || maxpwr_r > upper_limit) {
- vty_out(vty, "%% Power %d dB is not in the valid range%s",
+ if (maxpwr_r < 0) {
+ vty_out(vty, "%% Power %d dB can not be negative%s",
maxpwr_r, VTY_NEWLINE);
return CMD_WARNING;
}
+ if (maxpwr_r > upper_limit) {
+ vty_out(vty, "%% Power %d dB is more than %d dB maximum power reduction"
+ " defined by GSM 12.21. BTS may not support it.%s",
+ maxpwr_r, upper_limit, VTY_NEWLINE);
+ ret = CMD_WARNING;
+ }
if (maxpwr_r & 1) {
- vty_out(vty, "%% Power %d dB is not an even value%s",
+ maxpwr_r = (maxpwr_r/2)*2;
+ vty_out(vty, "%% Power is not an even value, rounding it to %d dB%s",
maxpwr_r, VTY_NEWLINE);
- return CMD_WARNING;
+ ret = CMD_WARNING;
}
- trx->max_power_red = maxpwr_r;
-
- /* FIXME: make sure we update this using OML */
+ /* Update the value if it's changed */
+ if (trx->max_power_red != maxpwr_r) {
+ trx->max_power_red = maxpwr_r;
+ vty_out(vty, "%% Updating max_pwr_red to %d dB for %s%s",
+ trx->max_power_red, gsm_trx_name(trx), VTY_NEWLINE);
+ abis_nm_update_max_power_red(trx);
+ } else {
+ vty_out(vty, "%% max_pwr_red is not changed for %s%s",
+ gsm_trx_name(trx), VTY_NEWLINE);
+ }
- return CMD_SUCCESS;
+ return ret;
}
DEFUN(cfg_trx_rsl_e1,