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


Change subject: osmo-bts-trx/trx_if.c: properly describe TRXD messages in logs
......................................................................

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
---
M src/osmo-bts-trx/trx_if.c
1 file changed, 45 insertions(+), 4 deletions(-)



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

diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 0ae12c2..e9193ca 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -738,6 +738,48 @@
        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 @@
        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);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I68729dc98a1840d2aa9e091153d176a103d5a228
Gerrit-Change-Number: 14670
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to