Change in osmo-pcu[master]: Take into account BTS supported (M)CS values when retrieving the maximum

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

pespin gerrit-no-reply at lists.osmocom.org
Fri Oct 30 19:43:11 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/20992 )


Change subject: Take into account BTS supported (M)CS values when retrieving the maximum
......................................................................

Take into account BTS supported (M)CS values when retrieving the maximum

Change-Id: I2d3a8bbae2f9887400ce56d2f8303ea30abaecfa
---
M src/bts.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_ms.cpp
4 files changed, 78 insertions(+), 25 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/92/20992/1

diff --git a/src/bts.cpp b/src/bts.cpp
index be957fa..79bb9e6 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -1005,6 +1005,61 @@
 	bitvec_free(immediate_assignment);
 }
 
+/* return maximum DL CS supported by BTS and allowed by VTY */
+uint8_t BTS::max_cs_dl(void) const
+{
+	int i;
+	if (!m_bts.max_cs_dl)
+		return 0;
+	for (i = m_bts.max_cs_dl - 1; i >= 0; i--) {
+		if (m_bts.cs_supported[i]) {
+			return i + 1;
+		}
+	}
+	return 0;
+}
+
+/* return maximum UL CS supported by BTS and allowed by VTY */
+uint8_t BTS::max_cs_ul(void) const
+{
+	int i;
+	if (!m_bts.max_cs_ul)
+		return 0;
+	for (i = m_bts.max_cs_ul - 1; i >= 0; i--) {
+		if (m_bts.cs_supported[i]) {
+			return i + 1;
+		}
+	}
+	return 0;
+}
+
+/* return maximum DL MCS supported by BTS and allowed by VTY */
+uint8_t BTS::max_mcs_dl(void) const
+{
+	int i;
+	if (!m_bts.max_mcs_dl)
+		return 0;
+	for (i = m_bts.max_mcs_dl - 1; i >= 0; i--) {
+		if (m_bts.mcs_supported[i]) {
+			return i + 1;
+		}
+	}
+	return 0;
+}
+
+/* return maximum UL MCS supported by BTS and allowed by VTY */
+uint8_t BTS::max_mcs_ul(void) const
+{
+	int i;
+	if (!m_bts.max_mcs_ul)
+		return 0;
+	for (i = m_bts.max_mcs_ul - 1; i >= 0; i--) {
+		if (m_bts.mcs_supported[i]) {
+			return i + 1;
+		}
+	}
+	return 0;
+}
 
 GprsMs *BTS::ms_alloc(uint8_t ms_class, uint8_t egprs_ms_class)
 {
diff --git a/src/bts.h b/src/bts.h
index 9bf80e1..edb5d6e 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -329,6 +329,11 @@
 
 	void snd_dl_ass(gprs_rlcmac_tbf *tbf, bool poll, uint16_t pgroup);
 
+	uint8_t max_cs_dl(void) const;
+	uint8_t max_cs_ul(void) const;
+	uint8_t max_mcs_dl(void) const;
+	uint8_t max_mcs_ul(void) const;
+
 	GprsMsStorage &ms_store();
 	GprsMs *ms_by_tlli(uint32_t tlli, uint32_t old_tlli = 0);
 	GprsMs *ms_by_imsi(const char *imsi);
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index d36d96d..a788ac0 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -750,8 +750,8 @@
 					}
 				}
 			}
-		} else if (bts->max_mcs_dl) {
-			num = bts->max_mcs_dl;
+		} else if (bts->bts->max_mcs_dl()) {
+			num = bts->bts->max_mcs_dl();
 		} else {
 			num = 9;
 		}
@@ -770,8 +770,8 @@
 				}
 			}
 		}
-	} else if (bts->max_cs_dl) {
-		num = bts->max_cs_dl;
+	} else if (bts->bts->max_cs_dl()) {
+		num = bts->bts->max_cs_dl();
 	} else {
 		num = 4;
 	}
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index efd1845..b295686 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -541,9 +541,8 @@
 
 	m_egprs_ms_class = ms_class_;
 
-	struct gprs_rlcmac_bts *bts = m_bts->bts_data();
-	if (mcs_is_edge_gmsk(mcs_get_egprs_by_num(bts->max_mcs_ul)) &&
-		mcs_is_edge_gmsk(mcs_get_egprs_by_num(bts->max_mcs_dl)) &&
+	if (mcs_is_edge_gmsk(mcs_get_egprs_by_num(m_bts->max_mcs_ul())) &&
+		mcs_is_edge_gmsk(mcs_get_egprs_by_num(m_bts->max_mcs_dl())) &&
 		mode() != EGPRS)
 	{
 		set_mode(EGPRS_GMSK);
@@ -609,26 +608,23 @@
 
 enum CodingScheme GprsMs::max_cs_ul() const
 {
-	struct gprs_rlcmac_bts *bts_data;
-
 	OSMO_ASSERT(m_bts != NULL);
-	bts_data = m_bts->bts_data();
 
 	if (mcs_is_gprs(m_current_cs_ul)) {
-		if (!bts_data->max_cs_ul) {
+		if (!m_bts->max_cs_ul()) {
 			return CS4;
 		}
 
-		return mcs_get_gprs_by_num(bts_data->max_cs_ul);
+		return mcs_get_gprs_by_num(m_bts->max_cs_ul());
 	}
 
 	if (!mcs_is_edge(m_current_cs_ul))
 		return UNKNOWN;
 
-	if (bts_data->max_mcs_ul)
-		return mcs_get_egprs_by_num(bts_data->max_mcs_ul);
-	else if (bts_data->max_cs_ul)
-		return mcs_get_gprs_by_num(bts_data->max_cs_ul);
+	if (m_bts->max_mcs_ul())
+		return mcs_get_egprs_by_num(m_bts->max_mcs_ul());
+	else if (m_bts->max_cs_ul())
+		return mcs_get_gprs_by_num(m_bts->max_cs_ul());
 
 	return MCS4;
 }
@@ -640,26 +636,23 @@
 
 enum CodingScheme GprsMs::max_cs_dl() const
 {
-	struct gprs_rlcmac_bts *bts_data;
-
 	OSMO_ASSERT(m_bts != NULL);
-	bts_data = m_bts->bts_data();
 
 	if (mcs_is_gprs(m_current_cs_dl)) {
-		if (!bts_data->max_cs_dl) {
+		if (!m_bts->max_cs_dl()) {
 			return CS4;
 		}
 
-		return mcs_get_gprs_by_num(bts_data->max_cs_dl);
+		return mcs_get_gprs_by_num(m_bts->max_cs_dl());
 	}
 
 	if (!mcs_is_edge(m_current_cs_dl))
 		return UNKNOWN;
 
-	if (bts_data->max_mcs_dl)
-		return mcs_get_egprs_by_num(bts_data->max_mcs_dl);
-	else if (bts_data->max_cs_dl)
-		return mcs_get_gprs_by_num(bts_data->max_cs_dl);
+	if (m_bts->max_mcs_dl())
+		return mcs_get_egprs_by_num(m_bts->max_mcs_dl());
+	else if (m_bts->max_cs_dl())
+		return mcs_get_gprs_by_num(m_bts->max_cs_dl());
 
 	return MCS4;
 }

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I2d3a8bbae2f9887400ce56d2f8303ea30abaecfa
Gerrit-Change-Number: 20992
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201030/c3a4acd2/attachment.htm>


More information about the gerrit-log mailing list