fixeria has uploaded this change for review.

View Change

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

Change-Id: I7902f382e1d83ef9ad2cf6f92e31eeb16f6b797c
---
M src/osmo-bts-trx/sched_lchan_pdtch.c
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
M src/osmo-bts-trx/sched_lchan_xcch.c
M src/osmo-bts-trx/sched_utils.h
5 files changed, 23 insertions(+), 27 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/29/33729/1
diff --git a/src/osmo-bts-trx/sched_lchan_pdtch.c b/src/osmo-bts-trx/sched_lchan_pdtch.c
index 2aa43f9..22bb3b0 100644
--- a/src/osmo-bts-trx/sched_lchan_pdtch.c
+++ b/src/osmo-bts-trx/sched_lchan_pdtch.c
@@ -122,8 +122,8 @@
if (rc > 0) {
presence_info = PRES_INFO_BOTH;
} else {
- LOGL1SB(DL1P, LOGL_DEBUG, l1ts, bi, "Received bad PDTCH (%u/%u)\n",
- bi->fn % l1ts->mf_period, l1ts->mf_period);
+ LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
+ BAD_DATA_MSG_FMT "\n", BAD_DATA_MSG_ARGS);
rc = 0;
presence_info = PRES_INFO_INVALID;
}
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index 444cda2..bdc5140 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -84,7 +84,6 @@
int rc, amr = 0;
int n_errors = 0;
int n_bits_total = 0;
- bool bfi_flag = false;
unsigned int fn_begin;
uint16_t ber10k;
uint8_t is_sub = 0;
@@ -235,20 +234,13 @@
trx_loop_amr_input(chan_state, &meas_avg);

/* Check if the frame is bad */
- if (rc < 0) {
- 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) {
+ if (rc < 4) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
- "Received bad data (%u/%u) with invalid codec mode %d\n",
- bi->fn % l1ts->mf_period, l1ts->mf_period, rc);
- bfi_flag = true;
+ BAD_DATA_MSG_FMT "\n", BAD_DATA_MSG_ARGS);
+ rc = 0; /* this is how we signal BFI to l1sap */
}

ber10k = compute_ber10k(n_bits_total, n_errors);
- if (bfi_flag)
- rc = 0; /* this is how we signal BFI to l1sap */

/* FACCH */
if (rc == GSM_MACBLOCK_LEN) {
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 541feab..b1364a6 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -105,7 +105,6 @@
int amr = 0;
int n_errors = 0;
int n_bits_total = 0;
- bool bfi_flag = false;
enum sched_meas_avg_mode meas_avg_mode = SCHED_MEAS_AVG_M_S6N4;
struct l1sched_meas_set meas_avg;
unsigned int fn_begin;
@@ -273,19 +272,11 @@
trx_loop_amr_input(chan_state, &meas_avg);

/* Check if the frame is bad */
- if (rc < 0) {
- 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) {
+ if (rc < 4) {
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
- "Received bad data (%u/%u) with invalid codec mode %d\n",
- bi->fn % l1ts->mf_period, l1ts->mf_period, rc);
- bfi_flag = true;
- }
-
- if (bfi_flag)
+ BAD_DATA_MSG_FMT "\n", BAD_DATA_MSG_ARGS);
rc = 0; /* this is how we signal BFI to l1sap */
+ }

/* FACCH */
if (rc == GSM_MACBLOCK_LEN) {
diff --git a/src/osmo-bts-trx/sched_lchan_xcch.c b/src/osmo-bts-trx/sched_lchan_xcch.c
index 87561ea..1a4da5c 100644
--- a/src/osmo-bts-trx/sched_lchan_xcch.c
+++ b/src/osmo-bts-trx/sched_lchan_xcch.c
@@ -113,8 +113,8 @@
/* decode */
rc = gsm0503_xcch_decode(l2, bursts_p, &n_errors, &n_bits_total);
if (rc) {
- LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi, "Received bad data (%u/%u)\n",
- bi->fn % l1ts->mf_period, l1ts->mf_period);
+ LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
+ BAD_DATA_MSG_FMT "\n", BAD_DATA_MSG_ARGS);
l2_len = 0;

/* When SACCH Repetition is active, we may try to decode the
diff --git a/src/osmo-bts-trx/sched_utils.h b/src/osmo-bts-trx/sched_utils.h
index 95f4a77..1a51bf3 100644
--- a/src/osmo-bts-trx/sched_utils.h
+++ b/src/osmo-bts-trx/sched_utils.h
@@ -25,6 +25,10 @@

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 */
static inline uint16_t compute_ber10k(int n_bits_total, int n_errors)
{

To view, visit change 33729. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I7902f382e1d83ef9ad2cf6f92e31eeb16f6b797c
Gerrit-Change-Number: 33729
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-MessageType: newchange