[MERGED] osmo-bts[master]: BTS: add rate_ctr about CCCH (paging, agch, pch)

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
Sat Feb 24 18:27:39 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: BTS: add rate_ctr about CCCH (paging, agch, pch)
......................................................................


BTS: add rate_ctr about CCCH (paging, agch, pch)

Change-Id: Id6c833746150a3c2e32b00ea6604669f16b84bc4
---
M include/osmo-bts/bts.h
M include/osmo-bts/gsm_data.h
M include/osmo-bts/gsm_data_shared.h
M src/common/bts.c
M src/common/l1sap.c
M src/common/main.c
M src/common/paging.c
M src/common/rsl.c
M src/common/vty.c
9 files changed, 54 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved; Verified



diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 4d6e347..76f8ba5 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -1,6 +1,7 @@
 #ifndef _BTS_H
 #define _BTS_H
 
+#include <osmocom/core/rate_ctr.h>
 #include <osmo-bts/gsm_data.h>
 
 enum bts_global_status {
@@ -9,6 +10,17 @@
 	BTS_STATUS_LAST,
 };
 
+enum {
+	BTS_CTR_PAGING_RCVD,
+	BTS_CTR_PAGING_DROP,
+	BTS_CTR_PAGING_SENT,
+	BTS_CTR_RACH_RCVD,
+	BTS_CTR_RACH_SENT,
+	BTS_CTR_AGCH_RCVD,
+	BTS_CTR_AGCH_SENT,
+	BTS_CTR_AGCH_DELETED,
+};
+
 extern void *tall_bts_ctx;
 
 int bts_init(struct gsm_bts *bts);
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 4b834b5..f2574b1 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -35,6 +35,7 @@
 
 /* data structure for BTS related data specific to the BTS role */
 struct gsm_bts_role_bts {
+	struct gsm_bts *bts;
 	struct {
 		/* Interference Boundaries for OML */
 		int16_t boundary[6];
@@ -132,6 +133,7 @@
 };
 
 #define bts_role_bts(x)	((struct gsm_bts_role_bts *)(x)->role)
+#define btsb_bts(x)	(x)->bts
 
 #include <osmo-bts/gsm_data_shared.h>
 
diff --git a/include/osmo-bts/gsm_data_shared.h b/include/osmo-bts/gsm_data_shared.h
index 1571929..7cefb10 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -816,6 +816,8 @@
 	int force_combined_si;
 	int bcch_change_mark;
 
+	struct rate_ctr_group *ctrs;
+
 	void *role;
 };
 
diff --git a/src/common/bts.c b/src/common/bts.c
index 7849d61..60a309e 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -32,6 +32,8 @@
 #include <osmocom/core/timer.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/talloc.h>
+#include <osmocom/core/stats.h>
+#include <osmocom/core/rate_ctr.h>
 #include <osmocom/gsm/protocol/gsm_12_21.h>
 #include <osmocom/gsm/lapdm.h>
 #include <osmocom/trau/osmo_ortp.h>
@@ -79,6 +81,26 @@
 	return 0;
 }
 
+static const struct rate_ctr_desc bts_ctr_desc[] = {
+	[BTS_CTR_PAGING_RCVD] =		{"paging:rcvd", "Received paging requests (Abis)"},
+	[BTS_CTR_PAGING_DROP] =		{"paging:drop", "Dropped paging requests (Abis)"},
+	[BTS_CTR_PAGING_SENT] =		{"paging:sent", "Sent paging requests (Um)"},
+
+	[BTS_CTR_RACH_RCVD] =		{"rach:rcvd", "Received RACH requests (Um)"},
+	[BTS_CTR_RACH_SENT] =		{"rach:sent", "Sent RACH requests (Abis)"},
+
+	[BTS_CTR_AGCH_RCVD] =		{"agch:rcvd", "Received AGCH requests (Abis)"},
+	[BTS_CTR_AGCH_SENT] =		{"agch:sent", "Sent AGCH requests (Abis)"},
+	[BTS_CTR_AGCH_DELETED] =	{"agch:delete", "Sent AGCH DELETE IND (Abis)"},
+};
+static const struct rate_ctr_group_desc bts_ctrg_desc = {
+	"bts",
+	"base transceiver station",
+	OSMO_STATS_CLASS_GLOBAL,
+	ARRAY_SIZE(bts_ctr_desc),
+	bts_ctr_desc
+};
+
 /* Initialize the BTS (and TRX) data structures, called before config
  * file reading */
 int bts_init(struct gsm_bts *bts)
@@ -95,9 +117,12 @@
 	bts->band = GSM_BAND_1800;
 
 	bts->role = btsb = talloc_zero(bts, struct gsm_bts_role_bts);
+	btsb->bts = bts;
 
 	INIT_LLIST_HEAD(&btsb->agch_queue);
 	btsb->agch_queue_length = 0;
+
+	bts->ctrs = rate_ctr_group_alloc(bts, &bts_ctrg_desc, bts->nr);
 
 	/* enable management with default levels,
 	 * raise threshold to GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DISABLE to
@@ -636,6 +661,8 @@
 	if (!msg)
 		return rc;
 
+	rate_ctr_inc2(bts->ctrs, BTS_CTR_AGCH_SENT);
+
 	/* Copy AGCH message */
 	memcpy(out_buf, msgb_l3(msg), msgb_l3len(msg));
 	rc = msgb_l3len(msg);
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 3580a73..88d5a34 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1190,6 +1190,7 @@
 	uint8_t acc_delay;
 
 	DEBUGPFN(DL1P, rach_ind->fn, "Rx PH-RA.ind");
+	rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_RCVD);
 
 	lc = &trx->ts[0].lchan[CCCH_LCHAN].lapdm_ch;
 
@@ -1222,6 +1223,7 @@
 
 	LOGPFN(DL1P, LOGL_INFO, rach_ind->fn, "RACH for RR access (toa=%d, ra=%d)\n",
 		rach_ind->acc_delay, rach_ind->ra);
+	rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_SENT);
 	lapdm_phsap_up(&l1sap->oph, &lc->lapdm_dcch);
 
 	return 0;
diff --git a/src/common/main.c b/src/common/main.c
index b7d5653..df3c046 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -240,6 +240,7 @@
 	bts_log_init(NULL);
 	vty_init(&bts_vty_info);
 	ctrl_vty_init(tall_bts_ctx);
+	rate_ctr_init(tall_bts_ctx);
 
 	handle_options(argc, argv);
 
diff --git a/src/common/paging.c b/src/common/paging.c
index 957d609..d796176 100644
--- a/src/common/paging.c
+++ b/src/common/paging.c
@@ -179,9 +179,12 @@
 	struct llist_head *group_q = &ps->paging_queue[paging_group];
 	struct paging_record *pr;
 
+	rate_ctr_inc2(ps->btsb->bts->ctrs, BTS_CTR_PAGING_RCVD);
+
 	if (ps->num_paging >= ps->num_paging_max) {
 		LOGP(DPAG, LOGL_NOTICE, "Dropping paging, queue full (%u)\n",
 			ps->num_paging);
+		rate_ctr_inc2(ps->btsb->bts->ctrs, BTS_CTR_PAGING_DROP);
 		return -ENOSPC;
 	}
 
@@ -503,6 +506,7 @@
 			/* skip those that we might have re-added above */
 			if (pr[i] == NULL)
 				continue;
+			rate_ctr_inc2(ps->btsb->bts->ctrs, BTS_CTR_PAGING_SENT);
 			/* check if we can expire the paging record,
 			 * or if we need to re-queue it */
 			if (pr[i]->u.paging.expiration_time <= now) {
diff --git a/src/common/rsl.c b/src/common/rsl.c
index bffe69d..de04b3b 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -552,6 +552,8 @@
 	if (!TLVP_PRESENT(&tp, RSL_IE_FULL_IMM_ASS_INFO))
 		return rsl_tx_error_report(trx, RSL_ERR_MAND_IE_ERROR);
 
+	rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_AGCH_RCVD);
+
 	/* cut down msg to the 04.08 RR part */
 	msg->l3h = (uint8_t *) TLVP_VAL(&tp, RSL_IE_FULL_IMM_ASS_INFO);
 	msg->data = msg->l3h;
@@ -563,6 +565,7 @@
 		/* if there is no space in the queue: send DELETE IND */
 		rsl_tx_delete_ind(trx->bts, TLVP_VAL(&tp, RSL_IE_FULL_IMM_ASS_INFO),
 				  TLVP_LEN(&tp, RSL_IE_FULL_IMM_ASS_INFO));
+		rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_AGCH_DELETED);
 		msgb_free(msg);
 	}
 
diff --git a/src/common/vty.c b/src/common/vty.c
index 55c1e0f..a1cb2fe 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -808,6 +808,7 @@
 	}
 
 	bts_dump_vty_features(vty, bts);
+	vty_out_rate_ctr_group(vty, "  ", bts->ctrs);
 }
 
 

-- 
To view, visit https://gerrit.osmocom.org/6879
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id6c833746150a3c2e32b00ea6604669f16b84bc4
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list