Change in osmo-bts[master]: power_control: add VTY introspection commands for MS/BS params

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Wed Dec 30 17:29:19 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/21905 )


Change subject: power_control: add VTY introspection commands for MS/BS params
......................................................................

power_control: add VTY introspection commands for MS/BS params

Change-Id: I34095673bf49deb390d5e8383c4ee05a6915b82f
Related: SYS#4918
---
M src/common/vty.c
1 file changed, 103 insertions(+), 16 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/05/21905/1

diff --git a/src/common/vty.c b/src/common/vty.c
index 7284bfa..a116d7f 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1118,6 +1118,66 @@
 	return CMD_SUCCESS;
 }
 
+/* TODO: generalize and move indention handling to libosmocore */
+#define cfg_out(vty, fmt, args...) \
+	vty_out(vty, "%*s" fmt, indent, "", ##args);
+
+static void dump_dpc_meas_params(struct vty *vty, const unsigned int indent,
+				 const struct gsm_power_ctrl_meas_params *mp,
+				 const unsigned int pn)
+{
+	cfg_out(vty, "Lower threshold (L_RXLEV_XX_P): %u%s",
+		mp->lower_thresh, VTY_NEWLINE);
+	cfg_out(vty, "Upper threshold (U_RXLEV_XX_P): %u%s",
+		mp->upper_thresh, VTY_NEWLINE);
+
+	cfg_out(vty, "Lower threshold comparators: P%u=%02u / N%u=%02u%s",
+		pn, mp->lower_cmp_p, pn, mp->lower_cmp_n, VTY_NEWLINE);
+	cfg_out(vty, "Upper threshold comparators: P%u=%02u / N%u=%02u%s",
+		pn + 1, mp->upper_cmp_p, pn + 1, mp->upper_cmp_n, VTY_NEWLINE);
+
+	cfg_out(vty, "Averaging algorithm: ");
+	switch (mp->algo) {
+	case GSM_PWR_CTRL_MEAS_AVG_ALGO_UNWEIGHTED:
+		vty_out(vty, "unweighted%s", VTY_NEWLINE);
+		break;
+	case GSM_PWR_CTRL_MEAS_AVG_ALGO_WEIGHTED:
+		vty_out(vty, "weighted%s", VTY_NEWLINE);
+		break;
+	case GSM_PWR_CTRL_MEAS_AVG_ALGO_MOD_MEDIAN:
+		vty_out(vty, "modified median%s", VTY_NEWLINE);
+		break;
+	case GSM_PWR_CTRL_MEAS_AVG_ALGO_OSMO_EWMA:
+		vty_out(vty, "EWMA (alpha=%u)%s",
+			mp->ewma.alpha, VTY_NEWLINE);
+		break;
+	case GSM_PWR_CTRL_MEAS_AVG_ALGO_NONE:
+		vty_out(vty, "disabled (pass-through)%s", VTY_NEWLINE);
+		return;
+	default:
+		vty_out(vty, "unknown%s", VTY_NEWLINE);
+		return;
+	}
+
+	cfg_out(vty, "Averaging parameters: Hreqave=%u / Hreqt=%u%s",
+		mp->h_reqave, mp->h_reqt, VTY_NEWLINE);
+}
+
+static void dump_dpc_params(struct vty *vty, const unsigned int indent,
+			    const struct gsm_power_ctrl_params *cp)
+{
+	cfg_out(vty, "Power increase step size: %u%s",
+		cp->inc_step_size_db, VTY_NEWLINE);
+	cfg_out(vty, "Power reduce step size: %u%s",
+		cp->red_step_size_db, VTY_NEWLINE);
+
+	cfg_out(vty, "RxLev measurement processing:%s", VTY_NEWLINE);
+	dump_dpc_meas_params(vty, indent + 2, &cp->rxlev_meas, 1);
+
+	cfg_out(vty, "RxQual measurement processing:%s", VTY_NEWLINE);
+	dump_dpc_meas_params(vty, indent + 2, &cp->rxqual_meas, 3);
+}
+
 static void trx_dump_vty(struct vty *vty, const struct gsm_bts_trx *trx)
 {
 	vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
@@ -1128,6 +1188,19 @@
 		"resulting BS power: %d dBm%s",
 		trx->nominal_power, trx->max_power_red,
 		trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
+
+	vty_out(vty, "  BS Power control parameters (%s):%s",
+		trx->bs_dpc_params == &trx->bts->bs_dpc_params ?
+			"fall-back" : "from BSC",
+		VTY_NEWLINE);
+	dump_dpc_params(vty, 4, trx->bs_dpc_params);
+
+	vty_out(vty, "  MS Power control parameters (%s):%s",
+		trx->ms_dpc_params == &trx->bts->ms_dpc_params ?
+			"fall-back" : "from BSC",
+		VTY_NEWLINE);
+	dump_dpc_params(vty, 4, trx->ms_dpc_params);
+
 	vty_out(vty, "  NM State: ");
 	net_dump_nmstate(vty, &trx->mo.nm_state);
 	vty_out(vty, "  RSL State: %s%s", trx->rsl_link? "connected" : "disconnected", VTY_NEWLINE);
@@ -1307,47 +1380,61 @@
 	}
 }
 
-static void lchan_bs_power_ctrl_state_dump(struct vty *vty, const char *prefix,
+static void lchan_bs_power_ctrl_state_dump(struct vty *vty, unsigned int indent,
 					   const struct gsm_lchan *lchan)
 {
 	const struct lchan_power_ctrl_state *st = &lchan->bs_power_ctrl;
 	const struct gsm_bts_trx *trx = lchan->ts->trx;
 
-	vty_out(vty, "%sBS (Downlink) Power Control (%s):%s",
-		prefix, st->fixed ? "fixed" : "autonomous",
+	cfg_out(vty, "BS (Downlink) Power Control (%s):%s",
+		st->fixed ? "fixed" : "autonomous",
 		VTY_NEWLINE);
+	indent += 2;
 
-	vty_out(vty, "%s  Channel reduction: %u dB", prefix, st->current);
+	cfg_out(vty, "Channel reduction: %u dB", st->current);
 	if (!st->fixed)
 		vty_out(vty, " (max %u dB)", st->max);
 	vty_out(vty, "%s", VTY_NEWLINE);
 
-	vty_out(vty, "%s  TRX reduction: %u dB%s",
-		prefix, trx->max_power_red, VTY_NEWLINE);
+	cfg_out(vty, "TRX reduction: %u dB%s",
+		trx->max_power_red, VTY_NEWLINE);
 
 	int actual = trx->nominal_power - (trx->max_power_red + st->current);
-	vty_out(vty, "%s  Actual / Nominal power: %d dBm / %d dBm%s",
-		prefix, actual, trx->nominal_power, VTY_NEWLINE);
+	cfg_out(vty, "Actual / Nominal power: %d dBm / %d dBm%s",
+		actual, trx->nominal_power, VTY_NEWLINE);
+
+	if (st->dpc_params == NULL)
+		return;
+
+	cfg_out(vty, "Power Control parameters:%s", VTY_NEWLINE);
+	dump_dpc_params(vty, indent + 2, st->dpc_params);
 }
 
-static void lchan_ms_power_ctrl_state_dump(struct vty *vty, const char *prefix,
+static void lchan_ms_power_ctrl_state_dump(struct vty *vty, unsigned int indent,
 					   const struct gsm_lchan *lchan)
 {
 	const struct lchan_power_ctrl_state *st = &lchan->ms_power_ctrl;
 	const struct gsm_bts_trx *trx = lchan->ts->trx;
 
-	vty_out(vty, "%sMS (Uplink) Power Control (%s):%s",
-		prefix, st->fixed ? "fixed" : "autonomous",
+	cfg_out(vty, "MS (Uplink) Power Control (%s):%s",
+		st->fixed ? "fixed" : "autonomous",
 		VTY_NEWLINE);
+	indent += 2;
 
 	int current_dbm = ms_pwr_dbm(trx->bts->band, st->current);
 	int max_dbm = ms_pwr_dbm(trx->bts->band, st->max);
 
-	vty_out(vty, "%s  Current power level: %u, -%d dBm",
-		prefix, st->current, current_dbm);
+	cfg_out(vty, "Current power level: %u, -%d dBm",
+		st->current, current_dbm);
 	if (!st->fixed)
 		vty_out(vty, " (max %u, -%d dBm)", st->max, max_dbm);
 	vty_out(vty, "%s", VTY_NEWLINE);
+
+	if (st->dpc_params == NULL)
+		return;
+
+	cfg_out(vty, "Power Control parameters:%s", VTY_NEWLINE);
+	dump_dpc_params(vty, indent + 2, st->dpc_params);
 }
 
 static void lchan_dump_full_vty(struct vty *vty, const struct gsm_lchan *lchan)
@@ -1420,9 +1507,9 @@
 		vty_out(vty, "  RTP/PDCH Loopback Enabled%s", VTY_NEWLINE);
 	vty_out(vty, "  Radio Link Failure Counter 'S': %d%s", lchan->s, VTY_NEWLINE);
 
-	/* BS/MS Power Control state */
-	lchan_bs_power_ctrl_state_dump(vty, "  ", lchan);
-	lchan_ms_power_ctrl_state_dump(vty, "  ", lchan);
+	/* BS/MS Power Control state and parameters */
+	lchan_bs_power_ctrl_state_dump(vty, 2, lchan);
+	lchan_ms_power_ctrl_state_dump(vty, 2, lchan);
 }
 
 static void lchan_dump_short_vty(struct vty *vty, const struct gsm_lchan *lchan)

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/21905
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I34095673bf49deb390d5e8383c4ee05a6915b82f
Gerrit-Change-Number: 21905
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201230/affc0d0f/attachment.htm>


More information about the gerrit-log mailing list