Changes:
 * Apply change even if the supplied value is odd, just warn that it is
rounded.
   Previously the value was not set at all, which may have lead to a
situation when
   a user thinks the BTS operating at low power, while it is running full
power.
 * Apply change even if the supplied value is higher than the 24dB maximum
   suggested by the standard, just warn about this.
   UmSITE and probably other SDR based BTS support much wider power
   regulation range.
 * Apply change to the BTS over OML immediately.

-- 
Regards,
Alexander Chemeris.
CEO, Fairwaves, Inc.
https://fairwaves.co

Subscribe to Fairwaves news: http://eepurl.com/baL_pf
From 90459a0507b7b0fc66a7c764c48c8f244ce66989 Mon Sep 17 00:00:00 2001
From: Alexander Chemeris <[email protected]>
Date: Sun, 17 May 2015 20:52:26 -0400
Subject: [PATCH] libmsc: Improve '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.
---
 openbsc/src/libbsc/bsc_vty.c | 33 ++++++++++++++++++++++++---------
 1 file 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,
-- 
1.9.1

Reply via email to