laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36211?usp=email )
Change subject: stats: Introduce CNLINK counter macros
......................................................................
stats: Introduce CNLINK counter macros
Ever since the ancient days of OpenBSC, we've always had macros to
abbreviate the cumbersome 'rate_ctr_inc(rate_ctr_group_get_ctr(...))'
construct. Somehow this was missed here.
Also, since 2018 (libosmocore.git 175a4ae93aaf1068b61041dca12962059d65ed55)
we have rate_ctr_inc2() to make it even simpler...
Change-Id: I2754d7aa9d6c3e333bd729bc6e924c502b40cdad
---
M include/osmocom/hnbgw/hnbgw.h
M src/osmo-hnbgw/hnbgw_cn.c
2 files changed, 25 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/11/36211/1
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index 4d40c57..51b191a 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -245,6 +245,8 @@
#define LOG_CNLINK(CNLINK, SUBSYS, LEVEL, FMT, ARGS...) \
LOGP(SUBSYS, LEVEL, "(%s) " FMT, (CNLINK) ? (CNLINK)->name :
"null", ##ARGS)
+#define CNLINK_CTR_INC(cnlink, x) rate_ctr_inc2((cnlink)->ctrs, x)
+
struct hnbgw_cnlink *cnlink_get_nr(struct hnbgw_cnpool *cnpool, int nr, bool
create_if_missing);
static inline bool cnlink_is_cs(const struct hnbgw_cnlink *cnlink)
diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c
index 7c75bc7..fb8ea58 100644
--- a/src/osmo-hnbgw/hnbgw_cn.c
+++ b/src/osmo-hnbgw/hnbgw_cn.c
@@ -990,7 +990,7 @@
if (cnlink) {
LOG_MAP(map, DCN, LOGL_INFO, "CN link paging record selects %s %d\n",
cnpool->peer_name,
cnlink->nr);
- rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs,
CNLINK_CTR_CNPOOL_SUBSCR_PAGED));
+ CNLINK_CTR_INC(cnlink, CNLINK_CTR_CNPOOL_SUBSCR_PAGED);
return cnlink;
}
/* If there is no match, go on with other ways */
@@ -1040,7 +1040,7 @@
if (nri_matches_cnlink) {
LOG_NRI(LOGL_DEBUG, "NRI matches %s %d, but this %s is currently not
connected\n",
cnpool->peer_name, cnlink->nr, cnpool->peer_name);
- rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs,
CNLINK_CTR_CNPOOL_SUBSCR_ATTACH_LOST));
+ CNLINK_CTR_INC(cnlink, CNLINK_CTR_CNPOOL_SUBSCR_ATTACH_LOST);
}
continue;
}
@@ -1052,9 +1052,9 @@
cnpool->peer_name, cnlink->nr);
} else {
LOG_NRI(LOGL_INFO, "NRI match selects %s %d\n", cnpool->peer_name,
cnlink->nr);
- rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs,
CNLINK_CTR_CNPOOL_SUBSCR_KNOWN));
+ CNLINK_CTR_INC(cnlink, CNLINK_CTR_CNPOOL_SUBSCR_KNOWN);
if (map->l3.is_emerg) {
- rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs,
CNLINK_CTR_CNPOOL_EMERG_FORWARDED));
+ CNLINK_CTR_INC(cnlink, CNLINK_CTR_CNPOOL_EMERG_FORWARDED);
rate_ctr_inc(rate_ctr_group_get_ctr(cnpool->ctrs, CNPOOL_CTR_EMERG_FORWARDED));
}
return cnlink;
@@ -1101,12 +1101,12 @@
LOG_MAP(map, DCN, LOGL_INFO, "CN link round-robin selects %s %d\n",
cnpool->peer_name, cnlink->nr);
if (is_null_nri)
- rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs,
CNLINK_CTR_CNPOOL_SUBSCR_REATTACH));
+ CNLINK_CTR_INC(cnlink, CNLINK_CTR_CNPOOL_SUBSCR_REATTACH);
else
- rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs, CNLINK_CTR_CNPOOL_SUBSCR_NEW));
+ CNLINK_CTR_INC(cnlink, CNLINK_CTR_CNPOOL_SUBSCR_NEW);
if (map->l3.is_emerg) {
- rate_ctr_inc(rate_ctr_group_get_ctr(cnlink->ctrs,
CNLINK_CTR_CNPOOL_EMERG_FORWARDED));
+ CNLINK_CTR_INC(cnlink, CNLINK_CTR_CNPOOL_EMERG_FORWARDED);
rate_ctr_inc(rate_ctr_group_get_ctr(cnpool->ctrs, CNPOOL_CTR_EMERG_FORWARDED));
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36211?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I2754d7aa9d6c3e333bd729bc6e924c502b40cdad
Gerrit-Change-Number: 36211
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange