trxcon/scheduler: print completeness of the Rx burst buffers

Change-Id: Ife9f5eabc23aa2eea08b190361e10a98e890d608
Related: OS#3554
This commit is contained in:
Vadim Yanitskiy 2020-03-01 01:27:46 +07:00
parent 2d355c2453
commit 3f25909e10
6 changed files with 33 additions and 9 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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,