summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2020-03-01 01:27:46 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2020-03-01 01:46:51 +0700
commit3f25909e108dc1504b93c82eeb226d898fc8f086 (patch)
treefa52b47ef250341498d5a89ec5176337789fe398
parent2d355c2453a727ccb631b95d0d8dd7f88414cc73 (diff)
trxcon/scheduler: print completeness of the Rx burst buffers
-rw-r--r--src/host/trxcon/sched_lchan_common.c21
-rw-r--r--src/host/trxcon/sched_lchan_pdtch.c5
-rw-r--r--src/host/trxcon/sched_lchan_tchf.c5
-rw-r--r--src/host/trxcon/sched_lchan_tchh.c5
-rw-r--r--src/host/trxcon/sched_lchan_xcch.c5
-rw-r--r--src/host/trxcon/sched_trx.h1
6 files changed, 33 insertions, 9 deletions
diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c
index d8d9ee13..813f3157 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -2,7 +2,7 @@
* OsmocomBB <-> SDR connection bridge
* TDMA scheduler: common routines for lchan handlers
*
- * (C) 2017-2019 by Vadim Yanitskiy <axilirator@gmail.com>
+ * (C) 2017-2020 by Vadim Yanitskiy <axilirator@gmail.com>
*
* All Rights Reserved
*
@@ -84,6 +84,25 @@ const uint8_t sched_nb_training_bits[8][26] = {
},
};
+/* Get a string representation of the burst buffer's completeness.
+ * Examples: " ****.." (incomplete, 4/6 bursts)
+ * " ****" (complete, all 4 bursts)
+ * "**.***.." (incomplete, 5/8 bursts) */
+const char *burst_mask2str(const uint8_t *mask, int bits)
+{
+ /* TODO: CSD is interleaved over 22 bursts, so the mask needs to be extended */
+ static char buf[8 + 1];
+ char *ptr = buf;
+
+ OSMO_ASSERT(bits <= 8 && bits > 0);
+
+ while (--bits >= 0)
+ *(ptr++) = (*mask & (1 << bits)) ? '*' : '.';
+ *ptr = '\0';
+
+ return buf;
+}
+
int sched_gsmtap_send(enum trx_lchan_type lchan_type, uint32_t fn, uint8_t tn,
uint16_t band_arfcn, int8_t signal_dbm, uint8_t snr,
const uint8_t *data, size_t data_len)
diff --git a/src/host/trxcon/sched_lchan_pdtch.c b/src/host/trxcon/sched_lchan_pdtch.c
index 733e5741..83a6f53b 100644
--- a/src/host/trxcon/sched_lchan_pdtch.c
+++ b/src/host/trxcon/sched_lchan_pdtch.c
@@ -88,8 +88,9 @@ int rx_pdtch_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Check for complete set of bursts */
if ((*mask & 0xf) != 0xf) {
- LOGP(DSCHD, LOGL_ERROR, "Received incomplete data frame at "
- "fn=%u (%u/%u) for %s\n", *first_fn,
+ LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) data frame at "
+ "fn=%u (%u/%u) for %s\n",
+ burst_mask2str(mask, 4), *first_fn,
(*first_fn) % ts->mf_layout->period,
ts->mf_layout->period,
lchan_desc->name);
diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c
index f2ecdcc6..0109280b 100644
--- a/src/host/trxcon/sched_lchan_tchf.c
+++ b/src/host/trxcon/sched_lchan_tchf.c
@@ -90,8 +90,9 @@ int rx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Check for complete set of bursts */
if ((*mask & 0xf) != 0xf) {
- LOGP(DSCHD, LOGL_ERROR, "Received incomplete traffic frame at "
- "fn=%u (%u/%u) for %s\n", *first_fn,
+ LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) traffic frame at "
+ "fn=%u (%u/%u) for %s\n",
+ burst_mask2str(mask, 8), *first_fn,
(*first_fn) % ts->mf_layout->period,
ts->mf_layout->period,
lchan_desc->name);
diff --git a/src/host/trxcon/sched_lchan_tchh.c b/src/host/trxcon/sched_lchan_tchh.c
index 0201ee35..82886706 100644
--- a/src/host/trxcon/sched_lchan_tchh.c
+++ b/src/host/trxcon/sched_lchan_tchh.c
@@ -299,8 +299,9 @@ int rx_tchh_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Check decoding result */
if (rc < 4) {
- LOGP(DSCHD, LOGL_ERROR, "Received bad TCH frame ending at "
- "fn=%u on %s (rc=%d)\n", fn, lchan_desc->name, rc);
+ LOGP(DSCHD, LOGL_ERROR, "Received bad TCH frame (%s) ending at "
+ "fn=%u on %s (rc=%d)\n", burst_mask2str(mask, 6),
+ fn, lchan_desc->name, rc);
/* Send BFI */
goto bfi;
diff --git a/src/host/trxcon/sched_lchan_xcch.c b/src/host/trxcon/sched_lchan_xcch.c
index d3416465..34fe5ce8 100644
--- a/src/host/trxcon/sched_lchan_xcch.c
+++ b/src/host/trxcon/sched_lchan_xcch.c
@@ -87,8 +87,9 @@ int rx_data_fn(struct trx_instance *trx, struct trx_ts *ts,
/* Check for complete set of bursts */
if ((*mask & 0xf) != 0xf) {
- LOGP(DSCHD, LOGL_ERROR, "Received incomplete data frame at "
- "fn=%u (%u/%u) for %s\n", *first_fn,
+ LOGP(DSCHD, LOGL_ERROR, "Received incomplete (%s) data frame at "
+ "fn=%u (%u/%u) for %s\n",
+ burst_mask2str(mask, 4), *first_fn,
(*first_fn) % ts->mf_layout->period,
ts->mf_layout->period,
lchan_desc->name);
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index 8718ed69..13fc678d 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -355,6 +355,7 @@ int sched_trx_handle_tx_burst(struct trx_instance *trx,
/* Shared declarations for lchan handlers */
extern const uint8_t sched_nb_training_bits[8][26];
+const char *burst_mask2str(const uint8_t *mask, int bits);
size_t sched_bad_frame_ind(uint8_t *l2, struct trx_lchan_state *lchan);
int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts,
struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len,