osmo-bts-trx: unify and enrich 'Received bad data' logging

Change-Id: I7902f382e1d83ef9ad2cf6f92e31eeb16f6b797c
This commit is contained in:
Vadim Yanitskiy 2023-07-13 05:04:30 +07:00 committed by fixeria
parent bb596dddc7
commit f2c902c2af
5 changed files with 14 additions and 27 deletions

View File

@ -122,8 +122,8 @@ int rx_pdtch_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
if (rc > 0) { if (rc > 0) {
presence_info = PRES_INFO_BOTH; presence_info = PRES_INFO_BOTH;
} else { } else {
LOGL1SB(DL1P, LOGL_DEBUG, l1ts, bi, "Received bad PDTCH (%u/%u)\n", LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
bi->fn % l1ts->mf_period, l1ts->mf_period); BAD_DATA_MSG_FMT "\n", BAD_DATA_MSG_ARGS);
rc = 0; rc = 0;
presence_info = PRES_INFO_INVALID; presence_info = PRES_INFO_INVALID;
} }

View File

@ -113,7 +113,6 @@ int rx_tchf_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
int rc, amr = 0; int rc, amr = 0;
int n_errors = 0; int n_errors = 0;
int n_bits_total = 0; int n_bits_total = 0;
bool bfi_flag = false;
unsigned int fn_begin; unsigned int fn_begin;
uint16_t ber10k; uint16_t ber10k;
uint8_t is_sub = 0; uint8_t is_sub = 0;
@ -301,20 +300,13 @@ int rx_tchf_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
trx_loop_amr_input(chan_state, &meas_avg); trx_loop_amr_input(chan_state, &meas_avg);
/* Check if the frame is bad */ /* Check if the frame is bad */
if (rc < 0) { if (rc < 4) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi, "Received bad data (%u/%u)\n",
bi->fn % l1ts->mf_period, l1ts->mf_period);
bfi_flag = true;
} else if (rc < 4) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi, LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
"Received bad data (%u/%u) with invalid codec mode %d\n", BAD_DATA_MSG_FMT "\n", BAD_DATA_MSG_ARGS);
bi->fn % l1ts->mf_period, l1ts->mf_period, rc); rc = 0; /* this is how we signal BFI to l1sap */
bfi_flag = true;
} }
ber10k = compute_ber10k(n_bits_total, n_errors); ber10k = compute_ber10k(n_bits_total, n_errors);
if (bfi_flag)
rc = 0; /* this is how we signal BFI to l1sap */
/* FACCH */ /* FACCH */
if (rc == GSM_MACBLOCK_LEN) { if (rc == GSM_MACBLOCK_LEN) {

View File

@ -169,7 +169,6 @@ int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
int amr = 0; int amr = 0;
int n_errors = 0; int n_errors = 0;
int n_bits_total = 0; int n_bits_total = 0;
bool bfi_flag = false;
enum sched_meas_avg_mode meas_avg_mode = SCHED_MEAS_AVG_M_S6N4; enum sched_meas_avg_mode meas_avg_mode = SCHED_MEAS_AVG_M_S6N4;
struct l1sched_meas_set meas_avg; struct l1sched_meas_set meas_avg;
unsigned int fn_begin; unsigned int fn_begin;
@ -358,19 +357,11 @@ int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
trx_loop_amr_input(chan_state, &meas_avg); trx_loop_amr_input(chan_state, &meas_avg);
/* Check if the frame is bad */ /* Check if the frame is bad */
if (rc < 0) { if (rc < 4) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi, "Received bad data (%u/%u)\n",
bi->fn % l1ts->mf_period, l1ts->mf_period);
bfi_flag = true;
} else if (rc < 4) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi, LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
"Received bad data (%u/%u) with invalid codec mode %d\n", BAD_DATA_MSG_FMT "\n", BAD_DATA_MSG_ARGS);
bi->fn % l1ts->mf_period, l1ts->mf_period, rc);
bfi_flag = true;
}
if (bfi_flag)
rc = 0; /* this is how we signal BFI to l1sap */ rc = 0; /* this is how we signal BFI to l1sap */
}
/* FACCH */ /* FACCH */
if (rc == GSM_MACBLOCK_LEN) { if (rc == GSM_MACBLOCK_LEN) {

View File

@ -113,8 +113,8 @@ int rx_data_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi)
/* decode */ /* decode */
rc = gsm0503_xcch_decode(l2, bursts_p, &n_errors, &n_bits_total); rc = gsm0503_xcch_decode(l2, bursts_p, &n_errors, &n_bits_total);
if (rc) { if (rc) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi, "Received bad data (%u/%u)\n", LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
bi->fn % l1ts->mf_period, l1ts->mf_period); BAD_DATA_MSG_FMT "\n", BAD_DATA_MSG_ARGS);
l2_len = 0; l2_len = 0;
/* When SACCH Repetition is active, we may try to decode the /* When SACCH Repetition is active, we may try to decode the

View File

@ -35,6 +35,10 @@
extern void *tall_bts_ctx; extern void *tall_bts_ctx;
#define BAD_DATA_MSG_FMT "Received bad data (rc=%d, BER %d/%d) ending at fn=%u/%u"
#define BAD_DATA_MSG_ARGS \
rc, n_errors, n_bits_total, bi->fn % l1ts->mf_period, l1ts->mf_period
/* Compute the bit error rate in 1/10000 units */ /* Compute the bit error rate in 1/10000 units */
static inline uint16_t compute_ber10k(int n_bits_total, int n_errors) static inline uint16_t compute_ber10k(int n_bits_total, int n_errors)
{ {