diff options
Diffstat (limited to 'src/osmo-bsc/bsc_init.c')
-rw-r--r-- | src/osmo-bsc/bsc_init.c | 93 |
1 files changed, 79 insertions, 14 deletions
diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c index 7e839532a..c381c0f09 100644 --- a/src/osmo-bsc/bsc_init.c +++ b/src/osmo-bsc/bsc_init.c @@ -38,6 +38,7 @@ #include <osmocom/bsc/neighbor_ident.h> #include <osmocom/bsc/bts.h> #include <osmocom/bsc/lb.h> +#include <osmocom/bsc/bsc_stats.h> #include <osmocom/bsc/smscb.h> #include <osmocom/gsm/protocol/gsm_48_049.h> @@ -46,17 +47,7 @@ #include <limits.h> #include <stdbool.h> -static const struct osmo_stat_item_desc bsc_stat_desc[] = { - { "num_bts:total", "Number of configured BTS for this BSC", "", 16, 0 }, -}; - -static const struct osmo_stat_item_group_desc bsc_statg_desc = { - .group_name_prefix = "bsc", - .group_description = "base station controller", - .class_id = OSMO_STATS_CLASS_GLOBAL, - .num_items = ARRAY_SIZE(bsc_stat_desc), - .item_desc = bsc_stat_desc, -}; +struct gsm_network *bsc_gsmnet; int bsc_shutdown_net(struct gsm_network *net) { @@ -85,6 +76,30 @@ static void update_t3122_chan_load_timer(void *data) osmo_timer_schedule(&net->t3122_chan_load_timer, T3122_CHAN_LOAD_SAMPLE_INTERVAL, 0); } +static void bsc_store_bts_uptime(void *data) +{ + struct gsm_network *net = data; + struct gsm_bts *bts; + + llist_for_each_entry(bts, &net->bts_list, list) + bts_store_uptime(bts); + + /* Keep this timer ticking. */ + osmo_timer_schedule(&net->bts_store_uptime_timer, BTS_STORE_UPTIME_INTERVAL, 0); +} + +static void bsc_store_bts_lchan_durations(void *data) +{ + struct gsm_network *net = data; + struct gsm_bts *bts; + + llist_for_each_entry(bts, &net->bts_list, list) + bts_store_lchan_durations(bts); + + /* Keep this timer ticking. */ + osmo_timer_schedule(&net->bts_store_lchan_durations_timer, BTS_STORE_LCHAN_DURATIONS_INTERVAL, 0); +} + static struct gsm_network *bsc_network_init(void *ctx) { struct gsm_network *net = gsm_network_init(ctx); @@ -100,7 +115,6 @@ static struct gsm_network *bsc_network_init(void *ctx) net->ho = ho_cfg_init(net, NULL); net->hodec2.congestion_check_interval_s = HO_CFG_CONGESTION_CHECK_DEFAULT; - net->neighbor_bss_cells = neighbor_ident_init(net); /* init statistics */ net->bsc_ctrs = rate_ctr_group_alloc(net, &bsc_ctrg_desc, 0); @@ -118,6 +132,51 @@ static struct gsm_network *bsc_network_init(void *ctx) if (!net->bts_unknown_statg) goto err_free_all; + net->all_allocated.sdcch = (struct osmo_time_cc){ + .cfg = { + .gran_usec = 1*1000000, + .forget_sum_usec = 60*1000000, + .rate_ctr = rate_ctr_group_get_ctr(net->bsc_ctrs, BSC_CTR_ALL_ALLOCATED_SDCCH), + .T_gran = -16, + .T_round_threshold = -17, + .T_forget_sum = -18, + .T_defs = net->T_defs, + }, + }; + net->all_allocated.static_sdcch = (struct osmo_time_cc){ + .cfg = { + .gran_usec = 1*1000000, + .forget_sum_usec = 60*1000000, + .rate_ctr = rate_ctr_group_get_ctr(net->bsc_ctrs, BSC_CTR_ALL_ALLOCATED_STATIC_SDCCH), + .T_gran = -16, + .T_round_threshold = -17, + .T_forget_sum = -18, + .T_defs = net->T_defs, + }, + }; + net->all_allocated.tch = (struct osmo_time_cc){ + .cfg = { + .gran_usec = 1*1000000, + .forget_sum_usec = 60*1000000, + .rate_ctr = rate_ctr_group_get_ctr(net->bsc_ctrs, BSC_CTR_ALL_ALLOCATED_TCH), + .T_gran = -16, + .T_round_threshold = -17, + .T_forget_sum = -18, + .T_defs = net->T_defs, + }, + }; + net->all_allocated.static_tch = (struct osmo_time_cc){ + .cfg = { + .gran_usec = 1*1000000, + .forget_sum_usec = 60*1000000, + .rate_ctr = rate_ctr_group_get_ctr(net->bsc_ctrs, BSC_CTR_ALL_ALLOCATED_STATIC_TCH), + .T_gran = -16, + .T_round_threshold = -17, + .T_forget_sum = -18, + .T_defs = net->T_defs, + }, + }; + INIT_LLIST_HEAD(&net->bts_rejected); gsm_net_update_ctype(net); @@ -129,6 +188,14 @@ static struct gsm_network *bsc_network_init(void *ctx) osmo_timer_setup(&net->t3122_chan_load_timer, update_t3122_chan_load_timer, net); osmo_timer_schedule(&net->t3122_chan_load_timer, T3122_CHAN_LOAD_SAMPLE_INTERVAL, 0); + /* Init uptime tracking timer. */ + osmo_timer_setup(&net->bts_store_uptime_timer, bsc_store_bts_uptime, net); + osmo_timer_schedule(&net->bts_store_uptime_timer, BTS_STORE_UPTIME_INTERVAL, 0); + + /* Init lchan duration tracking timer. */ + osmo_timer_setup(&net->bts_store_lchan_durations_timer, bsc_store_bts_lchan_durations, net); + osmo_timer_schedule(&net->bts_store_lchan_durations_timer, BTS_STORE_LCHAN_DURATIONS_INTERVAL, 0); + net->cbc->net = net; net->cbc->mode = BSC_CBC_LINK_MODE_DISABLED; net->cbc->server.local_addr = bsc_cbc_default_server_local_addr; @@ -137,8 +204,6 @@ static struct gsm_network *bsc_network_init(void *ctx) net->cbc->client.remote_addr = (struct osmo_sockaddr_str){ .port = CBSP_TCP_PORT, }; net->cbc->client.local_addr = (struct osmo_sockaddr_str){}; - net->smlc.ctrs = rate_ctr_group_alloc(net, &smlc_ctrg_desc, 0); - return net; err_free_all: |