aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-01-05 18:26:58 +0100
committerMax <msuraev@sysmocom.de>2017-01-05 18:39:25 +0100
commite66de5b5ae47736404c95c5f191c88b56432da84 (patch)
treed9c848856fc625adb21e67395cd9d8d1eab777cc
parentee78bf0882d982ed69a98a0207dec1a1d00de32a (diff)
Improve logging
Add value_string describing UL and DL TBF states and use it for logging errors while freeing TBFs. Change-Id: I292ec81ab602c65ef86e6e3e85740182b63474b6
-rw-r--r--src/tbf.cpp27
-rw-r--r--src/tbf.h7
-rw-r--r--tests/tbf/TbfTest.err10
3 files changed, 35 insertions, 9 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 0e4d6cc..657255d 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -43,6 +43,21 @@ extern void *tall_pcu_ctx;
static void tbf_timer_cb(void *_tbf);
+const struct value_string gprs_rlcmac_tbf_dl_ass_state_names[] = {
+ OSMO_VALUE_STRING(GPRS_RLCMAC_DL_ASS_NONE),
+ OSMO_VALUE_STRING(GPRS_RLCMAC_DL_ASS_SEND_ASS),
+ OSMO_VALUE_STRING(GPRS_RLCMAC_DL_ASS_WAIT_ACK),
+ { 0, NULL }
+};
+
+const struct value_string gprs_rlcmac_tbf_ul_ass_state_names[] = {
+ OSMO_VALUE_STRING(GPRS_RLCMAC_UL_ASS_NONE),
+ OSMO_VALUE_STRING(GPRS_RLCMAC_UL_ASS_SEND_ASS),
+ OSMO_VALUE_STRING(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ),
+ OSMO_VALUE_STRING(GPRS_RLCMAC_UL_ASS_WAIT_ACK),
+ { 0, NULL }
+};
+
static const struct rate_ctr_desc tbf_ctr_description[] = {
{ "rlc.nacked", "RLC Nacked " },
};
@@ -435,16 +450,20 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf)
LOGP(DRLCMAC, LOGL_INFO, "%s free\n", tbf_name(tbf));
if (tbf->ul_ass_state != GPRS_RLCMAC_UL_ASS_NONE)
LOGP(DRLCMAC, LOGL_ERROR, "%s Software error: Pending uplink "
- "assignment. This may not happen, because the "
+ "assignment in state %s. This may not happen, because the "
"assignment message never gets transmitted. Please "
"be sure not to free in this state. PLEASE FIX!\n",
- tbf_name(tbf));
+ tbf_name(tbf),
+ get_value_string(gprs_rlcmac_tbf_ul_ass_state_names,
+ tbf->ul_ass_state));
if (tbf->dl_ass_state != GPRS_RLCMAC_DL_ASS_NONE)
LOGP(DRLCMAC, LOGL_ERROR, "%s Software error: Pending downlink "
- "assignment. This may not happen, because the "
+ "assignment in state %s. This may not happen, because the "
"assignment message never gets transmitted. Please "
"be sure not to free in this state. PLEASE FIX!\n",
- tbf_name(tbf));
+ tbf_name(tbf),
+ get_value_string(gprs_rlcmac_tbf_dl_ass_state_names,
+ tbf->dl_ass_state));
tbf->stop_timer();
#warning "TODO: Could/Should generate bssgp_tx_llc_discarded"
tbf_unlink_pdch(tbf);
diff --git a/src/tbf.h b/src/tbf.h
index ad1ece2..adb7dcc 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -27,6 +27,9 @@
#include <gprs_debug.h>
#include <stdint.h>
+extern "C" {
+#include <osmocom/core/utils.h>
+}
struct bssgp_bvc_ctx;
struct rlc_ul_header;
@@ -61,6 +64,8 @@ enum gprs_rlcmac_tbf_dl_ass_state {
GPRS_RLCMAC_DL_ASS_WAIT_ACK, /* wait for PACKET CONTROL ACK */
};
+extern const struct value_string gprs_rlcmac_tbf_dl_ass_state_names[];
+
enum gprs_rlcmac_tbf_ul_ass_state {
GPRS_RLCMAC_UL_ASS_NONE = 0,
GPRS_RLCMAC_UL_ASS_SEND_ASS, /* send uplink assignment on next RTS */
@@ -68,6 +73,8 @@ enum gprs_rlcmac_tbf_ul_ass_state {
GPRS_RLCMAC_UL_ASS_WAIT_ACK, /* wait for PACKET CONTROL ACK */
};
+extern const struct value_string gprs_rlcmac_tbf_ul_ass_state_names[];
+
enum gprs_rlcmac_tbf_ul_ack_state {
GPRS_RLCMAC_UL_ACK_NONE = 0,
GPRS_RLCMAC_UL_ACK_SEND_ACK, /* send acknowledge on next RTS */
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index 2647551..c6bc1aa 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -563,7 +563,7 @@ Modifying MS object, TLLI = 0xf1000001, IMSI '001001000000001' -> '0010010000000
TBF(TFI=1 TLLI=0xf1000002 DIR=DL STATE=FLOW) the IMSI '001001000000002' was already assigned to another MS object: TLLI = 0xf1000001, that IMSI will be removed
TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=FLOW) changes state from FLOW to RELEASING
TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=RELEASING) free
-TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=RELEASING) Software error: Pending downlink assignment. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
+TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=RELEASING) Software error: Pending downlink assignment in state GPRS_RLCMAC_DL_ASS_SEND_ASS. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
PDCH(TS 4, TRX 0): Detaching TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=RELEASING), 1 TBFs, USFs = 00, TFIs = 00000002.
Detaching TBF from MS object, TLLI = 0xf1000001, TBF = TBF(TFI=0 TLLI=0xf1000001 DIR=DL STATE=RELEASING)
********** TBF ends here **********
@@ -572,7 +572,7 @@ Clearing MS object, TLLI: 0xf1000001, IMSI: '001001000000002'
Destroying MS object, TLLI = 0x00000000
TBF(TFI=1 TLLI=0xf1000002 DIR=DL STATE=FLOW) changes state from FLOW to RELEASING
TBF(TFI=1 TLLI=0xf1000002 DIR=DL STATE=RELEASING) free
-TBF(TFI=1 TLLI=0xf1000002 DIR=DL STATE=RELEASING) Software error: Pending downlink assignment. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
+TBF(TFI=1 TLLI=0xf1000002 DIR=DL STATE=RELEASING) Software error: Pending downlink assignment in state GPRS_RLCMAC_DL_ASS_SEND_ASS. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
PDCH(TS 4, TRX 0): Detaching TBF(TFI=1 TLLI=0xf1000002 DIR=DL STATE=RELEASING), 0 TBFs, USFs = 00, TFIs = 00000000.
Detaching TBF from MS object, TLLI = 0xf1000002, TBF = TBF(TFI=1 TLLI=0xf1000002 DIR=DL STATE=RELEASING)
Destroying MS object, TLLI = 0xf1000002
@@ -1971,7 +1971,7 @@ TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) append
Old MS: TLLI = 0xf1223344, TA = 7, IMSI = 0011223344, LLC = 2
UL RSSI of TLLI=0xf1223344: 31 dBm
TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) free
-TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Software error: Pending downlink assignment. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
+TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Software error: Pending downlink assignment in state GPRS_RLCMAC_DL_ASS_SEND_ASS. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) stopping timer 3169.
PDCH(TS 7, TRX 0): Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW), 0 TBFs, USFs = 00, TFIs = 00000000.
Detaching TBF from MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW)
@@ -2150,7 +2150,7 @@ TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) append
Old MS: TLLI = 0xf1223344, TA = 7, IMSI = 0011223344, LLC = 2
UL RSSI of TLLI=0xf1223344: 31 dBm
TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) free
-TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Software error: Pending downlink assignment. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
+TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) Software error: Pending downlink assignment in state GPRS_RLCMAC_DL_ASS_SEND_ASS. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) stopping timer 3169.
PDCH(TS 7, TRX 0): Detaching TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW), 0 TBFs, USFs = 00, TFIs = 00000000.
Detaching TBF from MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW)
@@ -6636,7 +6636,7 @@ TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) DL analysis, range=1176:1288,
DL packet loss of IMSI= / TLLI=0xffeeddcc: 78%
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=FLOW EGPRS) changes state from FLOW to RELEASING
TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) free
-TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Software error: Pending downlink assignment. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
+TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS) Software error: Pending downlink assignment in state GPRS_RLCMAC_DL_ASS_SEND_ASS. This may not happen, because the assignment message never gets transmitted. Please be sure not to free in this state. PLEASE FIX!
PDCH(TS 4, TRX 0): Detaching TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS), 0 TBFs, USFs = 00, TFIs = 00000000.
Detaching TBF from MS object, TLLI = 0xffeeddcc, TBF = TBF(TFI=0 TLLI=0xffeeddcc DIR=DL STATE=RELEASING EGPRS)
Destroying MS object, TLLI = 0xffeeddcc