aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/bsc_init.c
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-08-20 15:37:35 +0200
committerlaforge <laforge@osmocom.org>2020-08-24 07:41:43 +0000
commitaa420cec14635614ab2f1c825c322668b524b42f (patch)
treecba90bdcb16c645df56592d7bf6fbd0532afc913 /src/osmo-bsc/bsc_init.c
parentbf2a4b69d86337ff56ec5cdf02a4fb12d5cd6217 (diff)
Add bts counters to count BTS events where we don't have a bts
In some (error-) cases we might be unable to determine which BTS to use when counting handover events. We don't want to loose these events because then ctr(bsc) == sum(ctr(bsc->bts)) would not be true anymore. Those events are now counted by a counter in struct gsm_network which uses an index that is out of range for regular BTS (65536). Change-Id: Ic0f3edd5dc014c4eac5e8423133633a3e5d4c13e Related: SYS#4877
Diffstat (limited to 'src/osmo-bsc/bsc_init.c')
-rw-r--r--src/osmo-bsc/bsc_init.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c
index e45b5e8e3..22eba50d1 100644
--- a/src/osmo-bsc/bsc_init.c
+++ b/src/osmo-bsc/bsc_init.c
@@ -90,8 +90,7 @@ static struct gsm_network *bsc_network_init(void *ctx)
net->cbc = talloc_zero(net, struct bsc_cbc_link);
if (!net->cbc) {
- talloc_free(net);
- return NULL;
+ goto err_out;
}
/* Init back pointer */
@@ -104,16 +103,19 @@ static struct gsm_network *bsc_network_init(void *ctx)
/* init statistics */
net->bsc_ctrs = rate_ctr_group_alloc(net, &bsc_ctrg_desc, 0);
- if (!net->bsc_ctrs) {
- talloc_free(net);
- return NULL;
- }
+ if (!net->bsc_ctrs)
+ goto err_out;
net->bsc_statg = osmo_stat_item_group_alloc(net, &bsc_statg_desc, 0);
- if (!net->bsc_statg) {
- rate_ctr_group_free(net->bsc_ctrs);
- talloc_free(net);
- return NULL;
- }
+ if (!net->bsc_statg)
+ goto err_free_bsc_ctr;
+
+ /* init statistics */
+ net->bts_unknown_ctrs = rate_ctr_group_alloc(net, &bts_ctrg_desc, BTS_STAT_IDX_UNKNOWN);
+ if (!net->bts_unknown_ctrs)
+ goto err_free_bsc_ctr_stat;
+ net->bts_unknown_statg = osmo_stat_item_group_alloc(net, &bts_statg_desc, BTS_STAT_IDX_UNKNOWN);
+ if (!net->bts_unknown_statg)
+ goto err_free_all;
INIT_LLIST_HEAD(&net->bts_rejected);
gsm_net_update_ctype(net);
@@ -134,6 +136,16 @@ static struct gsm_network *bsc_network_init(void *ctx)
net->cbc->config.listen_hostname = talloc_strdup(net->cbc, "127.0.0.1");
return net;
+
+err_free_all:
+ rate_ctr_group_free(net->bts_unknown_ctrs);
+err_free_bsc_ctr_stat:
+ osmo_stat_item_group_free(net->bsc_statg);
+err_free_bsc_ctr:
+ rate_ctr_group_free(net->bsc_ctrs);
+err_out:
+ talloc_free(net);
+ return NULL;
}
int bsc_network_alloc(void)