laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36212?usp=email )
Change subject: stats: Introduce CNPOOL counter macro
......................................................................
stats: Introduce CNPOOL counter macro
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: I5b9e6b2069eed533c472cea8483a370f7fcc8e74
---
M include/osmocom/hnbgw/hnbgw.h
M src/osmo-hnbgw/hnbgw_cn.c
2 files changed, 22 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/12/36212/1
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index 51b191a..9fb6d98 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -208,6 +208,8 @@
struct rate_ctr_group *ctrs;
};
+#define CNPOOL_CTR_INC(cnpool, x) rate_ctr_inc2((cnpool)->ctrs, x)
+
/* A CN peer, like 'msc 0' or 'sgsn 23' */
struct hnbgw_cnlink {
struct llist_head entry;
diff --git a/src/osmo-hnbgw/hnbgw_cn.c b/src/osmo-hnbgw/hnbgw_cn.c
index fb8ea58..63e233c 100644
--- a/src/osmo-hnbgw/hnbgw_cn.c
+++ b/src/osmo-hnbgw/hnbgw_cn.c
@@ -1055,7 +1055,7 @@
CNLINK_CTR_INC(cnlink, CNLINK_CTR_CNPOOL_SUBSCR_KNOWN);
if (map->l3.is_emerg) {
CNLINK_CTR_INC(cnlink, CNLINK_CTR_CNPOOL_EMERG_FORWARDED);
- rate_ctr_inc(rate_ctr_group_get_ctr(cnpool->ctrs, CNPOOL_CTR_EMERG_FORWARDED));
+ CNPOOL_CTR_INC(cnpool, CNPOOL_CTR_EMERG_FORWARDED);
}
return cnlink;
}
@@ -1092,9 +1092,9 @@
* them are usable -- wrap to the start. */
cnlink = round_robin_next ? : round_robin_first;
if (!cnlink) {
- rate_ctr_inc(rate_ctr_group_get_ctr(cnpool->ctrs, CNPOOL_CTR_SUBSCR_NO_CNLINK));
+ CNPOOL_CTR_INC(cnpool, CNPOOL_CTR_SUBSCR_NO_CNLINK);
if (map->l3.is_emerg)
- rate_ctr_inc(rate_ctr_group_get_ctr(cnpool->ctrs, CNPOOL_CTR_EMERG_LOST));
+ CNPOOL_CTR_INC(cnpool, CNPOOL_CTR_EMERG_LOST);
return NULL;
}
@@ -1107,7 +1107,7 @@
if (map->l3.is_emerg) {
CNLINK_CTR_INC(cnlink, CNLINK_CTR_CNPOOL_EMERG_FORWARDED);
- rate_ctr_inc(rate_ctr_group_get_ctr(cnpool->ctrs, CNPOOL_CTR_EMERG_FORWARDED));
+ CNPOOL_CTR_INC(cnpool, CNPOOL_CTR_EMERG_FORWARDED);
}
/* A CN link was picked by round-robin, so update the next round-robin nr to pick */
--
To view, visit
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36212?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: I5b9e6b2069eed533c472cea8483a370f7fcc8e74
Gerrit-Change-Number: 36212
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange