Change in osmo-pcu[master]: Move cs_adj* fields from BTS to PCU

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
Thu Jan 14 12:24:25 UTC 2021


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


Change subject: Move cs_adj* fields from BTS to PCU
......................................................................

Move cs_adj* fields from BTS to PCU

Change-Id: I2b00a83279dccd4feeeeb95e34878c4405e7972c
---
M src/bts.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_ms.c
M src/gprs_pcu.c
M src/gprs_pcu.h
M src/pcu_vty.c
M src/tbf_dl.cpp
M tests/ms/MsTest.cpp
9 files changed, 22 insertions(+), 29 deletions(-)



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

diff --git a/src/bts.cpp b/src/bts.cpp
index 5eefc36..3795ca2 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -201,9 +201,6 @@
 	bts->n3103 = 4;
 	bts->n3105 = 8;
 	bts->si13_is_set = false;
-	bts->cs_adj_enabled = 1;
-	bts->cs_adj_upper_limit = 33; /* Decrease CS if the error rate is above */
-	bts->cs_adj_lower_limit = 10; /* Increase CS if the error rate is below */
 	/* CS-1 to CS-4 */
 	bts->cs_lqual_ranges[0].low = -256;
 	bts->cs_lqual_ranges[0].high = 6;
diff --git a/src/bts.h b/src/bts.h
index 9626cdc..1f4da4e 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -109,9 +109,6 @@
 	uint8_t si13[GSM_MACBLOCK_LEN];
 	bool si13_is_set;
 
-	uint8_t cs_adj_enabled; /* whether cs_adj_{upper,lower}_limit are used to adjust DL CS */
-	uint8_t cs_adj_upper_limit; /* downgrade DL CS if error rate above its value */
-	uint8_t cs_adj_lower_limit; /* upgrade DL CS if error rate below its value */
 	/* downgrade DL CS when less than specified octets are left in tx queue. Optimization, see paper:
 	  "Theoretical Analysis of GPRS Throughput and Delay" */
 	uint16_t cs_downgrade_threshold;
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index cfaee73..0db6a51 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -755,7 +755,7 @@
 	}
 
 	if (mcs_any) {
-		if (!bts->cs_adj_enabled) {
+		if (!the_pcu->vty.cs_adj_enabled) {
 			if (bts->initial_mcs_dl) {
 				num = bts->initial_mcs_dl;
 			} else {
@@ -771,7 +771,7 @@
 			return mcs_get_egprs_by_num(num);
 	}
 
-	if (!bts->cs_adj_enabled) {
+	if (!the_pcu->vty.cs_adj_enabled) {
 		if (bts->initial_cs_dl) {
 			num = bts->initial_cs_dl;
 		} else {
diff --git a/src/gprs_ms.c b/src/gprs_ms.c
index 6fbb06a..cc64c86 100644
--- a/src/gprs_ms.c
+++ b/src/gprs_ms.c
@@ -571,12 +571,9 @@
 
 void ms_update_error_rate(struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf, int error_rate)
 {
-	struct gprs_rlcmac_bts *bts_;
 	int64_t now;
 	enum CodingScheme max_cs_dl = ms_max_cs_dl(ms);
-
 	OSMO_ASSERT(max_cs_dl);
-	bts_ = bts_data(ms->bts);
 
 	if (error_rate < 0)
 		return;
@@ -588,7 +585,7 @@
 
 	ms->nack_rate_dl = error_rate;
 
-	if (error_rate > bts_->cs_adj_upper_limit) {
+	if (error_rate > the_pcu->vty.cs_adj_upper_limit) {
 		if (mcs_chan_code(ms->current_cs_dl) > 0) {
 			mcs_dec_kind(&ms->current_cs_dl, ms_mode(ms));
 			LOGP(DRLCMACDL, LOGL_INFO,
@@ -597,7 +594,7 @@
 				ms_imsi(ms), error_rate, mcs_name(ms->current_cs_dl));
 			ms->last_cs_not_low = now;
 		}
-	} else if (error_rate < bts_->cs_adj_lower_limit) {
+	} else if (error_rate < the_pcu->vty.cs_adj_lower_limit) {
 		if (ms->current_cs_dl < max_cs_dl) {
 		       if (now - ms->last_cs_not_low > 1000) {
 			       mcs_inc_kind(&ms->current_cs_dl, ms_mode(ms));
@@ -801,7 +798,7 @@
 		return cs;
 
 	/* RF conditions are good, don't reduce */
-	if (ms->nack_rate_dl < bts_data(ms->bts)->cs_adj_lower_limit)
+	if (ms->nack_rate_dl < the_pcu->vty.cs_adj_lower_limit)
 		return cs;
 
 	/* The throughput would probably be better if the CS level was reduced */
diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c
index 2a84f7b..d7a851b 100644
--- a/src/gprs_pcu.c
+++ b/src/gprs_pcu.c
@@ -55,6 +55,9 @@
 	/* By default resegmentation is supported in DL can also be configured
 	 * through VTY */
 	pcu->vty.dl_arq_type = EGPRS_ARQ1;
+	pcu->vty.cs_adj_enabled = true;
+	pcu->vty.cs_adj_upper_limit = 33; /* Decrease CS if the error rate is above */
+	pcu->vty.cs_adj_lower_limit = 10; /* Increase CS if the error rate is below */
 
 	pcu->T_defs = T_defs_pcu;
 	osmo_tdefs_reset(pcu->T_defs);
diff --git a/src/gprs_pcu.h b/src/gprs_pcu.h
index f07510b..6c9eae1 100644
--- a/src/gprs_pcu.h
+++ b/src/gprs_pcu.h
@@ -79,6 +79,9 @@
 		uint8_t alpha, gamma;
 		bool dl_tbf_preemptive_retransmission;
 		enum egprs_arq_type dl_arq_type; /* EGPRS_ARQ1 to support resegmentation in DL, EGPRS_ARQ2 for no reseg */
+		bool cs_adj_enabled; /* whether cs_adj_{upper,lower}_limit are used to adjust DL CS */
+		uint8_t cs_adj_upper_limit; /* downgrade DL CS if error rate above its value */
+		uint8_t cs_adj_lower_limit; /* upgrade DL CS if error rate below its value */
 	} vty;
 
 	struct gsmtap_inst *gsmtap;
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index ef86879..c830400 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -136,9 +136,9 @@
 			vty_out(vty, " cs max %d %d%s", the_pcu->vty.max_cs_dl,
 				the_pcu->vty.max_cs_ul, VTY_NEWLINE);
 	}
-	if (bts->cs_adj_enabled)
+	if (the_pcu->vty.cs_adj_enabled)
 		vty_out(vty, " cs threshold %d %d%s",
-			bts->cs_adj_lower_limit, bts->cs_adj_upper_limit,
+			the_pcu->vty.cs_adj_lower_limit, the_pcu->vty.cs_adj_upper_limit,
 			VTY_NEWLINE);
 	else
 		vty_out(vty, " no cs threshold%s", VTY_NEWLINE);
@@ -910,8 +910,6 @@
 	   CS_STR CS_ERR_LIMITS_STR "lower limit in %\n" "upper limit in %\n",
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
 	uint8_t lower_limit = atoi(argv[0]);
 	uint8_t upper_limit = atoi(argv[1]);
 
@@ -922,9 +920,9 @@
 		return CMD_WARNING;
 	}
 
-	bts->cs_adj_enabled = 1;
-	bts->cs_adj_upper_limit = upper_limit;
-	bts->cs_adj_lower_limit = lower_limit;
+	the_pcu->vty.cs_adj_enabled = true;
+	the_pcu->vty.cs_adj_upper_limit = upper_limit;
+	the_pcu->vty.cs_adj_lower_limit = lower_limit;
 
 	return CMD_SUCCESS;
 }
@@ -935,11 +933,9 @@
 	   NO_STR CS_STR CS_ERR_LIMITS_STR,
 	   CMD_ATTR_IMMEDIATE)
 {
-	struct gprs_rlcmac_bts *bts = bts_main_data();
-
-	bts->cs_adj_enabled = 0;
-	bts->cs_adj_upper_limit = 100;
-	bts->cs_adj_lower_limit = 0;
+	the_pcu->vty.cs_adj_enabled = false;
+	the_pcu->vty.cs_adj_upper_limit = 100;
+	the_pcu->vty.cs_adj_lower_limit = 0;
 
 	return CMD_SUCCESS;
 }
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 5ff5b16..2a48648 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -1132,7 +1132,7 @@
 
 	error_rate = analyse_errors(show_rbb, behind_last_bsn, &ana_res);
 
-	if (bts_data()->cs_adj_enabled && ms())
+	if (the_pcu->vty.cs_adj_enabled && ms())
 		ms_update_error_rate(ms(), this, error_rate);
 
 	m_window.update(bts, rbb, first_bsn, &lost, &received);
@@ -1187,7 +1187,7 @@
 
 	error_rate = analyse_errors(show_rbb, ssn, &ana_res);
 
-	if (bts_data()->cs_adj_enabled && ms())
+	if (the_pcu->vty.cs_adj_enabled && ms())
 		ms_update_error_rate(ms(), this, error_rate);
 
 	m_window.update(bts, show_rbb, ssn,
diff --git a/tests/ms/MsTest.cpp b/tests/ms/MsTest.cpp
index 1e810f2..b914f01 100644
--- a/tests/ms/MsTest.cpp
+++ b/tests/ms/MsTest.cpp
@@ -511,7 +511,7 @@
 	bts->initial_cs_dl = 4;
 	bts->initial_cs_ul = 1;
 	bts->cs_downgrade_threshold = 0;
-	bts->cs_adj_lower_limit = 0;
+	the_pcu->vty.cs_adj_lower_limit = 0;
 
 	ms = ms_alloc(&the_bts, tlli);
 

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I2b00a83279dccd4feeeeb95e34878c4405e7972c
Gerrit-Change-Number: 22184
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/20210114/620c747d/attachment.htm>


More information about the gerrit-log mailing list