Change in osmo-bts[master]: osmo-bts-trx: add rate counter for Uplink block decoding errors

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

fixeria gerrit-no-reply at lists.osmocom.org
Sat Aug 28 17:55:16 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25270 )


Change subject: osmo-bts-trx: add rate counter for Uplink block decoding errors
......................................................................

osmo-bts-trx: add rate counter for Uplink block decoding errors

During the channel activation, allocate a counter group for each
logical channel (struct l1sched_chan_state).  Deallocate it on
deactivation.  The rate counter API requires a unique group index,
which unfortunately cannot be determined for dedicated channels.
As a quick hack, use monolitically increasing numbers for that.

Change-Id: I7aea0529771ad73d5d6bcaf0865f9b0d4ecace6b
Related: OS#4771
---
M include/osmo-bts/scheduler.h
M src/common/scheduler.c
M src/osmo-bts-trx/sched_lchan_pdtch.c
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
M src/osmo-bts-trx/sched_lchan_xcch.c
6 files changed, 42 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/70/25270/1

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 80a260f..b526db0 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -148,6 +148,14 @@
 
 	/* handover */
 	bool			ho_rach_detect;	/* if rach detection is on */
+
+	/* Rate counters (see L1SCHED_LCHAN_CTR_*) */
+	struct rate_ctr_group	*ctrs;
+};
+
+/* Rate counters for struct l1sched_chan_state */
+enum {
+	L1SCHED_LCHAN_CTR_UL_BAD_BLOCK,
 };
 
 struct l1sched_ts {
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 6e1e4fb..81cebf4 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -597,6 +597,20 @@
 	l1sched_ts_ctr_desc
 };
 
+static const struct rate_ctr_desc l1sched_lchan_ctr_desc[] = {
+	[L1SCHED_LCHAN_CTR_UL_BAD_BLOCK] = {
+		"l1sched_lchan:ul_bad_block",
+		"Uplink blocks which could not be decoded (Viterbi errors)"
+	},
+};
+static const struct rate_ctr_group_desc l1sched_lchan_ctrg_desc = {
+	"l1sched_lchan",
+	"L1 scheduler logical channel",
+	OSMO_STATS_CLASS_GLOBAL,
+	ARRAY_SIZE(l1sched_lchan_ctr_desc),
+	l1sched_lchan_ctr_desc,
+};
+
 /*
  * init / exit
  */
@@ -677,6 +691,7 @@
 				talloc_free(chan_state->ul_bursts);
 				chan_state->ul_bursts = NULL;
 			}
+			rate_ctr_group_free(chan_state->ctrs);
 		}
 		/* clear lchan channel states */
 		for (i = 0; i < ARRAY_SIZE(ts->lchan); i++)
@@ -1065,6 +1080,8 @@
 	struct l1sched_ts *l1ts = lchan->ts->priv;
 	uint8_t tn = L1SAP_CHAN2TS(chan_nr);
 	uint8_t ss = l1sap_chan2ss(chan_nr);
+	static unsigned int ctrg_idx = 0;
+	char ctrg_name[256];
 	bool found = false;
 	int i;
 
@@ -1104,11 +1121,22 @@
 
 			/* Bind to generic 'struct gsm_lchan' */
 			chan_state->lchan = lchan;
+
+			/* Allocate per-l1cs rate counters with unique index */
+			chan_state->ctrs = rate_ctr_group_alloc(l1ts,
+								&l1sched_lchan_ctrg_desc,
+								ctrg_idx++);
+			snprintf(ctrg_name, sizeof(ctrg_name), "%s %s",
+				 lchan->name, trx_chan_desc[i].name);
+			rate_ctr_group_set_name(chan_state->ctrs, ctrg_name);
 		} else {
 			chan_state->ho_rach_detect = 0;
 
 			/* Remove pending Tx prims belonging to this lchan */
 			trx_sched_queue_filter(&l1ts->dl_prims, chan_nr, link_id);
+
+			/* De-allocate per-l1cs rate counters */
+			rate_ctr_group_free(chan_state->ctrs);
 		}
 
 		chan_state->active = active;
diff --git a/src/osmo-bts-trx/sched_lchan_pdtch.c b/src/osmo-bts-trx/sched_lchan_pdtch.c
index 335ba6f..4bfccf3 100644
--- a/src/osmo-bts-trx/sched_lchan_pdtch.c
+++ b/src/osmo-bts-trx/sched_lchan_pdtch.c
@@ -130,6 +130,7 @@
 	} else {
 		LOGL1SB(DL1P, LOGL_DEBUG, l1ts, bi, "Received bad PDTCH (%u/%u)\n",
 			bi->fn % l1ts->mf_period, l1ts->mf_period);
+		rate_ctr_inc2(chan_state->ctrs, L1SCHED_LCHAN_CTR_UL_BAD_BLOCK);
 		rc = 0;
 		presence_info = PRES_INFO_INVALID;
 	}
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index 689925f..ead68b7 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -212,11 +212,13 @@
 	if (rc < 0) {
 		LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi, "Received bad data (%u/%u)\n",
 			bi->fn % l1ts->mf_period, l1ts->mf_period);
+		rate_ctr_inc2(chan_state->ctrs, L1SCHED_LCHAN_CTR_UL_BAD_BLOCK);
 		bfi_flag = true;
 	} else if (rc < 4) {
 		LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
 			"Received bad data (%u/%u) with invalid codec mode %d\n",
 			bi->fn % l1ts->mf_period, l1ts->mf_period, rc);
+		rate_ctr_inc2(chan_state->ctrs, L1SCHED_LCHAN_CTR_UL_BAD_BLOCK);
 		bfi_flag = true;
 	}
 
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 4f03bd1..aec38c3 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -240,11 +240,13 @@
 	if (rc < 0) {
 		LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi, "Received bad data (%u/%u)\n",
 			bi->fn % l1ts->mf_period, l1ts->mf_period);
+		rate_ctr_inc2(chan_state->ctrs, L1SCHED_LCHAN_CTR_UL_BAD_BLOCK);
 		bfi_flag = true;
 	} else if (rc < 4) {
 		LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi,
 			"Received bad data (%u/%u) with invalid codec mode %d\n",
 			bi->fn % l1ts->mf_period, l1ts->mf_period, rc);
+		rate_ctr_inc2(chan_state->ctrs, L1SCHED_LCHAN_CTR_UL_BAD_BLOCK);
 		bfi_flag = true;
 	}
 
diff --git a/src/osmo-bts-trx/sched_lchan_xcch.c b/src/osmo-bts-trx/sched_lchan_xcch.c
index 4bfc101..f994c1d 100644
--- a/src/osmo-bts-trx/sched_lchan_xcch.c
+++ b/src/osmo-bts-trx/sched_lchan_xcch.c
@@ -131,6 +131,7 @@
 	if (rc) {
 		LOGL1SB(DL1P, LOGL_NOTICE, l1ts, bi, "Received bad data (%u/%u)\n",
 			bi->fn % l1ts->mf_period, l1ts->mf_period);
+		rate_ctr_inc2(chan_state->ctrs, L1SCHED_LCHAN_CTR_UL_BAD_BLOCK);
 		l2_len = 0;
 
 		/* When SACCH Repetition is active, we may try to decode the

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I7aea0529771ad73d5d6bcaf0865f9b0d4ecace6b
Gerrit-Change-Number: 25270
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210828/2facb071/attachment.htm>


More information about the gerrit-log mailing list