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


Change subject: vty: resurrect per-lchan BS/MS Power Control information
......................................................................

vty: resurrect per-lchan BS/MS Power Control information

Change-Id: I48812383ef0a125e83b9b3761f3f15873d3b37b4
---
M src/common/vty.c
1 file changed, 47 insertions(+), 7 deletions(-)



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

diff --git a/src/common/vty.c b/src/common/vty.c
index f366956..b2099ec 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1353,6 +1353,49 @@
        }
 }

+static void lchan_bs_power_ctrl_state_dump(struct vty *vty, const char *prefix,
+                                          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",
+               VTY_NEWLINE);
+
+       vty_out(vty, "%s  Channel reduction: %u dB", prefix, 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);
+
+       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);
+}
+
+static void lchan_ms_power_ctrl_state_dump(struct vty *vty, const char *prefix,
+                                          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",
+               VTY_NEWLINE);
+
+       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);
+       if (!st->fixed)
+               vty_out(vty, " (max %u, -%d dBm)", st->max, max_dbm);
+       vty_out(vty, "%s", VTY_NEWLINE);
+}
+
 static void lchan_dump_full_vty(struct vty *vty, const struct gsm_lchan *lchan)
 {
        struct in_addr ia;
@@ -1381,13 +1424,6 @@
                lchan->state == LCHAN_S_BROKEN ? " Error reason: " : "",
                lchan->state == LCHAN_S_BROKEN ? lchan->broken_reason : "",
                VTY_NEWLINE);
-#if 0
-       /* TODO: print more info about MS/BS Power Control */
-       vty_out(vty, "  BS Power: %d dBm, MS Power: %u dBm%s",
-               lchan->ts->trx->nominal_power - (lchan->ts->trx->max_power_red 
+ lchan->bs_power_red),
-               ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.max),
-               VTY_NEWLINE);
-#endif
        vty_out(vty, "  Channel Mode / Codec: %s%s",
                gsm48_chan_mode_name(lchan->tch_mode),
                VTY_NEWLINE);
@@ -1429,6 +1465,10 @@
        if (lchan->loopback)
                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);
 }

 static void lchan_dump_short_vty(struct vty *vty, const struct gsm_lchan 
*lchan)

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I48812383ef0a125e83b9b3761f3f15873d3b37b4
Gerrit-Change-Number: 21481
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to