aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-07-04 12:39:59 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2019-07-04 13:37:33 +0700
commit7d1d294807ba0acbc710225622095590ef085774 (patch)
tree51fefed2d4e726c5faf130434c1274f830af5ba0
parent3f2283cd3ca17072f67812f31dbe2b8a247aa045 (diff)
osmo-bts-trx/trx_if.c: properly describe TRXD messages in logs
Since we may have different versions of the TRXD header, some new fields of an Uplink burst indication have conditional presence. Therefore we need a smart function to print them conditionally. Change-Id: I68729dc98a1840d2aa9e091153d176a103d5a228 Related: OS#4006
-rw-r--r--src/osmo-bts-trx/trx_if.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 0ae12c21..e9193cad 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -738,6 +738,48 @@ static int trx_data_handle_burst_v1(struct trx_l1h *l1h,
return trx_data_handle_burst_v0(l1h, bi, buf, buf_len);
}
+static const char *trx_data_desc_msg(const struct trx_ul_burst_ind *bi)
+{
+ struct osmo_strbuf sb;
+ static char buf[256];
+
+ /* Modulation types defined in 3GPP TS 45.002 */
+ static const char *mod_names[] = {
+ [TRX_BURST_GMSK] = "GMSK",
+ [TRX_BURST_8PSK] = "8-PSK",
+ };
+
+ /* Initialize the string buffer */
+ sb = (struct osmo_strbuf) { .buf = buf, .len = sizeof(buf) };
+
+ /* Common TDMA parameters */
+ OSMO_STRBUF_PRINTF(sb, "tn=%u fn=%u", bi->tn, bi->fn);
+
+ /* Nothing else to print for NOPE.ind */
+ if (bi->flags & TRX_BI_F_NOPE_IND)
+ return buf;
+
+ /* RSSI and ToA256 */
+ OSMO_STRBUF_PRINTF(sb, " rssi=%d toa256=%d", bi->rssi, bi->toa256);
+
+ /* Modulation and TSC set */
+ if (bi->flags & TRX_BI_F_MOD_TYPE)
+ OSMO_STRBUF_PRINTF(sb, " mod=%s", mod_names[bi->bt]);
+
+ /* Training Sequence Code */
+ if (bi->flags & TRX_BI_F_TS_INFO)
+ OSMO_STRBUF_PRINTF(sb, " set=%u tsc=%u", bi->tsc_set, bi->tsc);
+
+ /* C/I: Carrier-to-Interference ratio (in centiBels) */
+ if (bi->flags & TRX_BI_F_CI_CB)
+ OSMO_STRBUF_PRINTF(sb, " C/I=%d cB", bi->ci_cb);
+
+ /* Burst length */
+ OSMO_STRBUF_PRINTF(sb, " burst_len=%zu", bi->burst_len);
+
+ return buf;
+}
+
/* Parse TRXD message from transceiver, compose an UL burst indication.
*
* This message contains a demodulated Uplink burst with fixed-size
@@ -924,11 +966,10 @@ static int trx_data_read_cb(struct osmo_fd *ofd, unsigned int what)
if (rc < 0)
return rc;
- /* TODO: also print TSC and C/I */
- LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG,
- "Rx %s (hdr_ver=%u): tn=%u fn=%u rssi=%d toa256=%d\n",
+ /* Print header & burst info */
+ LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG, "Rx %s (hdr_ver=%u): %s\n",
(bi.flags & TRX_BI_F_NOPE_IND) ? "NOPE.ind" : "UL burst",
- hdr_ver, bi.tn, bi.fn, bi.rssi, bi.toa256);
+ hdr_ver, trx_data_desc_msg(&bi));
/* feed received burst into scheduler code */
trx_sched_ul_burst(&l1h->l1s, &bi);