aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-11-02 14:28:15 +0100
committerHarald Welte <laforge@gnumonks.org>2016-11-03 12:37:03 +0000
commitb748012d3186209c0f4c38ebb7113ce7c60e333b (patch)
tree876f517d46dcac314e04fc143561d3088584d474
parent350f93e1e4de0bc0201518adeb58faefd0a16fe7 (diff)
bsc_vty: include dyn TS info in vty show lchan
Extend both 'show lchan <bts> <trx> <lchan>' and 'show lchan summary' to include information on dynamic timeslots. Have one common function that prints " as foo" or " switching foo -> bar" to the vty, use it in lchan_dump_full_vty() and lchan_dump_short_vty(). In lchan_dump_short_vty(), split the vty_out call in two in order to interleave the dyn ts info right after the pchan. The summary hence looks e.g. like this for osmocom style dyn ts: BTS 0, TRX 0, Timeslot 5 TCH/F_TCH/H_PDCH as PDCH, Lchan 0, Type NONE, State ACTIVE - L1 MS Power: 0 dBm RXL-FULL-dl: -110 dBm RXL-FULL-ul: -110 dBm or BTS 0, TRX 0, Timeslot 4 TCH/F_TCH/H_PDCH switching NONE -> PDCH, Lchan 0, Type NONE, State BROKEN UNUSABLE - L1 MS Power: 0 dBm RXL-FULL-dl: -110 dBm RXL-FULL-ul: -110 dBm Change-Id: I3eb72ac7f0a520a8eefe171b9fb357f149aa3fda
-rw-r--r--openbsc/src/libbsc/bsc_vty.c56
1 files changed, 53 insertions, 3 deletions
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index cb0b1d8c8..9ed19aa1f 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -1078,6 +1078,38 @@ static const struct value_string gsm48_cmode_names[] = {
{ 0, NULL }
};
+/* call vty_out() to print a string like " as TCH/H" for dynamic timeslots.
+ * Don't do anything if the ts is not dynamic. */
+static void vty_out_dyn_ts_status(struct vty *vty, struct gsm_bts_trx_ts *ts)
+{
+ switch (ts->pchan) {
+ case GSM_PCHAN_TCH_F_TCH_H_PDCH:
+ if (ts->dyn.pchan_is == ts->dyn.pchan_want)
+ vty_out(vty, " as %s",
+ gsm_pchan_name(ts->dyn.pchan_is));
+ else
+ vty_out(vty, " switching %s -> %s",
+ gsm_pchan_name(ts->dyn.pchan_is),
+ gsm_pchan_name(ts->dyn.pchan_want));
+ break;
+ case GSM_PCHAN_TCH_F_PDCH:
+ if ((ts->flags & TS_F_PDCH_PENDING_MASK) == 0)
+ vty_out(vty, " as %s",
+ (ts->flags & TS_F_PDCH_ACTIVE)? "PDCH"
+ : "TCH/F");
+ else
+ vty_out(vty, " switching %s -> %s",
+ (ts->flags & TS_F_PDCH_ACTIVE)? "PDCH"
+ : "TCH/F",
+ (ts->flags & TS_F_PDCH_ACT_PENDING)? "PDCH"
+ : "TCH/F");
+ break;
+ default:
+ /* no dyn ts */
+ break;
+ }
+}
+
static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
{
int idx;
@@ -1085,6 +1117,22 @@ static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
+ /* show dyn TS details, if applicable */
+ switch (lchan->ts->pchan) {
+ case GSM_PCHAN_TCH_F_TCH_H_PDCH:
+ vty_out(vty, " Osmocom Dyn TS:");
+ vty_out_dyn_ts_status(vty, lchan->ts);
+ vty_out(vty, VTY_NEWLINE);
+ break;
+ case GSM_PCHAN_TCH_F_PDCH:
+ vty_out(vty, " IPACC Dyn PDCH TS:");
+ vty_out_dyn_ts_status(vty, lchan->ts);
+ vty_out(vty, VTY_NEWLINE);
+ break;
+ default:
+ /* no dyn ts */
+ break;
+ }
vty_out(vty, " Connection: %u, State: %s%s%s%s",
lchan->conn ? 1: 0,
gsm_lchans_name(lchan->state),
@@ -1129,10 +1177,12 @@ static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)
lchan->meas_rep_idx, 1);
mr = &lchan->meas_rep[idx];
- vty_out(vty, "BTS %u, TRX %u, Timeslot %u %s, Lchan %u, Type %s, State %s - "
- "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
+ vty_out(vty, "BTS %u, TRX %u, Timeslot %u %s",
lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
- gsm_pchan_name(lchan->ts->pchan),
+ gsm_pchan_name(lchan->ts->pchan));
+ vty_out_dyn_ts_status(vty, lchan->ts);
+ vty_out(vty, ", Lchan %u, Type %s, State %s - "
+ "L1 MS Power: %u dBm RXL-FULL-dl: %4d dBm RXL-FULL-ul: %4d dBm%s",
lchan->nr,
gsm_lchant_name(lchan->type), gsm_lchans_name(lchan->state),
mr->ms_l1.pwr,