Change in osmo-bsc[master]: implement all_allocated:{sdcch, tch} rate counters

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Tue Oct 26 22:27:07 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/25974 )


Change subject: implement all_allocated:{sdcch,tch} rate counters
......................................................................

implement all_allocated:{sdcch,tch} rate counters

Based on allAvailable{SDCCH,TCH}Allocated performance indicators, see
3GPP TS 52.402.

Related: SYS#4878
Related: Ib3997a827c9cc43d1361bb0cf3bfab9f6d91bf82 (osmo-ttcn3-hacks)
Change-Id: I8b06e435a224c8708cd6c67e97ee5413718fc1ed
---
M include/osmocom/bsc/bsc_stats.h
M include/osmocom/bsc/bts.h
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/bsc_init.c
M src/osmo-bsc/bsc_stats.c
M src/osmo-bsc/bts.c
M src/osmo-bsc/lchan_fsm.c
M src/osmo-bsc/net_init.c
8 files changed, 130 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/74/25974/1

diff --git a/include/osmocom/bsc/bsc_stats.h b/include/osmocom/bsc/bsc_stats.h
index 4250079..9a2f36c 100644
--- a/include/osmocom/bsc/bsc_stats.h
+++ b/include/osmocom/bsc/bsc_stats.h
@@ -81,6 +81,8 @@
 	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 @@
 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 700033c..26ffaf1 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -144,6 +144,8 @@
 	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 @@
 
 	/* 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 3d2c901..2917be3 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 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 bf150cb..11cda69 100644
--- a/src/osmo-bsc/bsc_init.c
+++ b/src/osmo-bsc/bsc_init.c
@@ -120,6 +120,29 @@
 	if (!net->bts_unknown_statg)
 		goto err_free_all;
 
+	net->all_allocated_sdcch = (struct 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_tch = (struct 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,
+		},
+	};
+
 	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 7176809..cae5300 100644
--- a/src/osmo-bsc/bsc_stats.c
+++ b/src/osmo-bsc/bsc_stats.c
@@ -102,6 +102,8 @@
 						 "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,49 @@
 	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;
+
+	chan_counts_t bsc_counts;
+	chan_counts_zero(bsc_counts);
+
+	llist_for_each_entry(bts, &net->bts_list, list) {
+		chan_counts_t bts_counts;
+		chan_counts_zero(bts_counts);
+
+		llist_for_each_entry(trx, &bts->trx_list, list) {
+			chan_counts_t trx_counts;
+			trx_count_lchans(trx_counts, trx);
+			chan_counts_add(bts_counts, trx_counts);
+		}
+
+		time_cc_set_flag(&bts->all_allocated_sdcch,
+				 bts_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH]
+				 && !bts_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]);
+
+		time_cc_set_flag(&bts->all_allocated_tch,
+				 (bts_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F]
+				  + bts_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H])
+				 && !(bts_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]
+				      + bts_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]));
+
+		chan_counts_add(bsc_counts, bts_counts);
+	}
+
+	time_cc_set_flag(&net->all_allocated_sdcch,
+			 bsc_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_SDCCH]
+			 && !bsc_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_SDCCH]);
+
+	time_cc_set_flag(&net->all_allocated_tch,
+			 (bsc_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_F]
+			  + bsc_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_MAX_TOTAL][GSM_LCHAN_TCH_H])
+			 && !(bsc_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_F]
+			      + bsc_counts[CHAN_COUNTS1_ALL][CHAN_COUNTS2_FREE][GSM_LCHAN_TCH_H]));
 }
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 2e4b520..95015ba 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -211,6 +211,29 @@
 	}
 	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,
+			.forget_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_forget_sum = -18,
+			.T_defs = net->T_defs,
+		},
+	};
+	bts->all_allocated_tch = (struct time_cc){
+		.cfg = {
+			.gran_usec = 1*1000000,
+			.forget_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_forget_sum = -18,
+			.T_defs = net->T_defs,
+		},
+	};
+
 	/* create our primary TRX */
 	bts->c0 = gsm_bts_trx_alloc(bts);
 	if (!bts->c0) {
@@ -1205,6 +1228,12 @@
 	[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 2f62487..c963d9e 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 @@
 	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 @@
 		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 6d88adb..26b3322 100644
--- a/src/osmo-bsc/net_init.c
+++ b/src/osmo-bsc/net_init.c
@@ -56,6 +56,20 @@
 	{ .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 all_allocated:* rate counters: in milliseconds, how much elapsed time does one"
+		      " counter increment represent? See also X17, X18" },
+	{ .T=-17, .default_val=0, .unit=OSMO_TDEF_MS,
+		.desc="Rounding threshold for all_allocated:* rate counters: round up to the next counter increment"
+		      " after this many milliseconds. If set to half of X16 (or 0), employ the usual round() behavior:"
+		      " round up after half of a granularity period. If set to 1, behave like ceil(): already"
+		      " increment the counter immediately when all channels are allocated. If set >= X16, behave like"
+		      " floor(): only increment after a full X16 period of all channels being occupied."
+		      " See also X16, X18" },
+	{ .T=-18, .default_val=60000, .unit=OSMO_TDEF_MS,
+		.desc="Reset-sum period for all_allocated:* rate counters:"
+		      " after this time, forget internally cumulated time remainders. Zero to always keep remainders."
+		      " See also X16, X17." },
 	{ .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" },
 	{}

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/25974
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I8b06e435a224c8708cd6c67e97ee5413718fc1ed
Gerrit-Change-Number: 25974
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211026/51725fb0/attachment.htm>


More information about the gerrit-log mailing list