laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-hnbgw/+/36212?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 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(-)
Approvals:
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
osmith: Looks good to me, approved
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index 4d59560..008f49f 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -203,6 +203,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 7720416..7e4a3cd 100644
--- a/src/osmo-hnbgw/hnbgw_cn.c
+++ b/src/osmo-hnbgw/hnbgw_cn.c
@@ -1053,7 +1053,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;
}
@@ -1090,9 +1090,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;
}
@@ -1105,7 +1105,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: 4
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged