aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-07-05 11:11:42 +0200
committerosmith <osmith@sysmocom.de>2021-08-10 10:35:18 +0000
commit978396732b378714be33f6a6c3fbda6c60236755 (patch)
tree812cbb35658c482d2c72866b3b3f6dd06a5e527b
parent3f561bfbfe4d03beb7f192881cdbc8bbec34dcf8 (diff)
Add counters: pcu.sgsn.N.rx_paging_{cs,ps}
-rw-r--r--src/gprs_bssgp_pcu.c22
-rw-r--r--src/gprs_bssgp_pcu.h7
2 files changed, 29 insertions, 0 deletions
diff --git a/src/gprs_bssgp_pcu.c b/src/gprs_bssgp_pcu.c
index e2f6f519..1fcacdb1 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 void *tall_pcu_ctx;
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 @@ static int gprs_bssgp_pcu_rx_paging_cs(struct msgb *msg, const struct tlv_parsed
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 @@ static int gprs_bssgp_pcu_rx_paging_ps(struct msgb *msg, const struct tlv_parsed
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 @@ struct gprs_bssgp_pcu *gprs_bssgp_init(
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 6c6de1df..907e6663 100644
--- a/src/gprs_bssgp_pcu.h
+++ b/src/gprs_bssgp_pcu.h
@@ -46,6 +46,11 @@ struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei);
#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 gprs_bssgp_pcu {
struct osmo_timer_list bvc_timer;
+ struct rate_ctr_group *ctrs;
+
/* state: is the NSVC unblocked? */
int nsvc_unblocked;