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

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


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


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

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

After adding bsc_stats.c, I figured it would make sense to also move the
MSC level statistics definitions to this file, so that we have one place
to find statistics for any reporting level.

Related: SYS#5542
Change-Id: I03ab34f1c0511016da5b8c7db33d8d76db99f3af
---
M include/osmocom/bsc/bsc_msc_data.h
M include/osmocom/bsc/bsc_stats.h
M src/osmo-bsc/bsc_stats.c
M src/osmo-bsc/bsc_subscr_conn_fsm.c
M src/osmo-bsc/lcs_loc_req.c
M src/osmo-bsc/osmo_bsc_msc.c
M src/osmo-bsc/osmo_bsc_sigtran.c
7 files changed, 188 insertions(+), 180 deletions(-)



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

diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h
index e5f48d1..eec1b54 100644
--- a/include/osmocom/bsc/bsc_msc_data.h
+++ b/include/osmocom/bsc/bsc_msc_data.h
@@ -50,72 +50,6 @@
 struct osmo_bsc_rf;
 struct gsm_network;
 
-/* Constants for the MSC rate counters */
-enum {
-	/* Rx message counters */
-	MSC_CTR_BSSMAP_RX_UDT_RESET_ACKNOWLEDGE,
-	MSC_CTR_BSSMAP_RX_UDT_RESET,
-	MSC_CTR_BSSMAP_RX_UDT_PAGING,
-	MSC_CTR_BSSMAP_RX_UDT_UNKNOWN,
-	MSC_CTR_BSSMAP_RX_DT1_CLEAR_CMD,
-	MSC_CTR_BSSMAP_RX_DT1_CIPHER_MODE_CMD,
-	MSC_CTR_BSSMAP_RX_DT1_ASSIGMENT_RQST,
-	MSC_CTR_BSSMAP_RX_DT1_LCLS_CONNECT_CTRL,
-	MSC_CTR_BSSMAP_RX_DT1_HANDOVER_CMD,
-	MSC_CTR_BSSMAP_RX_DT1_CLASSMARK_RQST,
-	MSC_CTR_BSSMAP_RX_DT1_CONFUSION,
-	MSC_CTR_BSSMAP_RX_DT1_COMMON_ID,
-	MSC_CTR_BSSMAP_RX_DT1_UNKNOWN,
-	MSC_CTR_BSSMAP_RX_DT1_DTAP,
-	MSC_CTR_BSSMAP_RX_DT1_DTAP_ERROR,
-	MSC_CTR_BSSMAP_RX_DT1_PERFORM_LOCATION_REQUEST,
-	MSC_CTR_BSSMAP_RX_DT1_PERFORM_LOCATION_ABORT,
-
-	/* Tx message counters (per connection type) */
-	MSC_CTR_BSSMAP_TX_BSS_MANAGEMENT,
-	MSC_CTR_BSSMAP_TX_DTAP,
-	MSC_CTR_BSSMAP_TX_UNKNOWN,
-	MSC_CTR_BSSMAP_TX_SHORT,
-	MSC_CTR_BSSMAP_TX_ERR_CONN_NOT_READY,
-	MSC_CTR_BSSMAP_TX_ERR_SEND,
-	MSC_CTR_BSSMAP_TX_SUCCESS,
-
-	/* Tx message counters (per message type) */
-	MSC_CTR_BSSMAP_TX_UDT_RESET,
-	MSC_CTR_BSSMAP_TX_UDT_RESET_ACK,
-	MSC_CTR_BSSMAP_TX_DT1_CLEAR_RQST,
-	MSC_CTR_BSSMAP_TX_DT1_CLEAR_COMPLETE,
-	MSC_CTR_BSSMAP_TX_DT1_ASSIGMENT_FAILURE,
-	MSC_CTR_BSSMAP_TX_DT1_ASSIGMENT_COMPLETE,
-	MSC_CTR_BSSMAP_TX_DT1_SAPI_N_REJECT,
-	MSC_CTR_BSSMAP_TX_DT1_CIPHER_COMPLETE,
-	MSC_CTR_BSSMAP_TX_DT1_CIPHER_REJECT,
-	MSC_CTR_BSSMAP_TX_DT1_CLASSMARK_UPDATE,
-	MSC_CTR_BSSMAP_TX_DT1_LCLS_CONNECT_CTRL_ACK,
-	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_REQUIRED,
-	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_PERFORMED,
-	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_RQST_ACKNOWLEDGE,
-	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_DETECT,
-	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_COMPLETE,
-	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_FAILURE,
-	MSC_CTR_BSSMAP_TX_DT1_DTAP,
-	MSC_CTR_BSSMAP_TX_DT1_PERFORM_LOCATION_RESPONSE_SUCCESS,
-	MSC_CTR_BSSMAP_TX_DT1_PERFORM_LOCATION_RESPONSE_FAILURE,
-
-	MSC_CTR_MSCPOOL_SUBSCR_NEW,
-	MSC_CTR_MSCPOOL_SUBSCR_REATTACH,
-	MSC_CTR_MSCPOOL_SUBSCR_KNOWN,
-	MSC_CTR_MSCPOOL_SUBSCR_PAGED,
-	MSC_CTR_MSCPOOL_SUBSCR_ATTACH_LOST,
-	MSC_CTR_MSCPOOL_EMERG_FORWARDED,
-};
-
-/* Constants for the MSC stats */
-enum {
-	MSC_STAT_MSC_LINKS_ACTIVE,
-	MSC_STAT_MSC_LINKS_TOTAL,
-};
-
 /*! /brief Information on a remote MSC for libbsc.
  */
 struct bsc_msc_data {
diff --git a/include/osmocom/bsc/bsc_stats.h b/include/osmocom/bsc/bsc_stats.h
index 8d2f77f..1c8c0bb 100644
--- a/include/osmocom/bsc/bsc_stats.h
+++ b/include/osmocom/bsc/bsc_stats.h
@@ -269,3 +269,73 @@
 };
 
 extern const struct osmo_stat_item_group_desc bts_statg_desc;
+
+/* per MSC rate counters */
+enum {
+	/* Rx message counters */
+	MSC_CTR_BSSMAP_RX_UDT_RESET_ACKNOWLEDGE,
+	MSC_CTR_BSSMAP_RX_UDT_RESET,
+	MSC_CTR_BSSMAP_RX_UDT_PAGING,
+	MSC_CTR_BSSMAP_RX_UDT_UNKNOWN,
+	MSC_CTR_BSSMAP_RX_DT1_CLEAR_CMD,
+	MSC_CTR_BSSMAP_RX_DT1_CIPHER_MODE_CMD,
+	MSC_CTR_BSSMAP_RX_DT1_ASSIGMENT_RQST,
+	MSC_CTR_BSSMAP_RX_DT1_LCLS_CONNECT_CTRL,
+	MSC_CTR_BSSMAP_RX_DT1_HANDOVER_CMD,
+	MSC_CTR_BSSMAP_RX_DT1_CLASSMARK_RQST,
+	MSC_CTR_BSSMAP_RX_DT1_CONFUSION,
+	MSC_CTR_BSSMAP_RX_DT1_COMMON_ID,
+	MSC_CTR_BSSMAP_RX_DT1_UNKNOWN,
+	MSC_CTR_BSSMAP_RX_DT1_DTAP,
+	MSC_CTR_BSSMAP_RX_DT1_DTAP_ERROR,
+	MSC_CTR_BSSMAP_RX_DT1_PERFORM_LOCATION_REQUEST,
+	MSC_CTR_BSSMAP_RX_DT1_PERFORM_LOCATION_ABORT,
+
+	/* Tx message counters (per connection type) */
+	MSC_CTR_BSSMAP_TX_BSS_MANAGEMENT,
+	MSC_CTR_BSSMAP_TX_DTAP,
+	MSC_CTR_BSSMAP_TX_UNKNOWN,
+	MSC_CTR_BSSMAP_TX_SHORT,
+	MSC_CTR_BSSMAP_TX_ERR_CONN_NOT_READY,
+	MSC_CTR_BSSMAP_TX_ERR_SEND,
+	MSC_CTR_BSSMAP_TX_SUCCESS,
+
+	/* Tx message counters (per message type) */
+	MSC_CTR_BSSMAP_TX_UDT_RESET,
+	MSC_CTR_BSSMAP_TX_UDT_RESET_ACK,
+	MSC_CTR_BSSMAP_TX_DT1_CLEAR_RQST,
+	MSC_CTR_BSSMAP_TX_DT1_CLEAR_COMPLETE,
+	MSC_CTR_BSSMAP_TX_DT1_ASSIGMENT_FAILURE,
+	MSC_CTR_BSSMAP_TX_DT1_ASSIGMENT_COMPLETE,
+	MSC_CTR_BSSMAP_TX_DT1_SAPI_N_REJECT,
+	MSC_CTR_BSSMAP_TX_DT1_CIPHER_COMPLETE,
+	MSC_CTR_BSSMAP_TX_DT1_CIPHER_REJECT,
+	MSC_CTR_BSSMAP_TX_DT1_CLASSMARK_UPDATE,
+	MSC_CTR_BSSMAP_TX_DT1_LCLS_CONNECT_CTRL_ACK,
+	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_REQUIRED,
+	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_PERFORMED,
+	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_RQST_ACKNOWLEDGE,
+	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_DETECT,
+	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_COMPLETE,
+	MSC_CTR_BSSMAP_TX_DT1_HANDOVER_FAILURE,
+	MSC_CTR_BSSMAP_TX_DT1_DTAP,
+	MSC_CTR_BSSMAP_TX_DT1_PERFORM_LOCATION_RESPONSE_SUCCESS,
+	MSC_CTR_BSSMAP_TX_DT1_PERFORM_LOCATION_RESPONSE_FAILURE,
+
+	MSC_CTR_MSCPOOL_SUBSCR_NEW,
+	MSC_CTR_MSCPOOL_SUBSCR_REATTACH,
+	MSC_CTR_MSCPOOL_SUBSCR_KNOWN,
+	MSC_CTR_MSCPOOL_SUBSCR_PAGED,
+	MSC_CTR_MSCPOOL_SUBSCR_ATTACH_LOST,
+	MSC_CTR_MSCPOOL_EMERG_FORWARDED,
+};
+
+extern const struct rate_ctr_group_desc msc_ctrg_desc;
+
+/* per MSC stat items */
+enum {
+	MSC_STAT_MSC_LINKS_ACTIVE,
+	MSC_STAT_MSC_LINKS_TOTAL,
+};
+
+extern const struct osmo_stat_item_group_desc msc_statg_desc;
diff --git a/src/osmo-bsc/bsc_stats.c b/src/osmo-bsc/bsc_stats.c
index e12426a..ff953a4 100644
--- a/src/osmo-bsc/bsc_stats.c
+++ b/src/osmo-bsc/bsc_stats.c
@@ -687,3 +687,117 @@
 	.num_items = ARRAY_SIZE(bts_stat_desc),
 	.item_desc = bts_stat_desc,
 };
+
+static const struct rate_ctr_desc msc_ctr_description[] = {
+	/* Rx message counters  (per specific message) */
+	[MSC_CTR_BSSMAP_RX_UDT_RESET_ACKNOWLEDGE] = {"bssmap:rx:udt:reset:ack", "Number of received BSSMAP UDT RESET ACKNOWLEDGE messages"},
+	[MSC_CTR_BSSMAP_RX_UDT_RESET] =             {"bssmap:rx:udt:reset:request", "Number of received BSSMAP UDT RESET messages"},
+	[MSC_CTR_BSSMAP_RX_UDT_PAGING] =            {"bssmap:rx:udt:paging", "Number of received BSSMAP UDT PAGING messages"},
+	[MSC_CTR_BSSMAP_RX_UDT_UNKNOWN] =           {"bssmap:rx:udt:err_unknown", "Number of received BSSMAP unknown UDT messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_CLEAR_CMD] =         {"bssmap:rx:dt1:clear:cmd", "Number of received BSSMAP DT1 CLEAR CMD messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_CIPHER_MODE_CMD] =   {"bssmap:rx:dt1:cipher_mode:cmd", "Number of received BSSMAP DT1 CIPHER MODE CMD messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_ASSIGMENT_RQST] =    {"bssmap:rx:dt1:assignment:rqst", "Number of received BSSMAP DT1 ASSIGMENT RQST messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_LCLS_CONNECT_CTRL] = {"bssmap:rx:dt1:lcls_connect_ctrl:cmd", "Number of received BSSMAP DT1 LCLS CONNECT CTRL messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_HANDOVER_CMD] =      {"bssmap:rx:dt1:handover:cmd", "Number of received BSSMAP DT1 HANDOVER CMD messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_CLASSMARK_RQST] =    {"bssmap:rx:dt1:classmark:rqst", "Number of received BSSMAP DT1 CLASSMARK RQST messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_CONFUSION] =         {"bssmap:rx:dt1:confusion", "Number of received BSSMAP DT1 CONFUSION messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_COMMON_ID] =         {"bssmap:rx:dt1:common_id", "Number of received BSSMAP DT1 COMMON ID messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_UNKNOWN] =           {"bssmap:rx:dt1:err_unknown", "Number of received BSSMAP unknown DT1 messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_DTAP] =              {"bssmap:rx:dt1:dtap:good", "Number of received BSSMAP DTAP messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_DTAP_ERROR] =        {"bssmap:rx:dt1:dtap:error", "Number of received BSSMAP DTAP messages with errors"},
+	[MSC_CTR_BSSMAP_RX_DT1_PERFORM_LOCATION_REQUEST] = {"bssmap:rx:dt1:location:request", "Number of received BSSMAP Perform Location Request messages"},
+	[MSC_CTR_BSSMAP_RX_DT1_PERFORM_LOCATION_ABORT] = {"bssmap:tx:dt1:location:abort", "Number of received BSSMAP Perform Location Abort messages"},
+
+	/* Tx message counters (per message type)
+	 *
+	 * The counters here follow the logic of the osmo_bsc_sigtran_send() function
+	 * which receives DT1 messages from the upper layers and actually sends them to the MSC.
+	 * These counters cover all messages passed to the function by the upper layers: */
+	[MSC_CTR_BSSMAP_TX_BSS_MANAGEMENT] =     {"bssmap:tx:type:bss_management", "Number of transmitted BSS MANAGEMENT messages"},
+	[MSC_CTR_BSSMAP_TX_DTAP] =               {"bssmap:tx:type:dtap", "Number of transmitted DTAP messages"},
+	[MSC_CTR_BSSMAP_TX_UNKNOWN] =            {"bssmap:tx:type:err_unknown", "Number of transmitted messages with unknown type (an error in our code?)"},
+	[MSC_CTR_BSSMAP_TX_SHORT] =              {"bssmap:tx:type:err_short", "Number of transmitted messages which are too short (an error in our code?)"},
+	/* The next counters are also counted in the osmo_bsc_sigtran_send() function and
+	 * sum up to the exactly same number as the counters above but instead of message
+	 * classes they split by the result of the sending attempt: */
+	[MSC_CTR_BSSMAP_TX_ERR_CONN_NOT_READY] = {"bssmap:tx:result:err_conn_not_ready", "Number of BSSMAP messages we tried to send when the connection was not ready yet"},
+	[MSC_CTR_BSSMAP_TX_ERR_SEND] =           {"bssmap:tx:result:err_send", "Number of socket errors while sending BSSMAP messages"},
+	[MSC_CTR_BSSMAP_TX_SUCCESS] =            {"bssmap:tx:result:success", "Number of successfully sent BSSMAP messages"},
+
+	/* Tx message counters (per specific message)
+	 *
+	 * Theoretically, the DT1 counters should sum up to the same number as the Tx counters
+	 * above but since these counters are coming from the upper layers, there might be
+	 * some difference if we forget some code path. */
+	[MSC_CTR_BSSMAP_TX_UDT_RESET] =                     {"bssmap:tx:udt:reset:request", "Number of transmitted BSSMAP UDT RESET messages"},
+	[MSC_CTR_BSSMAP_TX_UDT_RESET_ACK] =                 {"bssmap:tx:udt:reset:ack", "Number of transmitted BSSMAP UDT RESET ACK messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_CLEAR_RQST] =                {"bssmap:tx:dt1:clear:rqst", "Number of transmitted BSSMAP DT1 CLEAR RQSTtx  messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_CLEAR_COMPLETE] =            {"bssmap:tx:dt1:clear:complete", "Number of transmitted BSSMAP DT1 CLEAR COMPLETE messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_ASSIGMENT_FAILURE] =         {"bssmap:tx:dt1:assigment:failure", "Number of transmitted BSSMAP DT1 ASSIGMENT FAILURE messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_ASSIGMENT_COMPLETE] =        {"bssmap:tx:dt1:assigment:complete", "Number of transmitted BSSMAP DT1 ASSIGMENT COMPLETE messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_SAPI_N_REJECT] =             {"bssmap:tx:dt1:sapi_n:reject", "Number of transmitted BSSMAP DT1 SAPI N REJECT messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_CIPHER_COMPLETE] =           {"bssmap:tx:dt1:cipher_mode:complete", "Number of transmitted BSSMAP DT1 CIPHER COMPLETE messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_CIPHER_REJECT] =             {"bssmap:tx:dt1:cipher_mode:reject", "Number of transmitted BSSMAP DT1 CIPHER REJECT messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_CLASSMARK_UPDATE] =          {"bssmap:tx:dt1:classmark:update", "Number of transmitted BSSMAP DT1 CLASSMARK UPDATE messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_LCLS_CONNECT_CTRL_ACK] =     {"bssmap:tx:dt1:lcls_connect_ctrl:ack", "Number of transmitted BSSMAP DT1 LCLS CONNECT CTRL ACK messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_REQUIRED] =         {"bssmap:tx:dt1:handover:required", "Number of transmitted BSSMAP DT1 HANDOVER REQUIRED messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_PERFORMED] =        {"bssmap:tx:dt1:handover:performed", "Number of transmitted BSSMAP DT1 HANDOVER PERFORMED messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_RQST_ACKNOWLEDGE] = {"bssmap:tx:dt1:handover:rqst_acknowledge", "Number of transmitted BSSMAP DT1 HANDOVER RQST ACKNOWLEDGE messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_DETECT] =           {"bssmap:tx:dt1:handover:detect", "Number of transmitted BSSMAP DT1 HANDOVER DETECT messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_COMPLETE] =         {"bssmap:tx:dt1:handover:complete", "Number of transmitted BSSMAP DT1 HANDOVER COMPLETE messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_FAILURE] =          {"bssmap:tx:dt1:handover:failure", "Number of transmitted BSSMAP DT1 HANDOVER FAILURE messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_DTAP] =                      {"bssmap:tx:dt1:dtap", "Number of transmitted BSSMAP DT1 DTAP messages"},
+	[MSC_CTR_BSSMAP_TX_DT1_PERFORM_LOCATION_RESPONSE_SUCCESS] = {"bssmap:tx:dt1:location:response_success",
+		"Number of transmitted BSSMAP Perform Location Response messages containing a location estimate"},
+	[MSC_CTR_BSSMAP_TX_DT1_PERFORM_LOCATION_RESPONSE_FAILURE] = {"bssmap:tx:dt1:location:response_failure",
+		"Number of transmitted BSSMAP Perform Location Response messages containing a failure cause"},
+
+	/* Indicators for MSC pool usage */
+	[MSC_CTR_MSCPOOL_SUBSCR_NEW] = {
+		"mscpool:subscr:new",
+		"Complete Layer 3 requests assigned to this MSC by round-robin (no NRI was assigned yet).",
+	},
+	[MSC_CTR_MSCPOOL_SUBSCR_REATTACH] = {
+		"mscpool:subscr:reattach",
+		"Complete Layer 3 requests assigned to this MSC by round-robin because the subscriber indicates a"
+		" NULL-NRI (previously assigned by another MSC).",
+	},
+	[MSC_CTR_MSCPOOL_SUBSCR_KNOWN] = {
+		"mscpool:subscr:known",
+		"Complete Layer 3 requests directed to this MSC because the subscriber indicates an NRI of this MSC.",
+	},
+	[MSC_CTR_MSCPOOL_SUBSCR_PAGED] = {
+		"mscpool:subscr:paged",
+		"Paging Response directed to this MSC because the subscriber was recently paged by this MSC.",
+	},
+	[MSC_CTR_MSCPOOL_SUBSCR_ATTACH_LOST] = {
+		"mscpool:subscr:attach_lost",
+		"A subscriber indicates an NRI value matching this MSC, but the MSC is not connected:"
+		" a re-attach to another MSC (if available) was forced, with possible service failure.",
+	},
+	[MSC_CTR_MSCPOOL_EMERG_FORWARDED] = {
+		"mscpool:emerg:forwarded",
+		"Emergency call requests forwarded to this MSC.",
+	},
+};
+
+const struct rate_ctr_group_desc msc_ctrg_desc = {
+	"msc",
+	"mobile switching center",
+	OSMO_STATS_CLASS_GLOBAL,
+	ARRAY_SIZE(msc_ctr_description),
+	msc_ctr_description,
+};
+
+static const struct osmo_stat_item_desc msc_stat_desc[] = {
+	[MSC_STAT_MSC_LINKS_ACTIVE] = { "msc_links:active", "Number of active MSC links", "", 16, 0 },
+	[MSC_STAT_MSC_LINKS_TOTAL] = { "msc_links:total", "Number of configured MSC links", "", 16, 0 },
+};
+
+const struct osmo_stat_item_group_desc msc_statg_desc = {
+	.group_name_prefix = "msc",
+	.group_description = "mobile switching center",
+	.class_id = OSMO_STATS_CLASS_GLOBAL,
+	.num_items = ARRAY_SIZE(msc_stat_desc),
+	.item_desc = msc_stat_desc,
+};
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index afb633d..6943f1f 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -48,6 +48,7 @@
 #include <osmocom/core/byteswap.h>
 #include <osmocom/bsc/lb.h>
 #include <osmocom/bsc/lcs_loc_req.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 #define S(x)	(1 << (x))
 
diff --git a/src/osmo-bsc/lcs_loc_req.c b/src/osmo-bsc/lcs_loc_req.c
index 7153ce6..8b76bc9 100644
--- a/src/osmo-bsc/lcs_loc_req.c
+++ b/src/osmo-bsc/lcs_loc_req.c
@@ -39,6 +39,7 @@
 #include <osmocom/bsc/paging.h>
 #include <osmocom/bsc/bts_trx.h>
 #include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 enum lcs_loc_req_fsm_state {
 	LCS_LOC_REQ_ST_INIT,
diff --git a/src/osmo-bsc/osmo_bsc_msc.c b/src/osmo-bsc/osmo_bsc_msc.c
index a80ee64..49fd32d 100644
--- a/src/osmo-bsc/osmo_bsc_msc.c
+++ b/src/osmo-bsc/osmo_bsc_msc.c
@@ -30,6 +30,7 @@
 #include <osmocom/bsc/osmo_bsc_sigtran.h>
 #include <osmocom/bsc/signal.h>
 #include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/bsc_stats.h>
 
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/socket.h>
@@ -45,120 +46,6 @@
 #include <netinet/tcp.h>
 #include <unistd.h>
 
-static const struct rate_ctr_desc msc_ctr_description[] = {
-	/* Rx message counters  (per specific message) */
-	[MSC_CTR_BSSMAP_RX_UDT_RESET_ACKNOWLEDGE] = {"bssmap:rx:udt:reset:ack", "Number of received BSSMAP UDT RESET ACKNOWLEDGE messages"},
-	[MSC_CTR_BSSMAP_RX_UDT_RESET] =             {"bssmap:rx:udt:reset:request", "Number of received BSSMAP UDT RESET messages"},
-	[MSC_CTR_BSSMAP_RX_UDT_PAGING] =            {"bssmap:rx:udt:paging", "Number of received BSSMAP UDT PAGING messages"},
-	[MSC_CTR_BSSMAP_RX_UDT_UNKNOWN] =           {"bssmap:rx:udt:err_unknown", "Number of received BSSMAP unknown UDT messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_CLEAR_CMD] =         {"bssmap:rx:dt1:clear:cmd", "Number of received BSSMAP DT1 CLEAR CMD messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_CIPHER_MODE_CMD] =   {"bssmap:rx:dt1:cipher_mode:cmd", "Number of received BSSMAP DT1 CIPHER MODE CMD messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_ASSIGMENT_RQST] =    {"bssmap:rx:dt1:assignment:rqst", "Number of received BSSMAP DT1 ASSIGMENT RQST messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_LCLS_CONNECT_CTRL] = {"bssmap:rx:dt1:lcls_connect_ctrl:cmd", "Number of received BSSMAP DT1 LCLS CONNECT CTRL messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_HANDOVER_CMD] =      {"bssmap:rx:dt1:handover:cmd", "Number of received BSSMAP DT1 HANDOVER CMD messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_CLASSMARK_RQST] =    {"bssmap:rx:dt1:classmark:rqst", "Number of received BSSMAP DT1 CLASSMARK RQST messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_CONFUSION] =         {"bssmap:rx:dt1:confusion", "Number of received BSSMAP DT1 CONFUSION messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_COMMON_ID] =         {"bssmap:rx:dt1:common_id", "Number of received BSSMAP DT1 COMMON ID messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_UNKNOWN] =           {"bssmap:rx:dt1:err_unknown", "Number of received BSSMAP unknown DT1 messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_DTAP] =              {"bssmap:rx:dt1:dtap:good", "Number of received BSSMAP DTAP messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_DTAP_ERROR] =        {"bssmap:rx:dt1:dtap:error", "Number of received BSSMAP DTAP messages with errors"},
-	[MSC_CTR_BSSMAP_RX_DT1_PERFORM_LOCATION_REQUEST] = {"bssmap:rx:dt1:location:request", "Number of received BSSMAP Perform Location Request messages"},
-	[MSC_CTR_BSSMAP_RX_DT1_PERFORM_LOCATION_ABORT] = {"bssmap:tx:dt1:location:abort", "Number of received BSSMAP Perform Location Abort messages"},
-
-	/* Tx message counters (per message type)
-	 *
-	 * The counters here follow the logic of the osmo_bsc_sigtran_send() function
-	 * which receives DT1 messages from the upper layers and actually sends them to the MSC.
-	 * These counters cover all messages passed to the function by the upper layers: */
-	[MSC_CTR_BSSMAP_TX_BSS_MANAGEMENT] =     {"bssmap:tx:type:bss_management", "Number of transmitted BSS MANAGEMENT messages"},
-	[MSC_CTR_BSSMAP_TX_DTAP] =               {"bssmap:tx:type:dtap", "Number of transmitted DTAP messages"},
-	[MSC_CTR_BSSMAP_TX_UNKNOWN] =            {"bssmap:tx:type:err_unknown", "Number of transmitted messages with unknown type (an error in our code?)"},
-	[MSC_CTR_BSSMAP_TX_SHORT] =              {"bssmap:tx:type:err_short", "Number of transmitted messages which are too short (an error in our code?)"},
-	/* The next counters are also counted in the osmo_bsc_sigtran_send() function and
-	 * sum up to the exactly same number as the counters above but instead of message
-	 * classes they split by the result of the sending attempt: */
-	[MSC_CTR_BSSMAP_TX_ERR_CONN_NOT_READY] = {"bssmap:tx:result:err_conn_not_ready", "Number of BSSMAP messages we tried to send when the connection was not ready yet"},
-	[MSC_CTR_BSSMAP_TX_ERR_SEND] =           {"bssmap:tx:result:err_send", "Number of socket errors while sending BSSMAP messages"},
-	[MSC_CTR_BSSMAP_TX_SUCCESS] =            {"bssmap:tx:result:success", "Number of successfully sent BSSMAP messages"},
-
-	/* Tx message counters (per specific message)
-	 *
-	 * Theoretically, the DT1 counters should sum up to the same number as the Tx counters
-	 * above but since these counters are coming from the upper layers, there might be
-	 * some difference if we forget some code path. */
-	[MSC_CTR_BSSMAP_TX_UDT_RESET] =                     {"bssmap:tx:udt:reset:request", "Number of transmitted BSSMAP UDT RESET messages"},
-	[MSC_CTR_BSSMAP_TX_UDT_RESET_ACK] =                 {"bssmap:tx:udt:reset:ack", "Number of transmitted BSSMAP UDT RESET ACK messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_CLEAR_RQST] =                {"bssmap:tx:dt1:clear:rqst", "Number of transmitted BSSMAP DT1 CLEAR RQSTtx  messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_CLEAR_COMPLETE] =            {"bssmap:tx:dt1:clear:complete", "Number of transmitted BSSMAP DT1 CLEAR COMPLETE messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_ASSIGMENT_FAILURE] =         {"bssmap:tx:dt1:assigment:failure", "Number of transmitted BSSMAP DT1 ASSIGMENT FAILURE messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_ASSIGMENT_COMPLETE] =        {"bssmap:tx:dt1:assigment:complete", "Number of transmitted BSSMAP DT1 ASSIGMENT COMPLETE messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_SAPI_N_REJECT] =             {"bssmap:tx:dt1:sapi_n:reject", "Number of transmitted BSSMAP DT1 SAPI N REJECT messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_CIPHER_COMPLETE] =           {"bssmap:tx:dt1:cipher_mode:complete", "Number of transmitted BSSMAP DT1 CIPHER COMPLETE messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_CIPHER_REJECT] =             {"bssmap:tx:dt1:cipher_mode:reject", "Number of transmitted BSSMAP DT1 CIPHER REJECT messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_CLASSMARK_UPDATE] =          {"bssmap:tx:dt1:classmark:update", "Number of transmitted BSSMAP DT1 CLASSMARK UPDATE messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_LCLS_CONNECT_CTRL_ACK] =     {"bssmap:tx:dt1:lcls_connect_ctrl:ack", "Number of transmitted BSSMAP DT1 LCLS CONNECT CTRL ACK messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_REQUIRED] =         {"bssmap:tx:dt1:handover:required", "Number of transmitted BSSMAP DT1 HANDOVER REQUIRED messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_PERFORMED] =        {"bssmap:tx:dt1:handover:performed", "Number of transmitted BSSMAP DT1 HANDOVER PERFORMED messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_RQST_ACKNOWLEDGE] = {"bssmap:tx:dt1:handover:rqst_acknowledge", "Number of transmitted BSSMAP DT1 HANDOVER RQST ACKNOWLEDGE messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_DETECT] =           {"bssmap:tx:dt1:handover:detect", "Number of transmitted BSSMAP DT1 HANDOVER DETECT messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_COMPLETE] =         {"bssmap:tx:dt1:handover:complete", "Number of transmitted BSSMAP DT1 HANDOVER COMPLETE messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_HANDOVER_FAILURE] =          {"bssmap:tx:dt1:handover:failure", "Number of transmitted BSSMAP DT1 HANDOVER FAILURE messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_DTAP] =                      {"bssmap:tx:dt1:dtap", "Number of transmitted BSSMAP DT1 DTAP messages"},
-	[MSC_CTR_BSSMAP_TX_DT1_PERFORM_LOCATION_RESPONSE_SUCCESS] = {"bssmap:tx:dt1:location:response_success",
-		"Number of transmitted BSSMAP Perform Location Response messages containing a location estimate"},
-	[MSC_CTR_BSSMAP_TX_DT1_PERFORM_LOCATION_RESPONSE_FAILURE] = {"bssmap:tx:dt1:location:response_failure",
-		"Number of transmitted BSSMAP Perform Location Response messages containing a failure cause"},
-
-	/* Indicators for MSC pool usage */
-	[MSC_CTR_MSCPOOL_SUBSCR_NEW] = {
-		"mscpool:subscr:new",
-		"Complete Layer 3 requests assigned to this MSC by round-robin (no NRI was assigned yet).",
-	},
-	[MSC_CTR_MSCPOOL_SUBSCR_REATTACH] = {
-		"mscpool:subscr:reattach",
-		"Complete Layer 3 requests assigned to this MSC by round-robin because the subscriber indicates a"
-		" NULL-NRI (previously assigned by another MSC).",
-	},
-	[MSC_CTR_MSCPOOL_SUBSCR_KNOWN] = {
-		"mscpool:subscr:known",
-		"Complete Layer 3 requests directed to this MSC because the subscriber indicates an NRI of this MSC.",
-	},
-	[MSC_CTR_MSCPOOL_SUBSCR_PAGED] = {
-		"mscpool:subscr:paged",
-		"Paging Response directed to this MSC because the subscriber was recently paged by this MSC.",
-	},
-	[MSC_CTR_MSCPOOL_SUBSCR_ATTACH_LOST] = {
-		"mscpool:subscr:attach_lost",
-		"A subscriber indicates an NRI value matching this MSC, but the MSC is not connected:"
-		" a re-attach to another MSC (if available) was forced, with possible service failure.",
-	},
-	[MSC_CTR_MSCPOOL_EMERG_FORWARDED] = {
-		"mscpool:emerg:forwarded",
-		"Emergency call requests forwarded to this MSC.",
-	},
-};
-
-static const struct rate_ctr_group_desc msc_ctrg_desc = {
-	"msc",
-	"mobile switching center",
-	OSMO_STATS_CLASS_GLOBAL,
-	ARRAY_SIZE(msc_ctr_description),
-	msc_ctr_description,
-};
-
-static const struct osmo_stat_item_desc msc_stat_desc[] = {
-	[MSC_STAT_MSC_LINKS_ACTIVE] = { "msc_links:active", "Number of active MSC links", "", 16, 0 },
-	[MSC_STAT_MSC_LINKS_TOTAL] = { "msc_links:total", "Number of configured MSC links", "", 16, 0 },
-};
-
-static const struct osmo_stat_item_group_desc msc_statg_desc = {
-	.group_name_prefix = "msc",
-	.group_description = "mobile switching center",
-	.class_id = OSMO_STATS_CLASS_GLOBAL,
-	.num_items = ARRAY_SIZE(msc_stat_desc),
-	.item_desc = msc_stat_desc,
-};
-
 int osmo_bsc_msc_init(struct bsc_msc_data *msc)
 {
 	struct gsm_network *net = msc->network;
diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c
index d3c636d..8c0fb13 100644
--- a/src/osmo-bsc/osmo_bsc_sigtran.c
+++ b/src/osmo-bsc/osmo_bsc_sigtran.c
@@ -36,6 +36,7 @@
 #include <osmocom/bsc/gsm_data.h>
 #include <osmocom/bsc/bts.h>
 #include <osmocom/bsc/paging.h>
+#include <osmocom/bsc/bsc_stats.h>
 #include <osmocom/mgcp_client/mgcp_common.h>
 
 /* A pointer to a list with all involved MSCs

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I03ab34f1c0511016da5b8c7db33d8d76db99f3af
Gerrit-Change-Number: 25276
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/7749d61a/attachment.htm>


More information about the gerrit-log mailing list