Change in osmo-sgsn[master]: gbproxy: Introduce new DOBJ log category; log object allocation/release

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

laforge gerrit-no-reply at lists.osmocom.org
Tue Dec 8 21:58:44 UTC 2020


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


Change subject: gbproxy: Introduce new DOBJ log category; log object allocation/release
......................................................................

gbproxy: Introduce new DOBJ log category; log object allocation/release

Related: OS#4472
Change-Id: I43bcbcda8667d193e7a17fd8e8e9109597b01484
---
M include/osmocom/sgsn/debug.h
M include/osmocom/sgsn/gb_proxy.h
M src/gbproxy/gb_proxy_main.c
M src/gbproxy/gb_proxy_peer.c
4 files changed, 29 insertions(+), 0 deletions(-)



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

diff --git a/include/osmocom/sgsn/debug.h b/include/osmocom/sgsn/debug.h
index 29d500d..4e11639 100644
--- a/include/osmocom/sgsn/debug.h
+++ b/include/osmocom/sgsn/debug.h
@@ -40,6 +40,7 @@
 	DIUCS,
 	DSIGTRAN,
 	DGTP,
+	DOBJ,
 	Debug_LastEntry,
 };
 
diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h
index e61b991..8892cf4 100644
--- a/include/osmocom/sgsn/gb_proxy.h
+++ b/include/osmocom/sgsn/gb_proxy.h
@@ -142,6 +142,11 @@
 #define LOGPBVC(BVC, LEVEL, FMT, ARGS...) \
 	LOGPBVC_CAT(BVC, DGPRS, LEVEL, FMT, ## ARGS)
 
+#define LOGPCELL_CAT(CELL, SUBSYS, LEVEL, FMT, ARGS...) \
+	LOGP(SUBSYS, LEVEL, "CELL(%05u) " FMT, (CELL)->bvci, ## ARGS)
+#define LOGPCELL(CELL, LEVEL, FMT, ARGS...) \
+	LOGPCELL_CAT(CELL, DGPRS, LEVEL, FMT, ## ARGS)
+
 /* gb_proxy_vty .c */
 
 int gbproxy_vty_init(void);
diff --git a/src/gbproxy/gb_proxy_main.c b/src/gbproxy/gb_proxy_main.c
index 52b1042..9c1daa1 100644
--- a/src/gbproxy/gb_proxy_main.c
+++ b/src/gbproxy/gb_proxy_main.c
@@ -214,6 +214,12 @@
 		.description = "GPRS BSS Gateway Protocol (BSSGP)",
 		.enabled = 1, .loglevel = LOGL_DEBUG,
 	},
+	[DOBJ] = {
+		.name = "DOBJ",
+		.description = "GbProxy object allocation/release",
+		.enabled = 1,
+		.color = "\033[38;5;121m"
+	},
 };
 
 static const struct log_info gprs_log_info = {
diff --git a/src/gbproxy/gb_proxy_peer.c b/src/gbproxy/gb_proxy_peer.c
index ed7df32..c38b2f7 100644
--- a/src/gbproxy/gb_proxy_peer.c
+++ b/src/gbproxy/gb_proxy_peer.c
@@ -86,6 +86,11 @@
 
 	hash_add(nse->bvcs, &bvc->list, bvc->bvci);
 
+	LOGPBVC_CAT(bvc, DOBJ, LOGL_INFO, "BVC Created\n");
+
+	/* We leave allocating the bvc->fi to the caller, as the FSM details depend
+	 * on the type of BVC (SIG/PTP) and role (SGSN/BSS) */
+
         return bvc;
 }
 
@@ -96,6 +101,8 @@
 	if (!bvc)
 		return;
 
+	LOGPBVC_CAT(bvc, DOBJ, LOGL_INFO, "BVC Destroying\n");
+
 	hash_del(&bvc->list);
 
 	rate_ctr_group_free(bvc->ctrg);
@@ -167,6 +174,8 @@
 
 	hash_add(cfg->cells, &cell->list, cell->bvci);
 
+	LOGPCELL_CAT(cell, DOBJ, LOGL_INFO, "CELL Created\n");
+
 	return cell;
 }
 
@@ -201,6 +210,8 @@
 	if (!cell)
 		return;
 
+	LOGPCELL_CAT(cell, DOBJ, LOGL_INFO, "CELL Destroying\n");
+
 	/* remove from cfg.cells */
 	hash_del(&cell->list);
 
@@ -225,6 +236,8 @@
 	for (i = 0; i < ARRAY_SIZE(cell->sgsn_bvc); i++) {
 		if (!cell->sgsn_bvc[i]) {
 			cell->sgsn_bvc[i] = bvc;
+			LOGPCELL_CAT(cell, DOBJ, LOGL_DEBUG, "CELL linked to SGSN\n");
+			LOGPBVC_CAT(bvc, DOBJ, LOGL_DEBUG, "BVC linked to CELL\n");
 			return true;
 		}
 	}
@@ -255,6 +268,8 @@
 
 	hash_init(nse->bvcs);
 
+	LOGPNSE_CAT(nse, DOBJ, LOGL_INFO, "NSE Created\n");
+
 	return nse;
 }
 
@@ -267,6 +282,8 @@
 	if (!nse)
 		return;
 
+	LOGPNSE_CAT(nse, DOBJ, LOGL_INFO, "NSE Destroying\n");
+
 	hash_del(&nse->list);
 
 	hash_for_each_safe(nse->bvcs, i, tmp, bvc, list)

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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I43bcbcda8667d193e7a17fd8e8e9109597b01484
Gerrit-Change-Number: 21614
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201208/c8f85b15/attachment.htm>


More information about the gerrit-log mailing list