diff mbox

[1/2] gprs_sgsn.h: Add two macros to log details of MM/PDP contexts

Message ID 5af7979f7bc45ce7aa2249cf812998aaa564b6d4.1409844053.git.daniel@totalueberwachung.de
State Rejected
Headers show

Commit Message

Daniel Willmann Sept. 4, 2014, 3:20 p.m. UTC
---
 openbsc/include/openbsc/gprs_sgsn.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Harald Welte Sept. 8, 2014, 1:11 p.m. UTC | #1
Hi Daniel,

in order to reduce the line length a bit, I would sugegst to change

> +	LOGP(DMM, level, "MM(imsi=%s p-tmsi=0x%08x tlli=0x%08x) " fmt, (mm)->imsi, (mm)->p_tmsi, (mm)->tlli, ## args)

to

> +	LOGP(DMM, level, "MM(%s/%08x/%08x) " fmt, (mm)->imsi, (mm)->p_tmsi, (mm)->tlli, ## args)

or even leave the TLLI away, as I presume if you use the mm-context TLLI
(and not the TLLI that was read from the currently processed message),
then it will be a quite predictable derivate of the P-TMSI anyway.

> +	LOGP(DGPRS, level, "PDP(imsi=%s ti=%u) " fmt, (pdp)->mm->imsi, (pdp)->ti, ## args)

here also one could change it to

> +	LOGP(DGPRS, level, "PDP(%s/%u) " fmt, (pdp)->mm->imsi, (pdp)->ti, ## args)

to save some characers in line length, which
a) make it more difficult to read the log messages on screens of limited
   widdth

b) reduce the log file size as it accumulates over time.

Apart from that the patches should be merged, from my point of view.

Regards,
	Harald
diff mbox

Patch

diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h
index 6e7c677..6a02637 100644
--- a/openbsc/include/openbsc/gprs_sgsn.h
+++ b/openbsc/include/openbsc/gprs_sgsn.h
@@ -113,6 +113,9 @@  struct sgsn_mm_ctx {
 	uint8_t			t3370_id_type;
 };
 
+#define LOGMMCTXP(level, mm, fmt, args...) \
+	LOGP(DMM, level, "MM(imsi=%s p-tmsi=0x%08x tlli=0x%08x) " fmt, (mm)->imsi, (mm)->p_tmsi, (mm)->tlli, ## args)
+
 /* 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);
@@ -176,6 +179,8 @@  struct sgsn_pdp_ctx {
 	unsigned int		num_T_exp;	/* number of consecutive T expirations */
 };
 
+#define LOGPDPCTXP(level, pdp, fmt, args...) \
+	LOGP(DGPRS, level, "PDP(imsi=%s ti=%u) " fmt, (pdp)->mm->imsi, (pdp)->ti, ## args)
 
 /* look up PDP context by MM context and NSAPI */
 struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_nsapi(const struct sgsn_mm_ctx *mm,