[MERGED] osmo-bts[master]: Print much more information during 'show lchan'

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Feb 5 22:28:57 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Print much more information during 'show lchan'
......................................................................


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
---
M include/osmo-bts/gsm_data_shared.h
M src/common/gsm_data_shared.c
M src/common/vty.c
3 files changed, 46 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h
index a1ac27a..f694114 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -345,6 +345,11 @@
 	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 9aa4ba1..1ef223c 100644
--- a/src/common/gsm_data_shared.c
+++ b/src/common/gsm_data_shared.c
@@ -854,3 +854,13 @@
 		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 c54ab89..77fc4d9 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1060,6 +1060,37 @@
 		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)

-- 
To view, visit https://gerrit.osmocom.org/6281
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic4bc47638b7b402aee9344dc912745a9929c37f4
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list