From 50cc22a30c8d62af19551dc77819f0d9d6012fa1 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 5 Feb 2018 20:46:16 +0100 Subject: [PATCH] Print much more information during 'show lchan' This adds printing of remote RTP IP/Port, LAPDm SAPI information, MS Timing offset, propagation delay, encryption algorithm+state, loopback status and radio link failure counter to the "show lchan" command. It also adds TODO comments fro those bits that are not yet printed but which would make sense to print. Change-Id: Ic4bc47638b7b402aee9344dc912745a9929c37f4 --- include/osmo-bts/gsm_data_shared.h | 5 +++++ src/common/gsm_data_shared.c | 10 ++++++++++ src/common/vty.c | 31 ++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h index a1ac27af2..f694114a3 100644 --- a/include/osmo-bts/gsm_data_shared.h +++ b/include/osmo-bts/gsm_data_shared.h @@ -345,6 +345,11 @@ struct gsm_lchan { struct msgb *pending_rel_ind_msg; }; +extern const struct value_string lchan_ciph_state_names[]; +static inline const char *lchan_ciph_state_name(uint8_t state) { + return get_value_string(lchan_ciph_state_names, state); +} + enum { TS_F_PDCH_ACTIVE = 0x1000, TS_F_PDCH_ACT_PENDING = 0x2000, diff --git a/src/common/gsm_data_shared.c b/src/common/gsm_data_shared.c index 9aa4ba173..1ef223caa 100644 --- a/src/common/gsm_data_shared.c +++ b/src/common/gsm_data_shared.c @@ -854,3 +854,13 @@ const char *gsm_trx_unit_id(struct gsm_bts_trx *trx) trx->bts->ip_access.bts_id, trx->nr); return buf; } + +const struct value_string lchan_ciph_state_names[] = { + { LCHAN_CIPH_NONE, "NONE" }, + { LCHAN_CIPH_RX_REQ, "RX_REQ" }, + { LCHAN_CIPH_RX_CONF, "RX_CONF" }, + { LCHAN_CIPH_RXTX_REQ, "RXTX_REQ" }, + { LCHAN_CIPH_RX_CONF_TX_REQ, "RX_CONF_TX_REQ" }, + { LCHAN_CIPH_RXTX_CONF, "RXTX_CONF" }, + { 0, NULL } +}; diff --git a/src/common/vty.c b/src/common/vty.c index c54ab895c..77fc4d911 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -1060,6 +1060,37 @@ static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan) inet_ntoa(ia), lchan->abis_ip.bound_port, lchan->abis_ip.rtp_payload2, lchan->abis_ip.conn_id, VTY_NEWLINE); + if (lchan->abis_ip.connect_ip) { + ia.s_addr = htonl(lchan->abis_ip.connect_ip); + vty_out(vty, " Conn. IP: %s Port %u RTP_TYPE=%u SPEECH_MODE=0x%02u%s", + inet_ntoa(ia), lchan->abis_ip.connect_port, + lchan->abis_ip.rtp_payload, lchan->abis_ip.speech_mode, + VTY_NEWLINE); + } +#define LAPDM_ESTABLISHED(link, sapi_idx) \ + (link).datalink[sapi_idx].dl.state == LAPD_STATE_MF_EST + vty_out(vty, " LAPDm SAPIs: DCCH %c%c, SACCH %c%c%s", + LAPDM_ESTABLISHED(lchan->lapdm_ch.lapdm_dcch, DL_SAPI0) ? '0' : '-', + LAPDM_ESTABLISHED(lchan->lapdm_ch.lapdm_dcch, DL_SAPI3) ? '3' : '-', + LAPDM_ESTABLISHED(lchan->lapdm_ch.lapdm_acch, DL_SAPI0) ? '0' : '-', + LAPDM_ESTABLISHED(lchan->lapdm_ch.lapdm_acch, DL_SAPI3) ? '3' : '-', + VTY_NEWLINE); +#undef LAPDM_ESTABLISHED + vty_out(vty, " Valid System Information: 0x%08x%s", + lchan->si.valid, VTY_NEWLINE); + /* TODO: L1 SAPI (but those are BTS speific :( */ + /* TODO: AMR bits */ + vty_out(vty, " MS Timing Offset: %d, propagation delay: %d symbols %s", + lchan->ms_t_offs, lchan->p_offs, VTY_NEWLINE); + if (lchan->encr.alg_id) { + vty_out(vty, " Ciphering A5/%u State: %s, N(S)=%u%s", + lchan->encr.alg_id-1, lchan_ciph_state_name(lchan->ciph_state), + lchan->ciph_ns, VTY_NEWLINE); + } + 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); + /* TODO: MS Power Control */ } static void lchan_dump_short_vty(struct vty *vty, struct gsm_lchan *lchan)