Change in osmo-pcu[master]: pcuif: Improve BTS-supported CS/MCS handling

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:10 UTC 2020


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


Change subject: pcuif: Improve BTS-supported CS/MCS handling
......................................................................

pcuif: Improve BTS-supported CS/MCS handling

Take into account the MCS values supported by the BTS. In osmo-bts,
in general all MCS are enabled if "mode egprs" is selected in BSC,
and none otherwise.

Change-Id: Ie8f0215ba17da1e545e98bec9325c02f1e8efaea
---
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/pcu_l1_if.cpp
M src/pcu_main.cpp
M tests/emu/pcu_emu.cpp
5 files changed, 47 insertions(+), 37 deletions(-)



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

diff --git a/src/bts.h b/src/bts.h
index a3fa975..9bf80e1 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -110,10 +110,8 @@
 	uint32_t fc_bvc_leak_rate;
 	uint32_t fc_ms_bucket_size;
 	uint32_t fc_ms_leak_rate;
-	uint8_t cs1;
-	uint8_t cs2;
-	uint8_t cs3;
-	uint8_t cs4;
+	bool cs_supported[4];
+	bool mcs_supported[9];
 	uint8_t initial_cs_dl, initial_cs_ul;
 	uint8_t initial_mcs_dl, initial_mcs_ul;
 	uint8_t max_cs_dl, max_cs_ul;
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 9b6cbaa..d36d96d 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -736,13 +736,20 @@
 static enum CodingScheme max_coding_scheme_dl(struct gprs_rlcmac_bts *bts)
 {
 	int num;
+	int i;
 
 	if (bts->egprs_enabled) {
 		if (!bts->cs_adj_enabled) {
-			if (bts->initial_mcs_dl)
+			if (bts->initial_mcs_dl) {
 				num = bts->initial_mcs_dl;
-			else
-				num = 1;
+			} else {
+				for (i = sizeof(bts->mcs_supported) - 1; i >= 0; i--) {
+					if (bts->mcs_supported[i]) {
+						num = i + 1;
+						break;
+					}
+				}
+			}
 		} else if (bts->max_mcs_dl) {
 			num = bts->max_mcs_dl;
 		} else {
@@ -753,16 +760,16 @@
 	}
 
 	if (!bts->cs_adj_enabled) {
-		if (bts->initial_cs_dl)
+		if (bts->initial_cs_dl) {
 			num = bts->initial_cs_dl;
-		else if (bts->cs4)
-			num = 4;
-		else if (bts->cs3)
-			num = 3;
-		else if (bts->cs2)
-			num = 2;
-		else
-			num = 1;
+		} else {
+			for (i = sizeof(bts->cs_supported) - 1; i >= 0; i--) {
+				if (bts->cs_supported[i]) {
+					num = i + 1;
+					break;
+				}
+			}
+		}
 	} else if (bts->max_cs_dl) {
 		num = bts->max_cs_dl;
 	} else {
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 8a825a1..4e2f339 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -551,7 +551,8 @@
 	struct gprs_bssgp_pcu *pcu;
 	int rc = 0;
 	unsigned int trx_nr, ts_nr;
-	int i;
+	unsigned int i;
+	bool any_cs_supported;
 
 	if (info_ind->version != PCU_IF_VERSION) {
 		fprintf(stderr, "PCU interface version number of BTS (%u) is "
@@ -613,16 +614,33 @@
 	LOGP(DL1IF, LOGL_DEBUG, " dl_tbf_ext=%d\n", info_ind->dl_tbf_ext);
 	LOGP(DL1IF, LOGL_DEBUG, " ul_tbf_ext=%d\n", info_ind->ul_tbf_ext);
 	bts->bsic = info_ind->bsic;
-	for (i = 0; i < 4; i++) {
-		if ((info_ind->flags & (PCU_IF_FLAG_CS1 << i)))
-			LOGP(DL1IF, LOGL_DEBUG, " Use CS%d\n", i+1);
+
+	for (any_cs_supported = false, i = 0; i < sizeof(bts->cs_supported); i++) {
+			bts->cs_supported[i] = (info_ind->flags & (PCU_IF_FLAG_CS1 << i));
+			if (bts->cs_supported[0]) {
+				any_cs_supported = true;
+				LOGP(DL1IF, LOGL_DEBUG, " Use CS%d\n", i+1);
+			}
 	}
-	for (i = 0; i < 9; i++) {
-		if ((info_ind->flags & (PCU_IF_FLAG_MCS1 << i)))
+	if (!any_cs_supported) /* We need at least 1 CS, let's enable CS1 */
+		bts->cs_supported[0] = true;
+
+	for (i = 0; i < sizeof(bts->mcs_supported); i++) {
+		bts->mcs_supported[i] = (info_ind->flags & (PCU_IF_FLAG_MCS1 << i));
+		if (bts->mcs_supported[i]) {
 			LOGP(DL1IF, LOGL_DEBUG, " Use MCS%d\n", i+1);
+		}
 	}
+
 	LOGP(DL1IF, LOGL_DEBUG, " initial_cs=%d\n", info_ind->initial_cs);
 	LOGP(DL1IF, LOGL_DEBUG, " initial_mcs=%d\n", info_ind->initial_mcs);
+	if (!bts->force_cs) {
+		if (info_ind->initial_cs < 1 || info_ind->initial_cs > 4)
+			bts->initial_cs_dl = 1;
+		else
+			bts->initial_cs_dl = info_ind->initial_cs;
+		bts->initial_cs_ul = bts->initial_cs_dl;
+	}
 
 	pcu = gprs_bssgp_init(
 			bts,
@@ -640,12 +658,6 @@
 		goto bssgp_failed;
 	}
 
-	bts->cs1 = !!(info_ind->flags & PCU_IF_FLAG_CS1);
-	bts->cs2 = !!(info_ind->flags & PCU_IF_FLAG_CS2);
-	bts->cs3 = !!(info_ind->flags & PCU_IF_FLAG_CS3);
-	bts->cs4 = !!(info_ind->flags & PCU_IF_FLAG_CS4);
-	if (!bts->cs1 && !bts->cs2 && !bts->cs3 && !bts->cs4)
-		bts->cs1 = 1;
 	if (info_ind->t3142) { /* if timer values are set */
 		osmo_tdef_set(bts->T_defs_bts, 3142, info_ind->t3142, OSMO_TDEF_S);
 		osmo_tdef_set(bts->T_defs_bts, 3169, info_ind->t3169, OSMO_TDEF_S);
@@ -656,13 +668,6 @@
 		bts->n3103 = info_ind->n3103;
 		bts->n3105 = info_ind->n3105;
 	}
-	if (!bts->force_cs) {
-		if (info_ind->initial_cs < 1 || info_ind->initial_cs > 4)
-			bts->initial_cs_dl = 1;
-		else
-			bts->initial_cs_dl = info_ind->initial_cs;
-		bts->initial_cs_ul = bts->initial_cs_dl;
-	}
 
 	for (trx_nr = 0; trx_nr < ARRAY_SIZE(bts->trx); trx_nr++) {
 		bts->trx[trx_nr].arfcn = info_ind->trx[trx_nr].arfcn;
diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp
index cda10e7..2d65d54 100644
--- a/src/pcu_main.cpp
+++ b/src/pcu_main.cpp
@@ -231,7 +231,7 @@
 	bts->fc_interval = 1;
 	bts->initial_cs_dl = bts->initial_cs_ul = 1;
 	bts->initial_mcs_dl = bts->initial_mcs_ul = 1;
-	bts->cs1 = 1;
+	bts->cs_supported[0] = true;
 	bts->n3101 = 10;
 	bts->n3103 = 4;
 	bts->n3105 = 8;
diff --git a/tests/emu/pcu_emu.cpp b/tests/emu/pcu_emu.cpp
index 41231a3..c275e3a 100644
--- a/tests/emu/pcu_emu.cpp
+++ b/tests/emu/pcu_emu.cpp
@@ -68,7 +68,7 @@
 	struct gprs_rlcmac_bts *bts = bts_main_data();
 	bts->fc_interval = 100;
 	bts->initial_cs_dl = bts->initial_cs_ul = 1;
-	bts->cs1 = 1;
+	bts->cs_supported[0] = true;
 	bts->n3101 = 10;
 	bts->n3103 = 4;
 	bts->n3105 = 8;

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ie8f0215ba17da1e545e98bec9325c02f1e8efaea
Gerrit-Change-Number: 20990
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/585d3204/attachment.htm>


More information about the gerrit-log mailing list