Change in osmo-pcu[master]: Add stats: pcu.bts.N.pdch.occupied.gprs/egprs

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
Mon Sep 20 08:17:53 UTC 2021


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

Change subject: Add stats: pcu.bts.N.pdch.occupied.gprs/egprs
......................................................................

Add stats: pcu.bts.N.pdch.occupied.gprs/egprs

Add stats needed for performance measurements in
3GPP TS 52.402 § B.2.1.54-55.

Split m_num_tbfs to count GPRS and EGPRS TBFs separately. Move the code
that updates m_num_tbfs and sets the PDCH_OCCUPIED stats to a separate
function, as it's mostly the same in the TBF attach and detach.

Related: SYS#4878
Change-Id: I0c0a1121b4ae5f031782e7e63a0c28eb0b6c8b42
---
M src/bts.cpp
M src/bts.h
M src/pdch.cpp
M src/pdch.h
M src/tbf.cpp
M src/tbf.h
6 files changed, 65 insertions(+), 26 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



diff --git a/src/bts.cpp b/src/bts.cpp
index beb626d..c463606 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -201,7 +201,11 @@
 		OSMO_STAT_ITEM_NO_UNIT, 4, 0},
 	{ "pdch.available",	"PDCH available       ",
 		OSMO_STAT_ITEM_NO_UNIT, 50, 0},
-	{ "pdch.occupied",	"PDCH occupied        ",
+	{ "pdch.occupied",	"PDCH occupied (all)  ",
+		OSMO_STAT_ITEM_NO_UNIT, 50, 0},
+	{ "pdch.occupied.gprs",	"PDCH occupied (GPRS) ",
+		OSMO_STAT_ITEM_NO_UNIT, 50, 0},
+	{ "pdch.occupied.egprs","PDCH occupied (EGPRS)",
 		OSMO_STAT_ITEM_NO_UNIT, 50, 0},
 };
 
diff --git a/src/bts.h b/src/bts.h
index a6e7150..d9a86eb 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -184,6 +184,8 @@
 	STAT_MS_PRESENT,
 	STAT_PDCH_AVAILABLE,
 	STAT_PDCH_OCCUPIED,
+	STAT_PDCH_OCCUPIED_GPRS,
+	STAT_PDCH_OCCUPIED_EGPRS,
 };
 
 /* RACH.ind parameters (to be parsed) */
diff --git a/src/pdch.cpp b/src/pdch.cpp
index e213c28..d10ee4a 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -1036,6 +1036,33 @@
 	return tbf;
 }
 
+void gprs_rlcmac_pdch::num_tbfs_update(gprs_rlcmac_tbf *tbf, bool is_attach)
+{
+	int threshold = is_attach ? 0 : 1;
+	int inc = is_attach ? 1 : -1;
+	uint8_t ul_dl_gprs = m_num_tbfs_gprs[GPRS_RLCMAC_UL_TBF] +
+			     m_num_tbfs_gprs[GPRS_RLCMAC_DL_TBF];
+	uint8_t ul_dl_egprs = m_num_tbfs_egprs[GPRS_RLCMAC_UL_TBF] +
+			      m_num_tbfs_egprs[GPRS_RLCMAC_DL_TBF];
+
+	/* Count PDCHs with at least one TBF as "occupied", as in
+	 * 3GPP TS 52.402 § B.2.1.42-44. So if transitioning from 0 (threshold)
+	 * TBFs in this PDCH to 1, increase the counter by 1 (inc). */
+	if (ul_dl_gprs + ul_dl_egprs == threshold)
+		bts_stat_item_add(trx->bts, STAT_PDCH_OCCUPIED, inc);
+
+	/* Update occupied GPRS/EGPRS stats (§ B.2.1.54-55) too */
+	if (tbf->is_egprs_enabled() && ul_dl_egprs == threshold)
+		bts_stat_item_add(trx->bts, STAT_PDCH_OCCUPIED_EGPRS, inc);
+	else if (!tbf->is_egprs_enabled() && ul_dl_gprs == threshold)
+		bts_stat_item_add(trx->bts, STAT_PDCH_OCCUPIED_GPRS, inc);
+
+	if (tbf->is_egprs_enabled())
+		m_num_tbfs_egprs[tbf->direction] += inc;
+	else
+		m_num_tbfs_gprs[tbf->direction] += inc;
+}
+
 void gprs_rlcmac_pdch::attach_tbf(gprs_rlcmac_tbf *tbf)
 {
 	gprs_rlcmac_ul_tbf *ul_tbf;
@@ -1045,13 +1072,7 @@
 			"%s has not been detached, overwriting it\n",
 			m_tbfs[tbf->direction][tbf->tfi()]->name());
 
-	/* Count PDCHs with at least one TBF as "occupied", as in
-	 * 3GPP TS 52.402 § B.2.1.42-44. So if transitioning from 0 TBFs in
-	 * this PDCH to 1, increase the counter by 1. */
-	if (m_num_tbfs[GPRS_RLCMAC_UL_TBF] + m_num_tbfs[GPRS_RLCMAC_DL_TBF] == 0)
-		bts_stat_item_inc(trx->bts, STAT_PDCH_OCCUPIED);
-
-	m_num_tbfs[tbf->direction] += 1;
+	num_tbfs_update(tbf, true);
 	if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
 		ul_tbf = as_ul_tbf(tbf);
 		m_assigned_usf |= 1 << ul_tbf->m_usf[ts_no];
@@ -1061,7 +1082,7 @@
 
 	LOGPDCH(this, DRLCMAC, LOGL_INFO, "Attaching %s, %d TBFs, "
 		"USFs = %02x, TFIs = %08x.\n",
-		tbf->name(), m_num_tbfs[tbf->direction],
+		tbf->name(), num_tbfs(tbf->direction),
 		m_assigned_usf, m_assigned_tfi[tbf->direction]);
 }
 
@@ -1069,15 +1090,13 @@
 {
 	gprs_rlcmac_ul_tbf *ul_tbf;
 
-	OSMO_ASSERT(m_num_tbfs[tbf->direction] > 0);
+	if (tbf->is_egprs_enabled()) {
+		OSMO_ASSERT(m_num_tbfs_egprs[tbf->direction] > 0);
+	} else {
+		OSMO_ASSERT(m_num_tbfs_gprs[tbf->direction] > 0);
+	}
 
-	/* Count PDCHs with at least one TBF as "occupied", as in
-	 * 3GPP TS 52.402 § B.2.1.42-44. So if transitioning from 1 TBFs in
-	 * this PDCH to 0, decrease the counter by 1. */
-	if (m_num_tbfs[GPRS_RLCMAC_UL_TBF] + m_num_tbfs[GPRS_RLCMAC_DL_TBF] == 1)
-		bts_stat_item_dec(trx->bts, STAT_PDCH_OCCUPIED);
-
-	m_num_tbfs[tbf->direction] -= 1;
+	num_tbfs_update(tbf, false);
 	if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
 		ul_tbf = as_ul_tbf(tbf);
 		m_assigned_usf &= ~(1 << ul_tbf->m_usf[ts_no]);
@@ -1089,7 +1108,7 @@
 
 	LOGPDCH(this, DRLCMAC, LOGL_INFO, "Detaching %s, %d TBFs, "
 		"USFs = %02x, TFIs = %08x.\n",
-		tbf->name(), m_num_tbfs[tbf->direction],
+		tbf->name(), num_tbfs(tbf->direction),
 		m_assigned_usf, m_assigned_tfi[tbf->direction]);
 }
 
diff --git a/src/pdch.h b/src/pdch.h
index 00f0b9d..9405606 100644
--- a/src/pdch.h
+++ b/src/pdch.h
@@ -78,6 +78,7 @@
 	void detach_tbf(gprs_rlcmac_tbf *tbf);
 
 	unsigned num_tbfs(enum gprs_rlcmac_tbf_direction dir) const;
+	void num_tbfs_update(gprs_rlcmac_tbf *tbf, bool is_attach);
 
 	void reserve(enum gprs_rlcmac_tbf_direction dir);
 	void unreserve(enum gprs_rlcmac_tbf_direction dir);
@@ -147,7 +148,8 @@
 	void free_resources();
 #endif
 
-	uint8_t m_num_tbfs[2];
+	uint8_t m_num_tbfs_gprs[2];
+	uint8_t m_num_tbfs_egprs[2];
 	uint8_t m_num_reserved[2];
 	uint8_t m_assigned_usf; /* bit set */
 	uint32_t m_assigned_tfi[2]; /* bit set */
@@ -158,7 +160,7 @@
 
 inline unsigned gprs_rlcmac_pdch::num_tbfs(enum gprs_rlcmac_tbf_direction dir) const
 {
-	return m_num_tbfs[dir];
+	return m_num_tbfs_gprs[dir] + m_num_tbfs_egprs[dir];
 }
 
 inline unsigned gprs_rlcmac_pdch::num_reserved(
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 4154d50..31dec72 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -763,6 +763,24 @@
 	return ts == control_ts;
 }
 
+void gprs_rlcmac_tbf::enable_egprs()
+{
+	/* Decrease GPRS TBF count of attached PDCHs */
+	for (size_t ts = 0; ts < ARRAY_SIZE(pdch); ts++) {
+		if (pdch[ts])
+			pdch[ts]->num_tbfs_update(this, false);
+	}
+
+	m_egprs_enabled = true;
+	window()->set_sns(RLC_EGPRS_SNS);
+
+	/* Increase EGPRS TBF count of attached PDCHs */
+	for (size_t ts = 0; ts < ARRAY_SIZE(pdch); ts++) {
+		if (pdch[ts])
+			pdch[ts]->num_tbfs_update(this, true);
+	}
+}
+
 /* C API */
 enum tbf_fsm_states tbf_state(const struct gprs_rlcmac_tbf *tbf)
 {
diff --git a/src/tbf.h b/src/tbf.h
index 0932933..3aaf9fb 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -354,12 +354,6 @@
 	return m_egprs_enabled;
 }
 
-inline void gprs_rlcmac_tbf::enable_egprs()
-{
-	m_egprs_enabled = true;
-	window()->set_sns(RLC_EGPRS_SNS);
-}
-
 inline enum gprs_rlcmac_tbf_direction reverse(enum gprs_rlcmac_tbf_direction dir)
 {
 	return (enum gprs_rlcmac_tbf_direction)

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0c0a1121b4ae5f031782e7e63a0c28eb0b6c8b42
Gerrit-Change-Number: 25400
Gerrit-PatchSet: 9
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210920/bab5d906/attachment.htm>


More information about the gerrit-log mailing list