aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2021-09-27 08:56:20 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2021-10-19 23:18:21 +0200
commita2db5465a6fb02e2b3d705c9dededf92ab7e5daf (patch)
tree8690e03ff00e1fde15aa7210a0672cf8021060a9
parentf37528acf3d83fdabbb4c4f77b2c67793f61204a (diff)
implement allAllocated{SDCCH,TCH} time countersneels/time_cc
-rw-r--r--include/osmocom/bsc/bsc_stats.h3
-rw-r--r--include/osmocom/bsc/bts.h5
-rw-r--r--include/osmocom/bsc/gsm_data.h4
-rw-r--r--src/osmo-bsc/bsc_init.c23
-rw-r--r--src/osmo-bsc/bsc_stats.c72
-rw-r--r--src/osmo-bsc/bts.c29
-rw-r--r--src/osmo-bsc/lchan_fsm.c5
-rw-r--r--src/osmo-bsc/net_init.c11
8 files changed, 152 insertions, 0 deletions
diff --git a/include/osmocom/bsc/bsc_stats.h b/include/osmocom/bsc/bsc_stats.h
index 4250079bf..9a2f36cbf 100644
--- a/include/osmocom/bsc/bsc_stats.h
+++ b/include/osmocom/bsc/bsc_stats.h
@@ -81,6 +81,8 @@ enum {
BSC_CTR_MSCPOOL_SUBSCR_NO_MSC,
BSC_CTR_MSCPOOL_EMERG_FORWARDED,
BSC_CTR_MSCPOOL_EMERG_LOST,
+ BSC_CTR_ALL_ALLOCATED_SDCCH,
+ BSC_CTR_ALL_ALLOCATED_TCH,
};
extern const struct rate_ctr_desc bsc_ctr_description[];
@@ -105,3 +107,4 @@ enum {
extern const struct osmo_stat_item_group_desc bsc_statg_desc;
void bsc_update_connection_stats(struct gsm_network *net);
+void bsc_update_time_cc_all_allocated(struct gsm_network *net);
diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index 2cc6b153c..91b17626c 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -144,6 +144,8 @@ enum bts_counter_id {
BTS_CTR_SRVCC_TIMEOUT,
BTS_CTR_SRVCC_FAILED,
BTS_CTR_SRVCC_ERROR,
+ BTS_CTR_ALL_ALLOCATED_SDCCH,
+ BTS_CTR_ALL_ALLOCATED_TCH,
};
extern const struct rate_ctr_desc bts_ctr_description[];
@@ -576,6 +578,9 @@ struct gsm_bts {
/* At what point in the channel allocation sequence to dispatch the Immediate Assignment (Abis optimization) */
enum imm_ass_time imm_ass_time;
+
+ struct time_cc all_allocated_sdcch;
+ struct time_cc all_allocated_tch;
};
#define GSM_BTS_SI2Q(bts, i) (struct gsm48_system_information_type_2quater *)((bts)->si_buf[SYSINFO_TYPE_2quater][i])
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 0d849ba01..158e04574 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -32,6 +32,7 @@
#include <osmocom/bsc/meas_rep.h>
#include <osmocom/bsc/acc.h>
#include <osmocom/bsc/osmux.h>
+#include <osmocom/bsc/time_cc.h>
#define GSM_T3122_DEFAULT 10
@@ -1259,6 +1260,9 @@ struct gsm_network {
struct osmo_nri_ranges *null_nri_ranges;
struct smlc_config *smlc;
+
+ struct time_cc all_allocated_sdcch;
+ struct time_cc all_allocated_tch;
};
struct gsm_audio_support {
diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c
index bf150cb40..92e8899ee 100644
--- a/src/osmo-bsc/bsc_init.c
+++ b/src/osmo-bsc/bsc_init.c
@@ -120,6 +120,29 @@ static struct gsm_network *bsc_network_init(void *ctx)
if (!net->bts_unknown_statg)
goto err_free_all;
+ net->all_allocated_sdcch = (struct time_cc){
+ .cfg = {
+ .gran_usec = 1*1000000,
+ .reset_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_reset_sum = -18,
+ .T_defs = net->T_defs,
+ },
+ };
+ net->all_allocated_tch = (struct time_cc){
+ .cfg = {
+ .gran_usec = 1*1000000,
+ .reset_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_reset_sum = -18,
+ .T_defs = net->T_defs,
+ },
+ };
+
INIT_LLIST_HEAD(&net->bts_rejected);
gsm_net_update_ctype(net);
diff --git a/src/osmo-bsc/bsc_stats.c b/src/osmo-bsc/bsc_stats.c
index 717680956..62f86a9f6 100644
--- a/src/osmo-bsc/bsc_stats.c
+++ b/src/osmo-bsc/bsc_stats.c
@@ -102,6 +102,8 @@ const struct rate_ctr_desc bsc_ctr_description[] = {
"Emergency call requests forwarded to an MSC (see also per-MSC counters"},
[BSC_CTR_MSCPOOL_EMERG_LOST] = {"mscpool:emerg:lost",
"Emergency call requests lost because no MSC was found available"},
+ [BSC_CTR_ALL_ALLOCATED_SDCCH] = {"all_allocated:sdcch", "Cumulative counter of seconds where all SDCCH channels were allocated"},
+ [BSC_CTR_ALL_ALLOCATED_TCH] = {"all_allocated:tch", "Cumulative counter of seconds where all TCH channels were allocated"},
};
const struct rate_ctr_group_desc bsc_ctrg_desc = {
@@ -185,4 +187,74 @@ 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_RSL_CONNECTED),
trx_rsl_connected_total);
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);
+}
+
+void bsc_update_time_cc_all_allocated(struct gsm_network *net)
+{
+ struct gsm_bts *bts;
+ struct gsm_bts_trx *trx;
+
+ int sdcch_max = 0;
+ int sdcch_current = 0;
+ int sdcch_allocated = 0;
+ int tch_max = 0;
+ int tch_current = 0;
+ int tch_allocated = 0;
+
+ llist_for_each_entry(bts, &net->bts_list, list) {
+ int bts_sdcch_max = 0;
+ int bts_sdcch_current = 0;
+ int bts_sdcch_allocated = 0;
+ int bts_tch_max = 0;
+ int bts_tch_current = 0;
+ int bts_tch_allocated = 0;
+
+ llist_for_each_entry(trx, &bts->trx_list, list) {
+ int trx_sdcch_max;
+ int trx_sdcch_current;
+ int trx_sdcch_allocated;
+ int trx_tch_max;
+ int trx_tch_current;
+ int trx_tch_allocated;
+ int _max;
+ int _current;
+ int _allocated;
+
+ trx_count_lchans(trx, GSM_LCHAN_SDCCH,
+ &trx_sdcch_max, &trx_sdcch_current, &trx_sdcch_allocated);
+
+ trx_count_lchans(trx, GSM_LCHAN_TCH_F, &trx_tch_max, &trx_tch_current, &trx_tch_allocated);
+ trx_count_lchans(trx, GSM_LCHAN_TCH_H, &_max, &_current, &_allocated);
+ trx_tch_max += _max;
+ trx_tch_current += _current;
+ trx_tch_allocated += _allocated;
+
+ bts_sdcch_max += trx_sdcch_max;
+ bts_sdcch_current += trx_sdcch_current;
+ bts_sdcch_allocated += trx_sdcch_allocated;
+
+ bts_tch_max += trx_tch_max;
+ bts_tch_current += trx_tch_current;
+ bts_tch_allocated += trx_tch_allocated;
+ }
+
+ time_cc_set_flag(&bts->all_allocated_sdcch,
+ bts_sdcch_max && !(bts_sdcch_current - bts_sdcch_allocated));
+
+ time_cc_set_flag(&bts->all_allocated_tch, bts_tch_max && !(bts_tch_current - bts_tch_allocated));
+
+ sdcch_max += bts_sdcch_max;
+ sdcch_current += bts_sdcch_current;
+ sdcch_allocated += bts_sdcch_allocated;
+
+ tch_max += bts_tch_max;
+ tch_current += bts_tch_current;
+ tch_allocated += bts_tch_allocated;
+ }
+
+ time_cc_set_flag(&net->all_allocated_sdcch, sdcch_max && !(sdcch_current - sdcch_allocated));
+ time_cc_set_flag(&net->all_allocated_tch, tch_max && !(tch_current - tch_allocated));
}
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 60b1020b2..f7db2b865 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -211,6 +211,29 @@ 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 time_cc){
+ .cfg = {
+ .gran_usec = 1*1000000,
+ .reset_sum_usec = 60*1000000,
+ .rate_ctr = rate_ctr_group_get_ctr(bts->bts_ctrs, BTS_CTR_ALL_ALLOCATED_SDCCH),
+ .T_gran = -16,
+ .T_round_threshold = -17,
+ .T_reset_sum = -18,
+ .T_defs = net->T_defs,
+ },
+ };
+ bts->all_allocated_tch = (struct time_cc){
+ .cfg = {
+ .gran_usec = 1*1000000,
+ .reset_sum_usec = 60*1000000,
+ .rate_ctr = rate_ctr_group_get_ctr(bts->bts_ctrs, BTS_CTR_ALL_ALLOCATED_TCH),
+ .T_gran = -16,
+ .T_round_threshold = -17,
+ .T_reset_sum = -18,
+ .T_defs = net->T_defs,
+ },
+ };
+
/* create our primary TRX */
bts->c0 = gsm_bts_trx_alloc(bts);
if (!bts->c0) {
@@ -1231,6 +1254,12 @@ const struct rate_ctr_desc bts_ctr_description[] = {
[BTS_CTR_SRVCC_ERROR] = \
{ "srvcc:error",
"Re-assignment failed for other reason" },
+ [BTS_CTR_ALL_ALLOCATED_SDCCH] =
+ { "all_allocated:sdcch",
+ "Cumulative counter of seconds where all SDCCH channels were allocated" },
+ [BTS_CTR_ALL_ALLOCATED_TCH] =
+ { "all_allocated:tch",
+ "Cumulative counter of seconds where all TCH channels were allocated" },
};
const struct rate_ctr_group_desc bts_ctrg_desc = {
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 2f6248708..c963d9e8b 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -40,6 +40,7 @@
#include <osmocom/bsc/bsc_msc_data.h>
#include <osmocom/bsc/codec_pref.h>
#include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/bsc_stats.h>
static struct osmo_fsm lchan_fsm;
@@ -512,6 +513,8 @@ 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);
+
/* Poll the channel request queue, so that waiting calls can make use of the lchan that just
* has become unused now. */
abis_rsl_chan_rqd_queue_poll(bts);
@@ -688,6 +691,8 @@ 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);
+
lchan->conn = info->for_conn;
/* If there is a previous lchan, and the new lchan is on the same cell as previous one,
diff --git a/src/osmo-bsc/net_init.c b/src/osmo-bsc/net_init.c
index 6d88adb3f..db9e53dd4 100644
--- a/src/osmo-bsc/net_init.c
+++ b/src/osmo-bsc/net_init.c
@@ -56,6 +56,17 @@ static struct osmo_tdef gsm_network_T_defs[] = {
{ .T=-12, .default_val=5, .desc="Timeout for obtaining TA after BSSLAP TA Request" },
{ .T=-13, .default_val=5, .desc="Timeout for RR Channel Mode Modify ACK (BSC <-> MS)" },
{ .T=-14, .default_val=5, .desc="Timeout for RSL Channel Mode Modify ACK (BSC <-> BTS)" },
+ { .T=-16, .default_val=1000, .unit=OSMO_TDEF_MS,
+ .desc="Granularity for allAvailable{SDCCH,TCH}Allocated rate counters:"
+ " how much elapsed time does one counter increment represent?" },
+ { .T=-17, .default_val=60000, .unit=OSMO_TDEF_MS,
+ .desc="Rounding threshold for allAvailable{SDCCH,TCH}Allocated rate counters: which fraction of X16 is"
+ " rounded up to one counter increment. 1 means: already increment the counter immediately when"
+ " all channels are allocated; same value as X16 means: only increment when all channels were"
+ " allocated for a full X16 period; 0 means: half of X16" },
+ { .T=-18, .default_val=60000, .unit=OSMO_TDEF_MS,
+ .desc="Reset-sum period for allAvailable{SDCCH,TCH}Allocated rate counters:"
+ " after this time, forget internally cumulated time remainders. Zero to always keep remainders." },
{ .T=-3111, .default_val=4, .desc="Wait time after lchan was released in error (should be T3111 + 2s)" },
{ .T=-3210, .default_val=20, .desc="After L3 Complete, wait for MSC to confirm" },
{}