aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-12-07 12:03:10 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2020-12-10 18:06:34 +0100
commit7cb76a4321368bcdc87e9bd9dce99584dec53a56 (patch)
treeeafac68e53aaecc028e2fc5e21493dbff86048e9
parentc91f53ca0ae20c1a371ed94b6565acc7cc3571e5 (diff)
gbproxy: Introduce new DOBJ log category; log object allocation/release
-rw-r--r--include/osmocom/sgsn/debug.h1
-rw-r--r--include/osmocom/sgsn/gb_proxy.h5
-rw-r--r--src/gbproxy/gb_proxy_main.c6
-rw-r--r--src/gbproxy/gb_proxy_peer.c17
4 files changed, 29 insertions, 0 deletions
diff --git a/include/osmocom/sgsn/debug.h b/include/osmocom/sgsn/debug.h
index 507b70c11..da819d562 100644
--- a/include/osmocom/sgsn/debug.h
+++ b/include/osmocom/sgsn/debug.h
@@ -39,6 +39,7 @@ enum {
DIUCS,
DSIGTRAN,
DGTP,
+ DOBJ,
Debug_LastEntry,
};
diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h
index e61b99101..8892cf4df 100644
--- a/include/osmocom/sgsn/gb_proxy.h
+++ b/include/osmocom/sgsn/gb_proxy.h
@@ -142,6 +142,11 @@ struct gbproxy_nse {
#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 318f3dc87..7ef930246 100644
--- a/src/gbproxy/gb_proxy_main.c
+++ b/src/gbproxy/gb_proxy_main.c
@@ -209,6 +209,12 @@ static struct log_info_cat gprs_categories[] = {
.description = "GPRS Network Service (NS)",
.enabled = 1, .loglevel = LOGL_INFO,
},
+ [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 ed7df3200..c38b2f756 100644
--- a/src/gbproxy/gb_proxy_peer.c
+++ b/src/gbproxy/gb_proxy_peer.c
@@ -86,6 +86,11 @@ struct gbproxy_bvc *gbproxy_bvc_alloc(struct gbproxy_nse *nse, uint16_t bvci)
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 @@ void gbproxy_bvc_free(struct gbproxy_bvc *bvc)
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 @@ struct gbproxy_cell *gbproxy_cell_alloc(struct gbproxy_config *cfg, uint16_t bvc
hash_add(cfg->cells, &cell->list, cell->bvci);
+ LOGPCELL_CAT(cell, DOBJ, LOGL_INFO, "CELL Created\n");
+
return cell;
}
@@ -201,6 +210,8 @@ void gbproxy_cell_free(struct gbproxy_cell *cell)
if (!cell)
return;
+ LOGPCELL_CAT(cell, DOBJ, LOGL_INFO, "CELL Destroying\n");
+
/* remove from cfg.cells */
hash_del(&cell->list);
@@ -225,6 +236,8 @@ bool gbproxy_cell_add_sgsn_bvc(struct gbproxy_cell *cell, struct gbproxy_bvc *bv
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 @@ struct gbproxy_nse *gbproxy_nse_alloc(struct gbproxy_config *cfg, uint16_t nsei,
hash_init(nse->bvcs);
+ LOGPNSE_CAT(nse, DOBJ, LOGL_INFO, "NSE Created\n");
+
return nse;
}
@@ -267,6 +282,8 @@ void gbproxy_nse_free(struct gbproxy_nse *nse)
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)