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

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Thu Jan 5 17:28:56 UTC 2017


Review at  https://gerrit.osmocom.org/1534

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
2 files changed, 30 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/34/1534/1

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 */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I292ec81ab602c65ef86e6e3e85740182b63474b6
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list