aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc
diff options
context:
space:
mode:
Diffstat (limited to 'src/osmo-bsc')
-rw-r--r--src/osmo-bsc/bsc_init.c8
-rw-r--r--src/osmo-bsc/bsc_stats.c81
-rw-r--r--src/osmo-bsc/bts.c8
-rw-r--r--src/osmo-bsc/lchan_fsm.c4
4 files changed, 40 insertions, 61 deletions
diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c
index 650a76ba8..c381c0f09 100644
--- a/src/osmo-bsc/bsc_init.c
+++ b/src/osmo-bsc/bsc_init.c
@@ -132,7 +132,7 @@ 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){
+ net->all_allocated.sdcch = (struct osmo_time_cc){
.cfg = {
.gran_usec = 1*1000000,
.forget_sum_usec = 60*1000000,
@@ -143,7 +143,7 @@ static struct gsm_network *bsc_network_init(void *ctx)
.T_defs = net->T_defs,
},
};
- net->all_allocated_static_sdcch = (struct osmo_time_cc){
+ net->all_allocated.static_sdcch = (struct osmo_time_cc){
.cfg = {
.gran_usec = 1*1000000,
.forget_sum_usec = 60*1000000,
@@ -154,7 +154,7 @@ static struct gsm_network *bsc_network_init(void *ctx)
.T_defs = net->T_defs,
},
};
- net->all_allocated_tch = (struct osmo_time_cc){
+ net->all_allocated.tch = (struct osmo_time_cc){
.cfg = {
.gran_usec = 1*1000000,
.forget_sum_usec = 60*1000000,
@@ -165,7 +165,7 @@ static struct gsm_network *bsc_network_init(void *ctx)
.T_defs = net->T_defs,
},
};
- net->all_allocated_static_tch = (struct osmo_time_cc){
+ net->all_allocated.static_tch = (struct osmo_time_cc){
.cfg = {
.gran_usec = 1*1000000,
.forget_sum_usec = 60*1000000,
diff --git a/src/osmo-bsc/bsc_stats.c b/src/osmo-bsc/bsc_stats.c
index b48c90a00..e540f299f 100644
--- a/src/osmo-bsc/bsc_stats.c
+++ b/src/osmo-bsc/bsc_stats.c
@@ -195,67 +195,46 @@ void bsc_update_connection_stats(struct gsm_network *net)
osmo_stat_item_set(osmo_stat_item_group_get_item(net->bsc_statg, BSC_STAT_NUM_TRX_TOTAL), num_trx_total);
/* Make sure to notice cells that become disconnected */
- bsc_update_time_cc_all_allocated(net);
+ all_allocated_update_bsc();
}
-void bsc_update_time_cc_all_allocated(struct gsm_network *net)
+static void all_allocated_update(struct all_allocated *all_allocated, const struct chan_counts *c)
{
- struct gsm_bts *bts;
- struct gsm_bts_trx *trx;
+ osmo_time_cc_set_flag(&all_allocated->sdcch,
+ c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH]
+ && !c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]);
+
+ osmo_time_cc_set_flag(&all_allocated->static_sdcch,
+ c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH]
+ && !c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]);
+
+ osmo_time_cc_set_flag(&all_allocated->tch,
+ (c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F]
+ + c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H])
+ && !(c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]
+ + c->val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]));
+
+ osmo_time_cc_set_flag(&all_allocated->static_tch,
+ (c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F]
+ + c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H])
+ && !(c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]
+ + c->val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]));
+}
+void all_allocated_update_bsc()
+{
+ struct gsm_network *net = bsc_gsmnet;
+ struct gsm_bts *bts;
struct chan_counts bsc_counts;
+
chan_counts_zero(&bsc_counts);
llist_for_each_entry(bts, &net->bts_list, list) {
struct chan_counts bts_counts;
- chan_counts_zero(&bts_counts);
-
- llist_for_each_entry(trx, &bts->trx_list, list) {
- struct chan_counts trx_counts;
- chan_counts_for_trx(&trx_counts, trx);
- chan_counts_add(&bts_counts, &trx_counts);
- }
-
- osmo_time_cc_set_flag(&bts->all_allocated_sdcch,
- bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH]
- && !bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]);
-
- osmo_time_cc_set_flag(&bts->all_allocated_static_sdcch,
- bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH]
- && !bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]);
-
- osmo_time_cc_set_flag(&bts->all_allocated_tch,
- (bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F]
- + bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H])
- && !(bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]
- + bts_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]));
-
- osmo_time_cc_set_flag(&bts->all_allocated_static_tch,
- (bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F]
- + bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H])
- && !(bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]
- + bts_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]));
-
+ chan_counts_for_bts(&bts_counts, bts);
+ all_allocated_update(&bts->all_allocated, &bts_counts);
chan_counts_add(&bsc_counts, &bts_counts);
}
- osmo_time_cc_set_flag(&net->all_allocated_sdcch,
- bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH]
- && !bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]);
-
- osmo_time_cc_set_flag(&net->all_allocated_static_sdcch,
- bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH]
- && !bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]);
-
- osmo_time_cc_set_flag(&net->all_allocated_tch,
- (bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F]
- + bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H])
- && !(bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]
- + bsc_counts.val[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]));
-
- osmo_time_cc_set_flag(&net->all_allocated_static_tch,
- (bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F]
- + bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H])
- && !(bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]
- + bsc_counts.val[CHAN_COUNTS1_STATIC][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]));
+ all_allocated_update(&net->all_allocated, &bsc_counts);
}
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index ad46f54f9..d0adb2a3f 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -216,7 +216,7 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, struct gsm_bts_sm *bts_sm
}
bts->bts_statg = osmo_stat_item_group_alloc(bts, &bts_statg_desc, bts->nr);
- bts->all_allocated_sdcch = (struct osmo_time_cc){
+ bts->all_allocated.sdcch = (struct osmo_time_cc){
.cfg = {
.gran_usec = 1*1000000,
.forget_sum_usec = 60*1000000,
@@ -227,7 +227,7 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, struct gsm_bts_sm *bts_sm
.T_defs = net->T_defs,
},
};
- bts->all_allocated_static_sdcch = (struct osmo_time_cc){
+ bts->all_allocated.static_sdcch = (struct osmo_time_cc){
.cfg = {
.gran_usec = 1*1000000,
.forget_sum_usec = 60*1000000,
@@ -238,7 +238,7 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, struct gsm_bts_sm *bts_sm
.T_defs = net->T_defs,
},
};
- bts->all_allocated_tch = (struct osmo_time_cc){
+ bts->all_allocated.tch = (struct osmo_time_cc){
.cfg = {
.gran_usec = 1*1000000,
.forget_sum_usec = 60*1000000,
@@ -249,7 +249,7 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, struct gsm_bts_sm *bts_sm
.T_defs = net->T_defs,
},
};
- bts->all_allocated_static_tch = (struct osmo_time_cc){
+ bts->all_allocated.static_tch = (struct osmo_time_cc){
.cfg = {
.gran_usec = 1*1000000,
.forget_sum_usec = 60*1000000,
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 1c85ff30e..e3ae4a67f 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -525,7 +525,7 @@ static void lchan_fsm_unused_onenter(struct osmo_fsm_inst *fi, uint32_t prev_sta
lchan_reset(lchan);
osmo_fsm_inst_dispatch(lchan->ts->fi, TS_EV_LCHAN_UNUSED, lchan);
- bsc_update_time_cc_all_allocated(bts->network);
+ all_allocated_update_bsc();
/* Poll the channel request queue, so that waiting calls can make use of the lchan that just
* has become unused now. */
@@ -707,7 +707,7 @@ static void lchan_fsm_wait_ts_ready_onenter(struct osmo_fsm_inst *fi, uint32_t p
return;
}
- bsc_update_time_cc_all_allocated(bts->network);
+ all_allocated_update_bsc();
lchan->conn = info->for_conn;