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
Wed Nov 4 22:55:31 UTC 2020


pespin has submitted this change. ( 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.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/pcu_l1_if.cpp
M tests/emu/pcu_emu.cpp
5 files changed, 50 insertions(+), 40 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



diff --git a/src/bts.cpp b/src/bts.cpp
index 6a7960c..359f2d5 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -210,7 +210,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_mask = 1 << 0;  /* CS-1 always enabled by default */
 	bts->n3101 = 10;
 	bts->n3103 = 4;
 	bts->n3105 = 8;
diff --git a/src/bts.h b/src/bts.h
index a3fa975..7335483 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;
+	uint8_t cs_mask; /* Allowed CS mask from BTS */
+	uint16_t mcs_mask;  /* Allowed MCS mask from BTS */
 	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 671629b..4b5582d 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -738,40 +738,49 @@
 
 static enum CodingScheme max_coding_scheme_dl(struct gprs_rlcmac_bts *bts)
 {
-	int num;
+	int num = 0;
+	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 = 8; i >= 0; i--) {
+					if (bts->mcs_mask & (1 << i)) {
+						num = i + 1;
+						break;
+					}
+				}
+			}
 		} else if (bts->max_mcs_dl) {
 			num = bts->max_mcs_dl;
 		} else {
 			num = 9;
 		}
 
-		return mcs_get_egprs_by_num(num);
+		if (num)
+			return mcs_get_egprs_by_num(num);
 	}
 
 	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 = 3; i >= 0; i--) {
+				if (bts->cs_mask & (1 << i)) {
+					num = i + 1;
+					break;
+				}
+			}
+		}
 	} else if (bts->max_cs_dl) {
 		num = bts->max_cs_dl;
-	} else {
-		num = 4;
 	}
 
+	if (!num)
+		num = 4;
+
 	return mcs_get_gprs_by_num(num);
 }
 
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 8a825a1..7e51763 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -551,7 +551,7 @@
 	struct gprs_bssgp_pcu *pcu;
 	int rc = 0;
 	unsigned int trx_nr, ts_nr;
-	int i;
+	unsigned int i;
 
 	if (info_ind->version != PCU_IF_VERSION) {
 		fprintf(stderr, "PCU interface version number of BTS (%u) is "
@@ -613,16 +613,32 @@
 	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;
+
+	bts->cs_mask = 1 << 0; /* We need at least 1 CS, let's enable CS1 */
 	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);
+		uint8_t allowed = !!(info_ind->flags & (PCU_IF_FLAG_CS1 << i));
+		bts->cs_mask |= allowed << i;
+		if (allowed)
+			LOGP(DL1IF, LOGL_DEBUG, " Use CS%d\n",  i + 1);
 	}
+
+	bts->mcs_mask = 0;
 	for (i = 0; i < 9; i++) {
-		if ((info_ind->flags & (PCU_IF_FLAG_MCS1 << i)))
-			LOGP(DL1IF, LOGL_DEBUG, " Use MCS%d\n", i+1);
+		uint8_t allowed = !!(info_ind->flags & (PCU_IF_FLAG_MCS1 << i));
+		bts->mcs_mask |= allowed << i;
+		if (allowed)
+			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 +656,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 +666,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/tests/emu/pcu_emu.cpp b/tests/emu/pcu_emu.cpp
index 41231a3..2b86457 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_mask = 1 << 0; /* CS-1 always enabled by default */
 	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: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-CC: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201104/a5d34e7d/attachment.htm>


More information about the gerrit-log mailing list