Move (m)cs_lqual_ranges fields from BTS to PCU
Change-Id: I39e2fc7e229851610d797c594d84902af6079411
diff --git a/src/bts.cpp b/src/bts.cpp
index 32ec71e..c2b8696 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -201,37 +201,6 @@
bts->n3103 = 4;
bts->n3105 = 8;
bts->si13_is_set = false;
- /* CS-1 to CS-4 */
- bts->cs_lqual_ranges[0].low = -256;
- bts->cs_lqual_ranges[0].high = 6;
- bts->cs_lqual_ranges[1].low = 5;
- bts->cs_lqual_ranges[1].high = 8;
- bts->cs_lqual_ranges[2].low = 7;
- bts->cs_lqual_ranges[2].high = 13;
- bts->cs_lqual_ranges[3].low = 12;
- bts->cs_lqual_ranges[3].high = 256;
-
- /* MCS-1 to MCS-9 */
- /* Default thresholds are referenced from literature */
- /* Fig. 2.3, Chapter 2, Optimizing Wireless Communication Systems, Springer (2009) */
- bts->mcs_lqual_ranges[0].low = -256;
- bts->mcs_lqual_ranges[0].high = 6;
- bts->mcs_lqual_ranges[1].low = 5;
- bts->mcs_lqual_ranges[1].high = 8;
- bts->mcs_lqual_ranges[2].low = 7;
- bts->mcs_lqual_ranges[2].high = 13;
- bts->mcs_lqual_ranges[3].low = 12;
- bts->mcs_lqual_ranges[3].high = 15;
- bts->mcs_lqual_ranges[4].low = 14;
- bts->mcs_lqual_ranges[4].high = 17;
- bts->mcs_lqual_ranges[5].low = 16;
- bts->mcs_lqual_ranges[5].high = 18;
- bts->mcs_lqual_ranges[6].low = 17;
- bts->mcs_lqual_ranges[6].high = 20;
- bts->mcs_lqual_ranges[7].low = 19;
- bts->mcs_lqual_ranges[7].high = 24;
- bts->mcs_lqual_ranges[8].low = 23;
- bts->mcs_lqual_ranges[8].high = 256;
bts->ns_dialect = NS2_DIALECT_IPACCESS;
/* TODO: increase them when CRBB decoding is implemented */
diff --git a/src/bts.h b/src/bts.h
index afad02c..040386e 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -108,9 +108,6 @@
uint8_t si13[GSM_MACBLOCK_LEN];
bool si13_is_set;
- /* Link quality range for each UL (M)CS. Below or above, next/prev (M)CS is selected. */
- struct {int16_t low; int16_t high; } cs_lqual_ranges[MAX_GPRS_CS];
- struct {int16_t low; int16_t high; } mcs_lqual_ranges[MAX_EDGE_MCS];
uint16_t ws_base;
uint16_t ws_pdch; /* increase WS by this value per PDCH */
diff --git a/src/gprs_ms.c b/src/gprs_ms.c
index c0fb55e..291f0e8 100644
--- a/src/gprs_ms.c
+++ b/src/gprs_ms.c
@@ -673,7 +673,6 @@
void ms_update_cs_ul(struct GprsMs *ms, const struct pcu_l1_meas *meas)
{
- struct gprs_rlcmac_bts *bts_;
enum CodingScheme max_cs_ul = ms_max_cs_ul(ms);
int old_link_qual;
@@ -682,8 +681,6 @@
enum CodingScheme new_cs_ul = ms->current_cs_ul;
uint8_t current_cs = mcs_chan_code(ms->current_cs_ul);
- bts_ = bts_data(ms->bts);
-
if (!max_cs_ul) {
LOGP(DRLCMACMEAS, LOGL_ERROR,
"max_cs_ul cannot be derived (current UL CS: %s)\n",
@@ -708,13 +705,13 @@
if (mcs_is_gprs(ms->current_cs_ul)) {
if (current_cs >= MAX_GPRS_CS)
current_cs = MAX_GPRS_CS - 1;
- low = bts_->cs_lqual_ranges[current_cs].low;
- high = bts_->cs_lqual_ranges[current_cs].high;
+ low = the_pcu->vty.cs_lqual_ranges[current_cs].low;
+ high = the_pcu->vty.cs_lqual_ranges[current_cs].high;
} else if (mcs_is_edge(ms->current_cs_ul)) {
if (current_cs >= MAX_EDGE_MCS)
current_cs = MAX_EDGE_MCS - 1;
- low = bts_->mcs_lqual_ranges[current_cs].low;
- high = bts_->mcs_lqual_ranges[current_cs].high;
+ low = the_pcu->vty.mcs_lqual_ranges[current_cs].low;
+ high = the_pcu->vty.mcs_lqual_ranges[current_cs].high;
} else {
LOGP(DRLCMACMEAS, LOGL_ERROR,
"Unable to update UL (M)CS because it's neither GPRS nor EDGE: %s\n",
diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c
index ba48c38..cfe8896 100644
--- a/src/gprs_pcu.c
+++ b/src/gprs_pcu.c
@@ -59,6 +59,36 @@
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->vty.cs_downgrade_threshold = 200;
+ /* CS-1 to CS-4 */
+ pcu->vty.cs_lqual_ranges[0].low = -256;
+ pcu->vty.cs_lqual_ranges[0].high = 6;
+ pcu->vty.cs_lqual_ranges[1].low = 5;
+ pcu->vty.cs_lqual_ranges[1].high = 8;
+ pcu->vty.cs_lqual_ranges[2].low = 7;
+ pcu->vty.cs_lqual_ranges[2].high = 13;
+ pcu->vty.cs_lqual_ranges[3].low = 12;
+ pcu->vty.cs_lqual_ranges[3].high = 256;
+ /* MCS-1 to MCS-9 */
+ /* Default thresholds are referenced from literature */
+ /* Fig. 2.3, Chapter 2, Optimizing Wireless Communication Systems, Springer (2009) */
+ pcu->vty.mcs_lqual_ranges[0].low = -256;
+ pcu->vty.mcs_lqual_ranges[0].high = 6;
+ pcu->vty.mcs_lqual_ranges[1].low = 5;
+ pcu->vty.mcs_lqual_ranges[1].high = 8;
+ pcu->vty.mcs_lqual_ranges[2].low = 7;
+ pcu->vty.mcs_lqual_ranges[2].high = 13;
+ pcu->vty.mcs_lqual_ranges[3].low = 12;
+ pcu->vty.mcs_lqual_ranges[3].high = 15;
+ pcu->vty.mcs_lqual_ranges[4].low = 14;
+ pcu->vty.mcs_lqual_ranges[4].high = 17;
+ pcu->vty.mcs_lqual_ranges[5].low = 16;
+ pcu->vty.mcs_lqual_ranges[5].high = 18;
+ pcu->vty.mcs_lqual_ranges[6].low = 17;
+ pcu->vty.mcs_lqual_ranges[6].high = 20;
+ pcu->vty.mcs_lqual_ranges[7].low = 19;
+ pcu->vty.mcs_lqual_ranges[7].high = 24;
+ pcu->vty.mcs_lqual_ranges[8].low = 23;
+ pcu->vty.mcs_lqual_ranges[8].high = 256;
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 146b8b8..916169e 100644
--- a/src/gprs_pcu.h
+++ b/src/gprs_pcu.h
@@ -85,6 +85,9 @@
/* 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;
+ /* Link quality range for each UL (M)CS. Below or above, next/prev (M)CS is selected. */
+ struct {int16_t low; int16_t high; } cs_lqual_ranges[MAX_GPRS_CS];
+ struct {int16_t low; int16_t high; } mcs_lqual_ranges[MAX_EDGE_MCS];
} vty;
struct gsmtap_inst *gsmtap;
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index e0edf91..3abfba7 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -150,31 +150,31 @@
vty_out(vty, " no cs downgrade-threshold%s", VTY_NEWLINE);
vty_out(vty, " cs link-quality-ranges cs1 %d cs2 %d %d cs3 %d %d cs4 %d%s",
- bts->cs_lqual_ranges[0].high,
- bts->cs_lqual_ranges[1].low,
- bts->cs_lqual_ranges[1].high,
- bts->cs_lqual_ranges[2].low,
- bts->cs_lqual_ranges[2].high,
- bts->cs_lqual_ranges[3].low,
+ the_pcu->vty.cs_lqual_ranges[0].high,
+ the_pcu->vty.cs_lqual_ranges[1].low,
+ the_pcu->vty.cs_lqual_ranges[1].high,
+ the_pcu->vty.cs_lqual_ranges[2].low,
+ the_pcu->vty.cs_lqual_ranges[2].high,
+ the_pcu->vty.cs_lqual_ranges[3].low,
VTY_NEWLINE);
vty_out(vty, " mcs link-quality-ranges mcs1 %d mcs2 %d %d mcs3 %d %d mcs4 %d %d mcs5 %d %d mcs6 %d %d mcs7 %d %d mcs8 %d %d mcs9 %d%s",
- bts->mcs_lqual_ranges[0].high,
- bts->mcs_lqual_ranges[1].low,
- bts->mcs_lqual_ranges[1].high,
- bts->mcs_lqual_ranges[2].low,
- bts->mcs_lqual_ranges[2].high,
- bts->mcs_lqual_ranges[3].low,
- bts->mcs_lqual_ranges[3].high,
- bts->mcs_lqual_ranges[4].low,
- bts->mcs_lqual_ranges[4].high,
- bts->mcs_lqual_ranges[5].low,
- bts->mcs_lqual_ranges[5].high,
- bts->mcs_lqual_ranges[6].low,
- bts->mcs_lqual_ranges[6].high,
- bts->mcs_lqual_ranges[7].low,
- bts->mcs_lqual_ranges[7].high,
- bts->mcs_lqual_ranges[8].low,
+ the_pcu->vty.mcs_lqual_ranges[0].high,
+ the_pcu->vty.mcs_lqual_ranges[1].low,
+ the_pcu->vty.mcs_lqual_ranges[1].high,
+ the_pcu->vty.mcs_lqual_ranges[2].low,
+ the_pcu->vty.mcs_lqual_ranges[2].high,
+ the_pcu->vty.mcs_lqual_ranges[3].low,
+ the_pcu->vty.mcs_lqual_ranges[3].high,
+ the_pcu->vty.mcs_lqual_ranges[4].low,
+ the_pcu->vty.mcs_lqual_ranges[4].high,
+ the_pcu->vty.mcs_lqual_ranges[5].low,
+ the_pcu->vty.mcs_lqual_ranges[5].high,
+ the_pcu->vty.mcs_lqual_ranges[6].low,
+ the_pcu->vty.mcs_lqual_ranges[6].high,
+ the_pcu->vty.mcs_lqual_ranges[7].low,
+ the_pcu->vty.mcs_lqual_ranges[7].high,
+ the_pcu->vty.mcs_lqual_ranges[8].low,
VTY_NEWLINE);
if (the_pcu->vty.force_initial_mcs) {
@@ -977,8 +977,6 @@
"CS-4 low (dB)\n",
CMD_ATTR_IMMEDIATE)
{
- struct gprs_rlcmac_bts *bts = bts_main_data();
-
uint8_t cs1_high = atoi(argv[0]);
uint8_t cs2_low = atoi(argv[1]);
uint8_t cs2_high = atoi(argv[2]);
@@ -986,12 +984,12 @@
uint8_t cs3_high = atoi(argv[4]);
uint8_t cs4_low = atoi(argv[5]);
- bts->cs_lqual_ranges[0].high = cs1_high;
- bts->cs_lqual_ranges[1].low = cs2_low;
- bts->cs_lqual_ranges[1].high = cs2_high;
- bts->cs_lqual_ranges[2].low = cs3_low;
- bts->cs_lqual_ranges[2].high = cs3_high;
- bts->cs_lqual_ranges[3].low = cs4_low;
+ the_pcu->vty.cs_lqual_ranges[0].high = cs1_high;
+ the_pcu->vty.cs_lqual_ranges[1].low = cs2_low;
+ the_pcu->vty.cs_lqual_ranges[1].high = cs2_high;
+ the_pcu->vty.cs_lqual_ranges[2].low = cs3_low;
+ the_pcu->vty.cs_lqual_ranges[2].high = cs3_high;
+ the_pcu->vty.cs_lqual_ranges[3].low = cs4_low;
return CMD_SUCCESS;
}
@@ -1027,24 +1025,22 @@
"MCS-9 low (dB)\n",
CMD_ATTR_IMMEDIATE)
{
- struct gprs_rlcmac_bts *bts = bts_main_data();
-
- bts->mcs_lqual_ranges[0].high = atoi(argv[0]);
- bts->mcs_lqual_ranges[1].low = atoi(argv[1]);
- bts->mcs_lqual_ranges[1].high = atoi(argv[2]);
- bts->mcs_lqual_ranges[2].low = atoi(argv[3]);
- bts->mcs_lqual_ranges[2].high = atoi(argv[4]);
- bts->mcs_lqual_ranges[3].low = atoi(argv[5]);
- bts->mcs_lqual_ranges[3].high = atoi(argv[6]);
- bts->mcs_lqual_ranges[4].low = atoi(argv[7]);
- bts->mcs_lqual_ranges[4].high = atoi(argv[8]);
- bts->mcs_lqual_ranges[5].low = atoi(argv[9]);
- bts->mcs_lqual_ranges[5].high = atoi(argv[10]);
- bts->mcs_lqual_ranges[6].low = atoi(argv[11]);
- bts->mcs_lqual_ranges[6].high = atoi(argv[12]);
- bts->mcs_lqual_ranges[7].low = atoi(argv[13]);
- bts->mcs_lqual_ranges[7].high = atoi(argv[14]);
- bts->mcs_lqual_ranges[8].low = atoi(argv[15]);
+ the_pcu->vty.mcs_lqual_ranges[0].high = atoi(argv[0]);
+ the_pcu->vty.mcs_lqual_ranges[1].low = atoi(argv[1]);
+ the_pcu->vty.mcs_lqual_ranges[1].high = atoi(argv[2]);
+ the_pcu->vty.mcs_lqual_ranges[2].low = atoi(argv[3]);
+ the_pcu->vty.mcs_lqual_ranges[2].high = atoi(argv[4]);
+ the_pcu->vty.mcs_lqual_ranges[3].low = atoi(argv[5]);
+ the_pcu->vty.mcs_lqual_ranges[3].high = atoi(argv[6]);
+ the_pcu->vty.mcs_lqual_ranges[4].low = atoi(argv[7]);
+ the_pcu->vty.mcs_lqual_ranges[4].high = atoi(argv[8]);
+ the_pcu->vty.mcs_lqual_ranges[5].low = atoi(argv[9]);
+ the_pcu->vty.mcs_lqual_ranges[5].high = atoi(argv[10]);
+ the_pcu->vty.mcs_lqual_ranges[6].low = atoi(argv[11]);
+ the_pcu->vty.mcs_lqual_ranges[6].high = atoi(argv[12]);
+ the_pcu->vty.mcs_lqual_ranges[7].low = atoi(argv[13]);
+ the_pcu->vty.mcs_lqual_ranges[7].high = atoi(argv[14]);
+ the_pcu->vty.mcs_lqual_ranges[8].low = atoi(argv[15]);
return CMD_SUCCESS;
}