[MERGED] osmo-pcu[master]: Improve logging

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jan 6 10:04:12 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: Improve logging
......................................................................


Improve logging

Add value_string describing UL and DL TBF states and use it for logging
errors while freeing TBFs.

Change-Id: I292ec81ab602c65ef86e6e3e85740182b63474b6
---
M src/tbf.cpp
M src/tbf.h
M tests/tbf/TbfTest.err
3 files changed, 35 insertions(+), 9 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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

-- 
To view, visit https://gerrit.osmocom.org/1534
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I292ec81ab602c65ef86e6e3e85740182b63474b6
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list