Change in osmo-msc[master]: libmsc/gsm_09_11.c: introduce rate counters for NC_SS sessions

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jul 30 19:29:18 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9711 )

Change subject: libmsc/gsm_09_11.c: introduce rate counters for NC_SS sessions
......................................................................

libmsc/gsm_09_11.c: introduce rate counters for NC_SS sessions

This change introduces some new rate counters for call-independent
SS/USSD connections. As OsmoMSC doesn't handle the messages itself,
and only responsible for dispatching messages between both
A and GSUP interfaces, the following is taken into account:

  - MS-initiated and network-initiated requests to establish
    a NC SS/USSD session (transaction) - "nc_ss:m{o|t}_requests";

  - successfully established MS-initiated and network-initiated
    SS/USSD sessions (transactions) - "nc_ss:m{o|t}_established".

Change-Id: I23c9475abc9951d82f3342fdc5aaa367836f7741
---
M include/osmocom/msc/gsm_data.h
M src/libmsc/gsm_09_11.c
M src/libmsc/msc_vty.c
3 files changed, 38 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 73047ee..3af619d 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -200,6 +200,10 @@
 	MSC_CTR_CALL_ACTIVE,
 	MSC_CTR_CALL_COMPLETE,
 	MSC_CTR_CALL_INCOMPLETE,
+	MSC_CTR_NC_SS_MO_REQUESTS,
+	MSC_CTR_NC_SS_MO_ESTABLISHED,
+	MSC_CTR_NC_SS_MT_REQUESTS,
+	MSC_CTR_NC_SS_MT_ESTABLISHED,
 };
 
 static const struct rate_ctr_desc msc_ctr_description[] = {
@@ -227,6 +231,10 @@
 	[MSC_CTR_CALL_ACTIVE] =			{"call:active", "Count total amount of calls that ever reached active state."},
 	[MSC_CTR_CALL_COMPLETE] = 		{"call:complete", "Count total amount of calls which got terminated by disconnect req or ind after reaching active state."},
 	[MSC_CTR_CALL_INCOMPLETE] = 		{"call:incomplete", "Count total amount of call which got terminated by any other reason after reaching active state."},
+	[MSC_CTR_NC_SS_MO_REQUESTS] = 		{"nc_ss:mo_requests", "Received MS-initiated call independent SS/USSD requests."},
+	[MSC_CTR_NC_SS_MO_ESTABLISHED] = 	{"nc_ss:mo_established", "Established MS-initiated call independent SS/USSD sessions."},
+	[MSC_CTR_NC_SS_MT_REQUESTS] = 		{"nc_ss:mt_requests", "Received network-initiated call independent SS/USSD requests."},
+	[MSC_CTR_NC_SS_MT_ESTABLISHED] = 	{"nc_ss:mt_established", "Established network-initiated call independent SS/USSD sessions."},
 };
 
 static const struct rate_ctr_group_desc msc_ctrg_desc = {
diff --git a/src/libmsc/gsm_09_11.c b/src/libmsc/gsm_09_11.c
index 96acd8c..2c5afb3 100644
--- a/src/libmsc/gsm_09_11.c
+++ b/src/libmsc/gsm_09_11.c
@@ -31,6 +31,7 @@
 #include <stdbool.h>
 
 #include <osmocom/core/linuxlist.h>
+#include <osmocom/core/rate_ctr.h>
 #include <osmocom/core/utils.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/gsm/tlv.h>
@@ -74,6 +75,9 @@
 	/* Reuse existing transaction, or create a new one */
 	trans = trans_find_by_id(conn, pdisc, tid);
 	if (!trans) {
+		/* Count MS-initiated attempts to establish a NC SS/USSD session */
+		rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_NC_SS_MO_REQUESTS]);
+
 		/**
 		 * According to GSM TS 04.80, section 2.4.2 "Register
 		 * (mobile station to network direction)", the REGISTER
@@ -185,6 +189,10 @@
 	else
 		msc_subscr_conn_communicating(conn);
 
+	/* Count established MS-initiated NC SS/USSD sessions */
+	if (msg_type == GSM0480_MTYPE_REGISTER)
+		rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_NC_SS_MO_ESTABLISHED]);
+
 	return 0;
 
 error:
@@ -233,6 +241,9 @@
 		/* Sent to the MS, give ownership of ss_msg */
 		msc_tx_dtap(transt->conn, ss_msg);
 		transt->ss.msg = NULL;
+
+		/* Count established network-initiated NC SS/USSD sessions */
+		rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_NC_SS_MT_ESTABLISHED]);
 		break;
 	case GSM_PAGING_EXPIRED:
 	case GSM_PAGING_BUSY:
@@ -386,6 +397,9 @@
 	/* Attempt to find DTAP-transaction */
 	trans = trans_find_by_callref(net, gsup_msg->session_id);
 	if (!trans) {
+		/* Count network-initiated attempts to establish a NC SS/USSD session */
+		rate_ctr_inc(&net->msc_ctrs->ctr[MSC_CTR_NC_SS_MT_REQUESTS]);
+
 		/* Attempt to establish a new transaction */
 		trans = establish_nc_ss_trans(net, vsub, gsup_msg);
 		if (!trans) {
@@ -464,5 +478,9 @@
 	if (trans_end)
 		trans_free(trans);
 
+	/* Count established network-initiated NC SS/USSD sessions */
+	if (gsup_msg->session_state == OSMO_GSUP_SESSION_STATE_BEGIN)
+		rate_ctr_inc(&net->msc_ctrs->ctr[MSC_CTR_NC_SS_MT_ESTABLISHED]);
+
 	return 0;
 }
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index d10028e..3cbb001 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -1217,6 +1217,18 @@
 		gsmnet->msc_ctrs->ctr[MSC_CTR_CALL_MT_SETUP].current,
 		gsmnet->msc_ctrs->ctr[MSC_CTR_CALL_MT_CONNECT].current,
 		VTY_NEWLINE);
+	vty_out(vty, "MO NC SS/USSD           : %lu requests, %lu established, %lu rejected%s",
+		gsmnet->msc_ctrs->ctr[MSC_CTR_NC_SS_MO_REQUESTS].current,
+		gsmnet->msc_ctrs->ctr[MSC_CTR_NC_SS_MO_ESTABLISHED].current,
+		gsmnet->msc_ctrs->ctr[MSC_CTR_NC_SS_MO_REQUESTS].current
+			- gsmnet->msc_ctrs->ctr[MSC_CTR_NC_SS_MO_ESTABLISHED].current,
+		VTY_NEWLINE);
+	vty_out(vty, "MT NC SS/USSD           : %lu requests, %lu established, %lu rejected%s",
+		gsmnet->msc_ctrs->ctr[MSC_CTR_NC_SS_MT_REQUESTS].current,
+		gsmnet->msc_ctrs->ctr[MSC_CTR_NC_SS_MT_ESTABLISHED].current,
+		gsmnet->msc_ctrs->ctr[MSC_CTR_NC_SS_MT_REQUESTS].current
+			- gsmnet->msc_ctrs->ctr[MSC_CTR_NC_SS_MT_ESTABLISHED].current,
+		VTY_NEWLINE);
 	return CMD_SUCCESS;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/9711
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I23c9475abc9951d82f3342fdc5aaa367836f7741
Gerrit-Change-Number: 9711
Gerrit-PatchSet: 6
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Alexander Chemeris <Alexander.Chemeris at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180730/2611157e/attachment.htm>


More information about the gerrit-log mailing list