Change in osmo-pcu[master]: Add counters: pcu.sgsn.N.rx_paging_{cs, ps}

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

osmith gerrit-no-reply at lists.osmocom.org
Tue Aug 10 10:35:18 UTC 2021


osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/25153 )

Change subject: Add counters: pcu.sgsn.N.rx_paging_{cs,ps}
......................................................................

Add counters: pcu.sgsn.N.rx_paging_{cs,ps}

Related: SYS#4878
Change-Id: Iefba6f3d29c69fd4865c084bd9cf1a3a78f5c202
---
M src/gprs_bssgp_pcu.c
M src/gprs_bssgp_pcu.h
2 files changed, 29 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  daniel: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gprs_bssgp_pcu.c b/src/gprs_bssgp_pcu.c
index e2f6f51..1fcacdb 100644
--- a/src/gprs_bssgp_pcu.c
+++ b/src/gprs_bssgp_pcu.c
@@ -33,6 +33,7 @@
 #include <osmocom/gsm/protocol/gsm_23_003.h>
 #include <osmocom/gprs/protocol/gsm_08_16.h>
 #include <osmocom/core/utils.h>
+#include <osmocom/core/stats.h>
 #include <osmocom/gsm/gsm48.h>
 #include "coding_scheme.h"
 #include "tbf_dl.h"
@@ -53,6 +54,19 @@
 extern uint16_t spoof_mcc, spoof_mnc;
 extern bool spoof_mnc_3_digits;
 
+static const struct rate_ctr_desc sgsn_ctr_description[] = {
+	[SGSN_CTR_RX_PAGING_CS] = { "rx_paging_cs", "Amount of paging CS requests received" },
+	[SGSN_CTR_RX_PAGING_PS] = { "rx_paging_ps", "Amount of paging PS requests received" },
+};
+
+static const struct rate_ctr_group_desc sgsn_ctrg_desc = {
+	.group_name_prefix = "pcu:sgsn",
+	.group_description = "SGSN Statistics",
+	.class_id = OSMO_STATS_CLASS_SUBSCRIBER,
+	.num_ctr = ARRAY_SIZE(sgsn_ctr_description),
+	.ctr_desc = sgsn_ctr_description,
+};
+
 static void bvc_timeout(void *_priv);
 
 static int parse_ra_cap(struct tlv_parsed *tp, MS_Radio_Access_capability_t *rac)
@@ -223,6 +237,8 @@
 	struct GprsMs *ms;
 	int rc;
 
+	rate_ctr_inc(rate_ctr_group_get_ctr(the_pcu->bssgp.ctrs, SGSN_CTR_RX_PAGING_CS));
+
 	if ((rc = get_paging_cs_mi(&req, tp)) > 0)
 		return bssgp_tx_status((enum gprs_bssgp_cause) rc, NULL, msg);
 
@@ -280,6 +296,8 @@
 	uint16_t pgroup;
 	int rc;
 
+	rate_ctr_inc(rate_ctr_group_get_ctr(the_pcu->bssgp.ctrs, SGSN_CTR_RX_PAGING_PS));
+
 	if (!TLVP_PRESENT(tp, BSSGP_IE_IMSI)) {
 		LOGP(DBSSGP, LOGL_ERROR, "No IMSI\n");
 		return bssgp_tx_status(BSSGP_CAUSE_MISSING_MAND_IE, NULL, msg);
@@ -1288,11 +1306,15 @@
 
 	osmo_timer_setup(&the_pcu->bssgp.bvc_timer, bvc_timeout, bts);
 
+	the_pcu->bssgp.ctrs = rate_ctr_group_alloc(the_pcu, &sgsn_ctrg_desc, 0);
+	OSMO_ASSERT(the_pcu->bssgp.ctrs)
+
 	return &the_pcu->bssgp;
 }
 
 void gprs_bssgp_destroy(struct gprs_rlcmac_bts *bts)
 {
+	rate_ctr_group_free(the_pcu->bssgp.ctrs);
 	osmo_timer_del(&the_pcu->bssgp.bvc_timer);
 
 	/* FIXME: blocking... */
diff --git a/src/gprs_bssgp_pcu.h b/src/gprs_bssgp_pcu.h
index 6c6de1d..907e666 100644
--- a/src/gprs_bssgp_pcu.h
+++ b/src/gprs_bssgp_pcu.h
@@ -46,6 +46,11 @@
 #define NS_HDR_LEN 4
 #define IE_LLC_PDU 14
 
+enum sgsn_counter_id {
+	SGSN_CTR_RX_PAGING_CS,
+	SGSN_CTR_RX_PAGING_PS,
+};
+
 struct gprs_bssgp_pcu {
 	struct bssgp_bvc_ctx *bctx;
 
@@ -53,6 +58,8 @@
 
 	struct osmo_timer_list bvc_timer;
 
+	struct rate_ctr_group *ctrs;
+
 	/* state: is the NSVC unblocked? */
 	int nsvc_unblocked;
 

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Iefba6f3d29c69fd4865c084bd9cf1a3a78f5c202
Gerrit-Change-Number: 25153
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210810/afb72d30/attachment.htm>


More information about the gerrit-log mailing list