Change in osmo-sgsn[master]: Improve logging in gprs_llc.c code

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

pespin gerrit-no-reply at lists.osmocom.org
Thu Nov 21 13:07:33 UTC 2019


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/16147 )


Change subject: Improve logging in gprs_llc.c code
......................................................................

Improve logging in gprs_llc.c code

Change-Id: Id89cc6760179fb9b1709a30b5d1af41d466b280b
---
M include/osmocom/sgsn/gprs_sgsn.h
M src/sgsn/gprs_gmm.c
M src/sgsn/gprs_llc.c
3 files changed, 21 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/47/16147/1

diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h
index 0a52a7d..0886ce7 100644
--- a/include/osmocom/sgsn/gprs_sgsn.h
+++ b/include/osmocom/sgsn/gprs_sgsn.h
@@ -257,15 +257,15 @@
 	LOGP(DMM, level, "UE(%p){NOTSUPPORTED} " fmt, ue, ## args)
 #endif
 
-#define LOGGBP(llme, level, fmt, args...) \
-	LOGP(DMM, level, "LLME(%08x/%08x){%s} " fmt, (llme)->old_tlli, \
+#define LOGGBP(llme, category, level, fmt, args...) \
+	LOGP(category, level, "LLME(%08x/%08x){%s} " fmt, (llme)->old_tlli, \
 	     (llme)->tlli, get_value_string_or_null(gprs_llc_llme_state_names, (llme)->state), ## args);
 
 #define LOGGBIUP(llme, msg, level, fmt, args...) \
 	do { \
 	struct ranap_ue_conn_ctx * _ue; \
 	if (llme) { \
-		LOGGBP(llme, level, fmt, ## args); \
+		LOGGBP(llme, DMM, level, fmt, ## args); \
 	} else if ((msg) && (_ue = MSG_IU_UE_CTX(msg))) { \
 		LOGIUP(_ue, level, fmt, ## args); \
 	} else { OSMO_ASSERT(0); } \
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index 17daa7d..7a09760 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -1625,7 +1625,7 @@
 		if (llme) {
 			/* send a XID reset to re-set all LLC sequence numbers
 			 * in the MS */
-			LOGGBP(llme, LOGL_NOTICE, "LLC XID RESET\n");
+			LOGGBP(llme, DMM, LOGL_NOTICE, "LLC XID RESET\n");
 			gprs_llgmm_reset(llme);
 		}
 		/* The MS has to perform GPRS attach */
@@ -1905,7 +1905,7 @@
 	if (llme && !mmctx &&
 	    gh->msg_type != GSM48_MT_GMM_ATTACH_REQ &&
 	    gh->msg_type != GSM48_MT_GMM_RA_UPD_REQ) {
-		LOGGBP(llme, LOGL_NOTICE, "Cannot handle GMM for unknown MM CTX\n");
+		LOGGBP(llme, DMM, LOGL_NOTICE, "Cannot handle GMM for unknown MM CTX\n");
 		/* 4.7.10 */
 		if (gh->msg_type == GSM48_MT_GMM_STATUS) {
 			/* TLLI unassignment */
diff --git a/src/sgsn/gprs_llc.c b/src/sgsn/gprs_llc.c
index 2a27da8..74789b0 100644
--- a/src/sgsn/gprs_llc.c
+++ b/src/sgsn/gprs_llc.c
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <stdint.h>
 #include <stdbool.h>
+#include <inttypes.h>
 
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/linuxlist.h>
@@ -528,7 +529,7 @@
 		struct gprs_llc_llme *llme;
 		/* FIXME: don't use the TLLI but the 0xFFFF unassigned? */
 		llme = llme_alloc(tlli);
-		LOGP(DLLC, LOGL_NOTICE, "LLC RX: unknown TLLI 0x%08x, "
+		LOGGBP(llme, DLLC, LOGL_NOTICE, "LLC RX: unknown TLLI 0x%08x, "
 			"creating LLME on the fly\n", tlli);
 		lle = &llme->lle[sapi];
 		return lle;
@@ -1048,6 +1049,9 @@
 {
 	unsigned int i;
 
+	LOGGBP(llme, DLLC, LOGL_NOTICE, "LLGM Assign pre (%08x => %08x)\n",
+	       old_tlli, new_tlli);
+
 	if (old_tlli == TLLI_UNASSIGNED && new_tlli != TLLI_UNASSIGNED) {
 		/* TLLI Assignment 8.3.1 */
 		/* New TLLI shall be assigned and used when (re)transmitting LLC frames */
@@ -1091,6 +1095,9 @@
 	} else
 		return -EINVAL;
 
+	LOGGBP(llme, DLLC, LOGL_NOTICE, "LLGM Assign post (%08x => %08x)\n",
+	       old_tlli, new_tlli);
+
 	return 0;
 }
 
@@ -1109,11 +1116,13 @@
 	int xid_bytes_len, rc;
 	uint8_t *xid;
 
-	LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n");
+	LOGGBP(llme, DLLC, LOGL_NOTICE, "LLGM Reset\n");
 
 	rc = osmo_get_rand_id((uint8_t *) &llme->iov_ui, 4);
 	if (rc < 0) {
-		LOGP(DLLC, LOGL_ERROR, "osmo_get_rand_id() failed for LLC XID reset: %s\n", strerror(-rc));
+		LOGGBP(llme, DLLC, LOGL_ERROR,
+		       "osmo_get_rand_id() failed for LLC XID reset: %s\n",
+		       strerror(-rc));
 		return rc;
 	}
 
@@ -1144,11 +1153,13 @@
 	int xid_bytes_len, rc;
 	uint8_t *xid;
 
-	LOGP(DLLC, LOGL_NOTICE, "LLGM Reset\n");
+	LOGGBP(llme, DLLC, LOGL_NOTICE, "LLGM Reset (SAPI=%" PRIu8 ")\n", sapi);
 
 	rc = osmo_get_rand_id((uint8_t *) &llme->iov_ui, 4);
 	if (rc < 0) {
-		LOGP(DLLC, LOGL_ERROR, "osmo_get_rand_id() failed for LLC XID reset: %s\n", strerror(-rc));
+		LOGGBP(llme, DLLC, LOGL_ERROR,
+		       "osmo_get_rand_id() failed for LLC XID reset: %s\n",
+		       strerror(-rc));
 		return rc;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/16147
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Id89cc6760179fb9b1709a30b5d1af41d466b280b
Gerrit-Change-Number: 16147
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191121/31b7b029/attachment.htm>


More information about the gerrit-log mailing list