Change in osmo-bsc[master]: move BSC level stats and rate counters to new bsc_stats.[hc]

neels gerrit-no-reply at lists.osmocom.org
Sun Aug 29 13:53:42 UTC 2021


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


Change subject: move BSC level stats and rate counters to new bsc_stats.[hc]
......................................................................

move BSC level stats and rate counters to new bsc_stats.[hc]

Instead of having static const structs in header files (which end up
duplicated in each and every compile unit!), have one .c file with the
rate_ctr and stat_item descriptions.

Related: SYS#5542
Change-Id: I8fd6380b5ae8ed2d3347e7cfbf674c30b6841ed9
---
M include/osmocom/bsc/Makefile.am
A include/osmocom/bsc/bsc_stats.h
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/Makefile.am
M src/osmo-bsc/assignment_fsm.c
M src/osmo-bsc/bsc_init.c
A src/osmo-bsc/bsc_stats.c
M src/osmo-bsc/bts_ipaccess_nanobts.c
M src/osmo-bsc/bts_vty.c
M src/osmo-bsc/gsm_08_08.c
M src/osmo-bsc/handover_fsm.c
M src/osmo-bsc/osmo_bsc_bssap.c
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc/paging.c
14 files changed, 231 insertions(+), 169 deletions(-)



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

diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index dde08a1..3accc74 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -7,6 +7,7 @@
 	acc.h \
 	assignment_fsm.h \
 	bsc_rll.h \
+	bsc_stats.h \
 	bsc_subscriber.h \
 	bsc_subscr_conn_fsm.h \
 	bss.h \
diff --git a/include/osmocom/bsc/bsc_stats.h b/include/osmocom/bsc/bsc_stats.h
new file mode 100644
index 0000000..8fcd5a0
--- /dev/null
+++ b/include/osmocom/bsc/bsc_stats.h
@@ -0,0 +1,98 @@
+/* osmo-bsc statistics */
+/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info at sysmocom.de>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#pragma once
+
+#include <osmocom/core/rate_ctr.h>
+
+struct osmo_stat_item_group_desc;
+
+/* OsmoBSC rate_ctr indexes */
+enum {
+	BSC_CTR_ASSIGNMENT_ATTEMPTED,
+	BSC_CTR_ASSIGNMENT_COMPLETED,
+	BSC_CTR_ASSIGNMENT_STOPPED,
+	BSC_CTR_ASSIGNMENT_NO_CHANNEL,
+	BSC_CTR_ASSIGNMENT_TIMEOUT,
+	BSC_CTR_ASSIGNMENT_FAILED,
+	BSC_CTR_ASSIGNMENT_ERROR,
+	BSC_CTR_HANDOVER_ATTEMPTED,
+	BSC_CTR_HANDOVER_COMPLETED,
+	BSC_CTR_HANDOVER_STOPPED,
+	BSC_CTR_HANDOVER_NO_CHANNEL,
+	BSC_CTR_HANDOVER_TIMEOUT,
+	BSC_CTR_HANDOVER_FAILED,
+	BSC_CTR_HANDOVER_ERROR,
+	BSC_CTR_INTRA_CELL_HO_ATTEMPTED,
+	BSC_CTR_INTRA_CELL_HO_COMPLETED,
+	BSC_CTR_INTRA_CELL_HO_STOPPED,
+	BSC_CTR_INTRA_CELL_HO_NO_CHANNEL,
+	BSC_CTR_INTRA_CELL_HO_TIMEOUT,
+	BSC_CTR_INTRA_CELL_HO_FAILED,
+	BSC_CTR_INTRA_CELL_HO_ERROR,
+	BSC_CTR_INTRA_BSC_HO_ATTEMPTED,
+	BSC_CTR_INTRA_BSC_HO_COMPLETED,
+	BSC_CTR_INTRA_BSC_HO_STOPPED,
+	BSC_CTR_INTRA_BSC_HO_NO_CHANNEL,
+	BSC_CTR_INTRA_BSC_HO_TIMEOUT,
+	BSC_CTR_INTRA_BSC_HO_FAILED,
+	BSC_CTR_INTRA_BSC_HO_ERROR,
+	BSC_CTR_INTER_BSC_HO_OUT_ATTEMPTED,
+	BSC_CTR_INTER_BSC_HO_OUT_COMPLETED,
+	BSC_CTR_INTER_BSC_HO_OUT_STOPPED,
+	BSC_CTR_INTER_BSC_HO_OUT_TIMEOUT,
+	BSC_CTR_INTER_BSC_HO_OUT_FAILED,
+	BSC_CTR_INTER_BSC_HO_OUT_ERROR,
+	BSC_CTR_INTER_BSC_HO_IN_ATTEMPTED,
+	BSC_CTR_INTER_BSC_HO_IN_COMPLETED,
+	BSC_CTR_INTER_BSC_HO_IN_STOPPED,
+	BSC_CTR_INTER_BSC_HO_IN_NO_CHANNEL,
+	BSC_CTR_INTER_BSC_HO_IN_FAILED,
+	BSC_CTR_INTER_BSC_HO_IN_TIMEOUT,
+	BSC_CTR_INTER_BSC_HO_IN_ERROR,
+	BSC_CTR_SRVCC_ATTEMPTED,
+	BSC_CTR_SRVCC_COMPLETED,
+	BSC_CTR_SRVCC_STOPPED,
+	BSC_CTR_SRVCC_NO_CHANNEL,
+	BSC_CTR_SRVCC_TIMEOUT,
+	BSC_CTR_SRVCC_FAILED,
+	BSC_CTR_SRVCC_ERROR,
+	BSC_CTR_PAGING_ATTEMPTED,
+	BSC_CTR_PAGING_DETACHED,
+	BSC_CTR_PAGING_RESPONDED,
+	BSC_CTR_PAGING_NO_ACTIVE_PAGING,
+	BSC_CTR_UNKNOWN_UNIT_ID,
+	BSC_CTR_MSCPOOL_SUBSCR_NO_MSC,
+	BSC_CTR_MSCPOOL_EMERG_FORWARDED,
+	BSC_CTR_MSCPOOL_EMERG_LOST,
+};
+
+extern const struct rate_ctr_desc bsc_ctr_description[];
+extern const struct rate_ctr_group_desc bsc_ctrg_desc;
+
+/* OsmoBSC stat_item indexes */
+enum {
+	BSC_STAT_NUM_BTS_TOTAL,
+};
+
+/* BTS counter index if a BTS could not be found
+ * Currently we are limited to bts 0 - 255 in the VTY, but that might change in
+ * the future so use 2**16 */
+#define BTS_STAT_IDX_UNKNOWN (UINT16_MAX + 1)
+
+extern const struct osmo_stat_item_group_desc bsc_statg_desc;
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index d6c06de..db0f249 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1110,163 +1110,6 @@
 void conn_update_ms_power_class(struct gsm_subscriber_connection *conn, uint8_t power_class);
 void lchan_update_ms_power_ctrl_level(struct gsm_lchan *lchan, int ms_power_dbm);
 
-enum {
-	BSC_CTR_ASSIGNMENT_ATTEMPTED,
-	BSC_CTR_ASSIGNMENT_COMPLETED,
-	BSC_CTR_ASSIGNMENT_STOPPED,
-	BSC_CTR_ASSIGNMENT_NO_CHANNEL,
-	BSC_CTR_ASSIGNMENT_TIMEOUT,
-	BSC_CTR_ASSIGNMENT_FAILED,
-	BSC_CTR_ASSIGNMENT_ERROR,
-	BSC_CTR_HANDOVER_ATTEMPTED,
-	BSC_CTR_HANDOVER_COMPLETED,
-	BSC_CTR_HANDOVER_STOPPED,
-	BSC_CTR_HANDOVER_NO_CHANNEL,
-	BSC_CTR_HANDOVER_TIMEOUT,
-	BSC_CTR_HANDOVER_FAILED,
-	BSC_CTR_HANDOVER_ERROR,
-	BSC_CTR_INTRA_CELL_HO_ATTEMPTED,
-	BSC_CTR_INTRA_CELL_HO_COMPLETED,
-	BSC_CTR_INTRA_CELL_HO_STOPPED,
-	BSC_CTR_INTRA_CELL_HO_NO_CHANNEL,
-	BSC_CTR_INTRA_CELL_HO_TIMEOUT,
-	BSC_CTR_INTRA_CELL_HO_FAILED,
-	BSC_CTR_INTRA_CELL_HO_ERROR,
-	BSC_CTR_INTRA_BSC_HO_ATTEMPTED,
-	BSC_CTR_INTRA_BSC_HO_COMPLETED,
-	BSC_CTR_INTRA_BSC_HO_STOPPED,
-	BSC_CTR_INTRA_BSC_HO_NO_CHANNEL,
-	BSC_CTR_INTRA_BSC_HO_TIMEOUT,
-	BSC_CTR_INTRA_BSC_HO_FAILED,
-	BSC_CTR_INTRA_BSC_HO_ERROR,
-	BSC_CTR_INTER_BSC_HO_OUT_ATTEMPTED,
-	BSC_CTR_INTER_BSC_HO_OUT_COMPLETED,
-	BSC_CTR_INTER_BSC_HO_OUT_STOPPED,
-	BSC_CTR_INTER_BSC_HO_OUT_TIMEOUT,
-	BSC_CTR_INTER_BSC_HO_OUT_FAILED,
-	BSC_CTR_INTER_BSC_HO_OUT_ERROR,
-	BSC_CTR_INTER_BSC_HO_IN_ATTEMPTED,
-	BSC_CTR_INTER_BSC_HO_IN_COMPLETED,
-	BSC_CTR_INTER_BSC_HO_IN_STOPPED,
-	BSC_CTR_INTER_BSC_HO_IN_NO_CHANNEL,
-	BSC_CTR_INTER_BSC_HO_IN_FAILED,
-	BSC_CTR_INTER_BSC_HO_IN_TIMEOUT,
-	BSC_CTR_INTER_BSC_HO_IN_ERROR,
-	BSC_CTR_SRVCC_ATTEMPTED,
-	BSC_CTR_SRVCC_COMPLETED,
-	BSC_CTR_SRVCC_STOPPED,
-	BSC_CTR_SRVCC_NO_CHANNEL,
-	BSC_CTR_SRVCC_TIMEOUT,
-	BSC_CTR_SRVCC_FAILED,
-	BSC_CTR_SRVCC_ERROR,
-	BSC_CTR_PAGING_ATTEMPTED,
-	BSC_CTR_PAGING_DETACHED,
-	BSC_CTR_PAGING_RESPONDED,
-	BSC_CTR_PAGING_NO_ACTIVE_PAGING,
-	BSC_CTR_UNKNOWN_UNIT_ID,
-	BSC_CTR_MSCPOOL_SUBSCR_NO_MSC,
-	BSC_CTR_MSCPOOL_EMERG_FORWARDED,
-	BSC_CTR_MSCPOOL_EMERG_LOST,
-};
-
-static const struct rate_ctr_desc bsc_ctr_description[] = {
-	[BSC_CTR_ASSIGNMENT_ATTEMPTED] =	{"assignment:attempted", "Assignment attempts"},
-	[BSC_CTR_ASSIGNMENT_COMPLETED] =	{"assignment:completed", "Assignment completed"},
-	[BSC_CTR_ASSIGNMENT_STOPPED] = 		{"assignment:stopped", "Connection ended during Assignment"},
-	[BSC_CTR_ASSIGNMENT_NO_CHANNEL] = 	{"assignment:no_channel", "Failure to allocate lchan for Assignment"},
-	[BSC_CTR_ASSIGNMENT_TIMEOUT] = 		{"assignment:timeout", "Assignment timed out"},
-	[BSC_CTR_ASSIGNMENT_FAILED] = 		{"assignment:failed", "Received Assignment Failure message"},
-	[BSC_CTR_ASSIGNMENT_ERROR] = 		{"assignment:error", "Assignment failed for other reason"},
-
-	[BSC_CTR_HANDOVER_ATTEMPTED] = 		{"handover:attempted", "Intra-BSC handover attempts"},
-	[BSC_CTR_HANDOVER_COMPLETED] = 		{"handover:completed", "Intra-BSC handover completed"},
-	[BSC_CTR_HANDOVER_STOPPED] = 		{"handover:stopped", "Connection ended during HO"},
-	[BSC_CTR_HANDOVER_NO_CHANNEL] = 	{"handover:no_channel", "Failure to allocate lchan for HO"},
-	[BSC_CTR_HANDOVER_TIMEOUT] = 		{"handover:timeout", "Handover timed out"},
-	[BSC_CTR_HANDOVER_FAILED] = 		{"handover:failed", "Received Handover Fail messages"},
-	[BSC_CTR_HANDOVER_ERROR] = 		{"handover:error", "Re-assignment failed for other reason"},
-
-	[BSC_CTR_INTRA_CELL_HO_ATTEMPTED] = 	{"intra_cell_ho:attempted", "Intra-Cell handover attempts"},
-	[BSC_CTR_INTRA_CELL_HO_COMPLETED] = 	{"intra_cell_ho:completed", "Intra-Cell handover completed"},
-	[BSC_CTR_INTRA_CELL_HO_STOPPED] = 	{"intra_cell_ho:stopped", "Connection ended during HO"},
-	[BSC_CTR_INTRA_CELL_HO_NO_CHANNEL] = 	{"intra_cell_ho:no_channel", "Failure to allocate lchan for HO"},
-	[BSC_CTR_INTRA_CELL_HO_TIMEOUT] = 	{"intra_cell_ho:timeout", "Handover timed out"},
-	[BSC_CTR_INTRA_CELL_HO_FAILED] = 	{"intra_cell_ho:failed", "Received Handover Fail messages"},
-	[BSC_CTR_INTRA_CELL_HO_ERROR] = 	{"intra_cell_ho:error", "Re-assignment failed for other reason"},
-
-	[BSC_CTR_INTRA_BSC_HO_ATTEMPTED] = 	{"intra_bsc_ho:attempted", "Intra-BSC handover attempts"},
-	[BSC_CTR_INTRA_BSC_HO_COMPLETED] = 	{"intra_bsc_ho:completed", "Intra-BSC handover completed"},
-	[BSC_CTR_INTRA_BSC_HO_STOPPED] = 	{"intra_bsc_ho:stopped", "Connection ended during HO"},
-	[BSC_CTR_INTRA_BSC_HO_NO_CHANNEL] = 	{"intra_bsc_ho:no_channel", "Failure to allocate lchan for HO"},
-	[BSC_CTR_INTRA_BSC_HO_TIMEOUT] = 	{"intra_bsc_ho:timeout", "Handover timed out"},
-	[BSC_CTR_INTRA_BSC_HO_FAILED] = 	{"intra_bsc_ho:failed", "Received Handover Fail messages"},
-	[BSC_CTR_INTRA_BSC_HO_ERROR] = 		{"intra_bsc_ho:error", "Re-assignment failed for other reason"},
-
-	[BSC_CTR_INTER_BSC_HO_OUT_ATTEMPTED] =	{"interbsc_ho_out:attempted",
-						 "Attempts to handover to remote BSS"},
-	[BSC_CTR_INTER_BSC_HO_OUT_COMPLETED] =	{"interbsc_ho_out:completed",
-						 "Handover to remote BSS completed"},
-	[BSC_CTR_INTER_BSC_HO_OUT_STOPPED] =	{"interbsc_ho_out:stopped", "Connection ended during HO"},
-	[BSC_CTR_INTER_BSC_HO_OUT_TIMEOUT] =	{"interbsc_ho_out:timeout", "Handover timed out"},
-	[BSC_CTR_INTER_BSC_HO_OUT_FAILED] =	{"interbsc_ho_out:failed", "Received Handover Fail message"},
-	[BSC_CTR_INTER_BSC_HO_OUT_ERROR] =	{"interbsc_ho_out:error",
-						 "Handover to remote BSS failed for other reason"},
-
-	[BSC_CTR_INTER_BSC_HO_IN_ATTEMPTED] =	{"interbsc_ho_in:attempted",
-						 "Attempts to handover from remote BSS"},
-	[BSC_CTR_INTER_BSC_HO_IN_COMPLETED] =	{"interbsc_ho_in:completed",
-						 "Handover from remote BSS completed"},
-	[BSC_CTR_INTER_BSC_HO_IN_STOPPED] =	{"interbsc_ho_in:stopped", "Connection ended during HO"},
-	[BSC_CTR_INTER_BSC_HO_IN_NO_CHANNEL] =	{"interbsc_ho_in:no_channel",
-						 "Failure to allocate lchan for HO"},
-	[BSC_CTR_INTER_BSC_HO_IN_TIMEOUT] =	{"interbsc_ho_in:timeout", "Handover from remote BSS timed out"},
-	[BSC_CTR_INTER_BSC_HO_IN_FAILED] =	{"interbsc_ho_in:failed", "Received Handover Fail message"},
-	[BSC_CTR_INTER_BSC_HO_IN_ERROR] =	{"interbsc_ho_in:error",
-						 "Handover from remote BSS failed for other reason"},
-
-	[BSC_CTR_SRVCC_ATTEMPTED] =             {"srvcc:attempted", "Intra-BSC SRVCC attempts"},
-	[BSC_CTR_SRVCC_COMPLETED] =             {"srvcc:completed", "Intra-BSC SRVCC completed"},
-	[BSC_CTR_SRVCC_STOPPED] =               {"srvcc:stopped", "Connection ended during HO"},
-	[BSC_CTR_SRVCC_NO_CHANNEL] =            {"srvcc:no_channel", "Failure to allocate lchan for HO"},
-	[BSC_CTR_SRVCC_TIMEOUT] =               {"srvcc:timeout", "SRVCC timed out"},
-	[BSC_CTR_SRVCC_FAILED] =                {"srvcc:failed", "Received SRVCC Fail messages"},
-	[BSC_CTR_SRVCC_ERROR] =                 {"srvcc:error", "Re-assignment failed for other reason"},
-
-	[BSC_CTR_PAGING_ATTEMPTED] = 		{"paging:attempted", "Paging attempts for a subscriber"},
-	[BSC_CTR_PAGING_DETACHED] = 		{"paging:detached", "Paging request send failures because no responsible BTS was found"},
-	[BSC_CTR_PAGING_RESPONDED] = 		{"paging:responded", "Paging attempts with successful response"},
-	[BSC_CTR_PAGING_NO_ACTIVE_PAGING] =	{"paging:no_active_paging", "Paging response without an active paging request (arrived after paging expiration?)"},
-
-	[BSC_CTR_UNKNOWN_UNIT_ID] = 		{"abis:unknown_unit_id", "Connection attempts from unknown IPA CCM Unit ID"},
-
-	[BSC_CTR_MSCPOOL_SUBSCR_NO_MSC] =	{"mscpool:subscr:no_msc",
-						 "Complete Layer 3 requests lost because no connected MSC is found available"},
-	[BSC_CTR_MSCPOOL_EMERG_FORWARDED] =	{"mscpool:emerg:forwarded",
-						 "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"},
-};
-
-
-
-static const struct rate_ctr_group_desc bsc_ctrg_desc = {
-	"bsc",
-	"base station controller",
-	OSMO_STATS_CLASS_GLOBAL,
-	ARRAY_SIZE(bsc_ctr_description),
-	bsc_ctr_description,
-};
-
-/* Constants for the BSC stats */
-enum {
-	BSC_STAT_NUM_BTS_TOTAL,
-};
-
-/* BTS counter index if a BTS could not be found
- * Currently we are limited to bts 0 - 255 in the VTY, but that might change in
- * the future so use 2**16 */
-#define BTS_STAT_IDX_UNKNOWN (UINT16_MAX + 1)
-
 struct gsm_tz {
 	int override; /* if 0, use system's time zone instead. */
 	int hr; /* hour */
diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am
index c149f47..8991697 100644
--- a/src/osmo-bsc/Makefile.am
+++ b/src/osmo-bsc/Makefile.am
@@ -39,6 +39,7 @@
 	bsc_rf_ctrl.c \
 	bsc_rll.c \
 	bsc_sccp.c \
+	bsc_stats.c \
 	bsc_subscr_conn_fsm.c \
 	bsc_subscriber.c \
 	bsc_vty.c \
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index 2c52d22..3c1f13b 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -36,6 +36,7 @@
 #include <osmocom/bsc/lchan_select.h>
 #include <osmocom/bsc/abis_rsl.h>
 #include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 #include <osmocom/bsc/assignment_fsm.h>
 
diff --git a/src/osmo-bsc/bsc_init.c b/src/osmo-bsc/bsc_init.c
index 42acbbc..a85e76f 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,18 +47,6 @@
 #include <limits.h>
 #include <stdbool.h>
 
-static const struct osmo_stat_item_desc bsc_stat_desc[] = {
-	[BSC_STAT_NUM_BTS_TOTAL] = { "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,
-};
-
 int bsc_shutdown_net(struct gsm_network *net)
 {
 	struct gsm_bts *bts;
diff --git a/src/osmo-bsc/bsc_stats.c b/src/osmo-bsc/bsc_stats.c
new file mode 100644
index 0000000..8fc4c38
--- /dev/null
+++ b/src/osmo-bsc/bsc_stats.c
@@ -0,0 +1,122 @@
+/* osmo-bsc statistics */
+/* (C) 2021 by sysmocom - s.f.m.c. GmbH <info at sysmocom.de>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <osmocom/bsc/bsc_stats.h>
+
+#include <osmocom/core/utils.h>
+#include <osmocom/core/stats.h>
+#include <osmocom/core/stat_item.h>
+
+const struct rate_ctr_desc bsc_ctr_description[] = {
+	[BSC_CTR_ASSIGNMENT_ATTEMPTED] =	{"assignment:attempted", "Assignment attempts"},
+	[BSC_CTR_ASSIGNMENT_COMPLETED] =	{"assignment:completed", "Assignment completed"},
+	[BSC_CTR_ASSIGNMENT_STOPPED] =		{"assignment:stopped", "Connection ended during Assignment"},
+	[BSC_CTR_ASSIGNMENT_NO_CHANNEL] =	{"assignment:no_channel", "Failure to allocate lchan for Assignment"},
+	[BSC_CTR_ASSIGNMENT_TIMEOUT] =		{"assignment:timeout", "Assignment timed out"},
+	[BSC_CTR_ASSIGNMENT_FAILED] =		{"assignment:failed", "Received Assignment Failure message"},
+	[BSC_CTR_ASSIGNMENT_ERROR] =		{"assignment:error", "Assignment failed for other reason"},
+
+	[BSC_CTR_HANDOVER_ATTEMPTED] =		{"handover:attempted", "Intra-BSC handover attempts"},
+	[BSC_CTR_HANDOVER_COMPLETED] =		{"handover:completed", "Intra-BSC handover completed"},
+	[BSC_CTR_HANDOVER_STOPPED] =		{"handover:stopped", "Connection ended during HO"},
+	[BSC_CTR_HANDOVER_NO_CHANNEL] =		{"handover:no_channel", "Failure to allocate lchan for HO"},
+	[BSC_CTR_HANDOVER_TIMEOUT] =		{"handover:timeout", "Handover timed out"},
+	[BSC_CTR_HANDOVER_FAILED] =		{"handover:failed", "Received Handover Fail messages"},
+	[BSC_CTR_HANDOVER_ERROR] =		{"handover:error", "Re-assignment failed for other reason"},
+
+	[BSC_CTR_INTRA_CELL_HO_ATTEMPTED] =	{"intra_cell_ho:attempted", "Intra-Cell handover attempts"},
+	[BSC_CTR_INTRA_CELL_HO_COMPLETED] =	{"intra_cell_ho:completed", "Intra-Cell handover completed"},
+	[BSC_CTR_INTRA_CELL_HO_STOPPED] =	{"intra_cell_ho:stopped", "Connection ended during HO"},
+	[BSC_CTR_INTRA_CELL_HO_NO_CHANNEL] =	{"intra_cell_ho:no_channel", "Failure to allocate lchan for HO"},
+	[BSC_CTR_INTRA_CELL_HO_TIMEOUT] =	{"intra_cell_ho:timeout", "Handover timed out"},
+	[BSC_CTR_INTRA_CELL_HO_FAILED] =	{"intra_cell_ho:failed", "Received Handover Fail messages"},
+	[BSC_CTR_INTRA_CELL_HO_ERROR] =	{"intra_cell_ho:error", "Re-assignment failed for other reason"},
+
+	[BSC_CTR_INTRA_BSC_HO_ATTEMPTED] =	{"intra_bsc_ho:attempted", "Intra-BSC handover attempts"},
+	[BSC_CTR_INTRA_BSC_HO_COMPLETED] =	{"intra_bsc_ho:completed", "Intra-BSC handover completed"},
+	[BSC_CTR_INTRA_BSC_HO_STOPPED] =	{"intra_bsc_ho:stopped", "Connection ended during HO"},
+	[BSC_CTR_INTRA_BSC_HO_NO_CHANNEL] =	{"intra_bsc_ho:no_channel", "Failure to allocate lchan for HO"},
+	[BSC_CTR_INTRA_BSC_HO_TIMEOUT] =	{"intra_bsc_ho:timeout", "Handover timed out"},
+	[BSC_CTR_INTRA_BSC_HO_FAILED] =		{"intra_bsc_ho:failed", "Received Handover Fail messages"},
+	[BSC_CTR_INTRA_BSC_HO_ERROR] =		{"intra_bsc_ho:error", "Re-assignment failed for other reason"},
+
+	[BSC_CTR_INTER_BSC_HO_OUT_ATTEMPTED] =	{"interbsc_ho_out:attempted",
+						 "Attempts to handover to remote BSS"},
+	[BSC_CTR_INTER_BSC_HO_OUT_COMPLETED] =	{"interbsc_ho_out:completed",
+						 "Handover to remote BSS completed"},
+	[BSC_CTR_INTER_BSC_HO_OUT_STOPPED] =	{"interbsc_ho_out:stopped", "Connection ended during HO"},
+	[BSC_CTR_INTER_BSC_HO_OUT_TIMEOUT] =	{"interbsc_ho_out:timeout", "Handover timed out"},
+	[BSC_CTR_INTER_BSC_HO_OUT_FAILED] =	{"interbsc_ho_out:failed", "Received Handover Fail message"},
+	[BSC_CTR_INTER_BSC_HO_OUT_ERROR] =	{"interbsc_ho_out:error",
+						 "Handover to remote BSS failed for other reason"},
+
+	[BSC_CTR_INTER_BSC_HO_IN_ATTEMPTED] =	{"interbsc_ho_in:attempted",
+						 "Attempts to handover from remote BSS"},
+	[BSC_CTR_INTER_BSC_HO_IN_COMPLETED] =	{"interbsc_ho_in:completed",
+						 "Handover from remote BSS completed"},
+	[BSC_CTR_INTER_BSC_HO_IN_STOPPED] =	{"interbsc_ho_in:stopped", "Connection ended during HO"},
+	[BSC_CTR_INTER_BSC_HO_IN_NO_CHANNEL] =	{"interbsc_ho_in:no_channel",
+						 "Failure to allocate lchan for HO"},
+	[BSC_CTR_INTER_BSC_HO_IN_TIMEOUT] =	{"interbsc_ho_in:timeout", "Handover from remote BSS timed out"},
+	[BSC_CTR_INTER_BSC_HO_IN_FAILED] =	{"interbsc_ho_in:failed", "Received Handover Fail message"},
+	[BSC_CTR_INTER_BSC_HO_IN_ERROR] =	{"interbsc_ho_in:error",
+						 "Handover from remote BSS failed for other reason"},
+
+	[BSC_CTR_SRVCC_ATTEMPTED] =             {"srvcc:attempted", "Intra-BSC SRVCC attempts"},
+	[BSC_CTR_SRVCC_COMPLETED] =             {"srvcc:completed", "Intra-BSC SRVCC completed"},
+	[BSC_CTR_SRVCC_STOPPED] =               {"srvcc:stopped", "Connection ended during HO"},
+	[BSC_CTR_SRVCC_NO_CHANNEL] =            {"srvcc:no_channel", "Failure to allocate lchan for HO"},
+	[BSC_CTR_SRVCC_TIMEOUT] =               {"srvcc:timeout", "SRVCC timed out"},
+	[BSC_CTR_SRVCC_FAILED] =                {"srvcc:failed", "Received SRVCC Fail messages"},
+	[BSC_CTR_SRVCC_ERROR] =                 {"srvcc:error", "Re-assignment failed for other reason"},
+
+	[BSC_CTR_PAGING_ATTEMPTED] =		{"paging:attempted", "Paging attempts for a subscriber"},
+	[BSC_CTR_PAGING_DETACHED] =		{"paging:detached", "Paging request send failures because no responsible BTS was found"},
+	[BSC_CTR_PAGING_RESPONDED] =		{"paging:responded", "Paging attempts with successful response"},
+	[BSC_CTR_PAGING_NO_ACTIVE_PAGING] =	{"paging:no_active_paging", "Paging response without an active paging request (arrived after paging expiration?)"},
+
+	[BSC_CTR_UNKNOWN_UNIT_ID] =		{"abis:unknown_unit_id", "Connection attempts from unknown IPA CCM Unit ID"},
+
+	[BSC_CTR_MSCPOOL_SUBSCR_NO_MSC] =	{"mscpool:subscr:no_msc",
+						 "Complete Layer 3 requests lost because no connected MSC is found available"},
+	[BSC_CTR_MSCPOOL_EMERG_FORWARDED] =	{"mscpool:emerg:forwarded",
+						 "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"},
+};
+
+const struct rate_ctr_group_desc bsc_ctrg_desc = {
+	"bsc",
+	"base station controller",
+	OSMO_STATS_CLASS_GLOBAL,
+	ARRAY_SIZE(bsc_ctr_description),
+	bsc_ctr_description,
+};
+
+static const struct osmo_stat_item_desc bsc_stat_desc[] = {
+	[BSC_STAT_NUM_BTS_TOTAL] = { "num_bts:total", "Number of configured BTS for this BSC", "", 16, 0 },
+};
+
+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,
+};
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts.c b/src/osmo-bsc/bts_ipaccess_nanobts.c
index 27f6aee..8d2908f 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts.c
@@ -51,6 +51,7 @@
 #include <osmocom/bsc/bts.h>
 #include <osmocom/bsc/bts_sm.h>
 #include <osmocom/bsc/nm_common_fsm.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 static int bts_model_nanobts_start(struct gsm_network *net);
 static void bts_model_nanobts_e1line_bind_ops(struct e1inp_line *line);
diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c
index 577feec..2b7b42b 100644
--- a/src/osmo-bsc/bts_vty.c
+++ b/src/osmo-bsc/bts_vty.c
@@ -49,6 +49,7 @@
 #include <osmocom/bsc/neighbor_ident.h>
 #include <osmocom/bsc/smscb.h>
 #include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 #include <inttypes.h>
 
diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index 1f6b38e..91c90fe 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -26,6 +26,7 @@
 #include <osmocom/bsc/gsm_08_08.h>
 #include <osmocom/bsc/codec_pref.h>
 #include <osmocom/bsc/lchan_fsm.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 #include <osmocom/bsc/gsm_04_08_rr.h>
 #include <osmocom/bsc/a_reset.h>
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index 797a336..255478f 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -45,6 +45,7 @@
 #include <osmocom/bsc/gsm_08_08.h>
 #include <osmocom/bsc/bts.h>
 #include <osmocom/bsc/lcs_loc_req.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 #define LOG_FMT_BTS "bts %u lac-ci %u-%u arfcn-bsic %d-%d"
 #define LOG_ARGS_BTS(bts) \
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 6f0caa7..d786ec6 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -34,6 +34,7 @@
 #include <osmocom/bsc/abis_rsl.h>
 #include <osmocom/bsc/handover_fsm.h>
 #include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 #include <osmocom/gsm/protocol/gsm_08_08.h>
 #include <osmocom/gsm/gsm0808.h>
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index b97c7a1..b3bd365 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -67,6 +67,7 @@
 #include <osmocom/bsc/codec_pref.h>
 #include <osmocom/bsc/system_information.h>
 #include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 #include <osmocom/mgcp_client/mgcp_client.h>
 
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index d2dd5ea..04512be 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -54,6 +54,7 @@
 #include <osmocom/bsc/gsm_04_08_rr.h>
 #include <osmocom/bsc/bsc_subscr_conn_fsm.h>
 #include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 void *tall_paging_ctx = NULL;
 

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I8fd6380b5ae8ed2d3347e7cfbf674c30b6841ed9
Gerrit-Change-Number: 25273
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/20210829/3b9cf694/attachment.htm>


More information about the gerrit-log mailing list