aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-08-14 16:08:15 +0200
committerpespin <pespin@sysmocom.de>2019-08-20 10:34:29 +0000
commit5b6c4b8ccd1ecde31f5764fe3fcd7837bfc37ab4 (patch)
treeef18ac680daea7d39c565044a937da7febe4838a /include
parent2179dec71d00bb794f6770b1a8925ac13e95e03f (diff)
Introduce and use log macros when no mm ctx available
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/sgsn/gprs_llc.h1
-rw-r--r--include/osmocom/sgsn/gprs_sgsn.h22
2 files changed, 23 insertions, 0 deletions
diff --git a/include/osmocom/sgsn/gprs_llc.h b/include/osmocom/sgsn/gprs_llc.h
index 8a0b9efb..ce0e63c5 100644
--- a/include/osmocom/sgsn/gprs_llc.h
+++ b/include/osmocom/sgsn/gprs_llc.h
@@ -96,6 +96,7 @@ enum gprs_llc_llme_state {
GPRS_LLMS_UNASSIGNED = 1, /* No TLLI yet */
GPRS_LLMS_ASSIGNED = 2, /* TLLI assigned */
};
+extern const struct value_string gprs_llc_llme_state_names[];
/* Section 8.9.9 LLC layer parameter default values */
struct gprs_llc_params {
diff --git a/include/osmocom/sgsn/gprs_sgsn.h b/include/osmocom/sgsn/gprs_sgsn.h
index 10455d67..9753ea21 100644
--- a/include/osmocom/sgsn/gprs_sgsn.h
+++ b/include/osmocom/sgsn/gprs_sgsn.h
@@ -262,6 +262,28 @@ static inline bool sgsn_mm_ctx_is_authenticated(struct sgsn_mm_ctx *ctx)
LOGP(DMM, level, "MM(%s/%08x) " fmt, (mm) ? (mm)->imsi : "---", \
(mm) ? (mm)->p_tmsi : GSM_RESERVED_TMSI, ## args)
+#ifdef BUILD_IU
+#define LOGIUP(ue, level, fmt, args...) \
+ LOGP(DMM, level, "UE(0x%x){%s} " fmt, ue->conn_id, osmo_rai_name(&(ue)->ra_id), ## args)
+#else
+#define LOGIUP(ue, level, fmt, args...) \
+ 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, \
+ (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); \
+ } else if ((msg) && (_ue = MSG_IU_UE_CTX(msg))) { \
+ LOGIUP(_ue, level, fmt, ## args); \
+ } else { OSMO_ASSERT(0); } \
+ } while (0)
+
/* look-up a SGSN MM context based on TLLI + RAI */
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli,
const struct gprs_ra_id *raid);