Move cs_adj* fields from BTS to PCU

Change-Id: I2b00a83279dccd4feeeeb95e34878c4405e7972c
This commit is contained in:
Pau Espin 2021-01-14 13:17:01 +01:00
parent 97296b299c
commit e8dcf64881
9 changed files with 22 additions and 29 deletions

View File

@ -201,9 +201,6 @@ static void bts_init(struct gprs_rlcmac_bts *bts, BTS* bts_obj)
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;

View File

@ -109,9 +109,6 @@ struct gprs_rlcmac_bts {
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;

View File

@ -755,7 +755,7 @@ static enum CodingScheme max_coding_scheme_dl(struct gprs_rlcmac_bts *bts)
}
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 @@ static enum CodingScheme max_coding_scheme_dl(struct gprs_rlcmac_bts *bts)
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 {

View File

@ -571,12 +571,9 @@ void ms_set_egprs_ms_class(struct GprsMs *ms, uint8_t ms_class_)
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 @@ void ms_update_error_rate(struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf, int er
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 @@ void ms_update_error_rate(struct GprsMs *ms, struct gprs_rlcmac_tbf *tbf, int er
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 @@ enum CodingScheme ms_current_cs_dl(const struct GprsMs *ms)
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 */

View File

@ -55,6 +55,9 @@ struct gprs_pcu *gprs_pcu_alloc(void *ctx)
/* 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);

View File

@ -79,6 +79,9 @@ struct gprs_pcu {
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;

View File

@ -136,9 +136,9 @@ static int config_write_pcu(struct vty *vty)
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 @@ DEFUN_ATTR(cfg_pcu_cs_err_limits,
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 @@ DEFUN_ATTR(cfg_pcu_cs_err_limits,
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 @@ DEFUN_ATTR(cfg_pcu_no_cs_err_limits,
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;
}

View File

@ -1132,7 +1132,7 @@ int gprs_rlcmac_dl_tbf::update_window(unsigned first_bsn,
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 @@ int gprs_rlcmac_dl_tbf::update_window(const uint8_t ssn, const uint8_t *rbb)
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,

View File

@ -511,7 +511,7 @@ static void test_ms_cs_selection()
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);