laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36211?usp=email )
(
2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )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(-)
Approvals: pespin: Looks good to me, but someone else must approve osmith: Looks good to me, approved Jenkins Builder: Verified
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h index 3653838..4d59560 100644 --- a/include/osmocom/hnbgw/hnbgw.h +++ b/include/osmocom/hnbgw/hnbgw.h @@ -240,6 +240,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 31bf192..7720416 100644 --- a/src/osmo-hnbgw/hnbgw_cn.c +++ b/src/osmo-hnbgw/hnbgw_cn.c @@ -988,7 +988,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 */ @@ -1038,7 +1038,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; } @@ -1050,9 +1050,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; @@ -1099,12 +1099,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)); }