Move BTS initial values inside bts.cpp

This way everytime any program or test initiates a BTS object, the
bts_data structure has the same values.

Change-Id: Iffd6eecb1f08bda0091f45e2ef7c9c63b42e10b3
This commit is contained in:
Pau Espin 2020-11-02 14:36:22 +01:00 committed by laforge
parent a2848546d2
commit 46fd7a0316
7 changed files with 148 additions and 340 deletions

View File

@ -204,6 +204,94 @@ static const struct osmo_stat_item_group_desc bts_statg_desc = {
bts_stat_item_description,
};
static void bts_init(struct gprs_rlcmac_bts *bts, BTS* bts_obj)
{
memset(bts, 0, sizeof(*bts));
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->n3101 = 10;
bts->n3103 = 4;
bts->n3105 = 8;
bts->alpha = 0; /* a = 0.0 */
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 */
bts->max_cs_ul = MAX_GPRS_CS;
bts->max_cs_dl = MAX_GPRS_CS;
bts->max_mcs_ul = MAX_EDGE_MCS;
bts->max_mcs_dl = MAX_EDGE_MCS;
/* 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->cs_downgrade_threshold = 200;
/* TODO: increase them when CRBB decoding is implemented */
bts->ws_base = 64;
bts->ws_pdch = 0;
bts->llc_codel_interval_msec = LLC_CODEL_USE_DEFAULT;
bts->llc_idle_ack_csec = 10;
/*
* By default resegmentation is supported in DL
* can also be configured through VTY
*/
bts->dl_arq_type = EGPRS_ARQ1;
bts->app_info = NULL;
bts->bts = bts_obj;
bts->dl_tbf_preemptive_retransmission = true;
bts->T_defs_bts = T_defs_bts;
bts->T_defs_pcu = T_defs_pcu;
osmo_tdefs_reset(bts->T_defs_bts);
osmo_tdefs_reset(bts->T_defs_pcu);
/* initialize back pointers */
for (size_t trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); ++trx_no) {
struct gprs_rlcmac_trx *trx = &bts->trx[trx_no];
trx->trx_no = trx_no;
trx->bts = bts_obj;
for (size_t ts_no = 0; ts_no < ARRAY_SIZE(trx->pdch); ++ts_no) {
struct gprs_rlcmac_pdch *pdch = &trx->pdch[ts_no];
pdch->init_ptcch_msg();
pdch->ts_no = ts_no;
pdch->trx = trx;
}
}
}
BTS* BTS::main_bts()
{
return &s_bts;
@ -236,28 +324,7 @@ BTS::BTS()
, m_sba(*this)
, m_ms_store(this)
{
memset(&m_bts, 0, sizeof(m_bts));
m_bts.bts = this;
m_bts.app_info = NULL;
m_bts.dl_tbf_preemptive_retransmission = true;
m_bts.T_defs_bts = T_defs_bts;
m_bts.T_defs_pcu = T_defs_pcu;
osmo_tdefs_reset(m_bts.T_defs_bts);
osmo_tdefs_reset(m_bts.T_defs_pcu);
/* initialize back pointers */
for (size_t trx_no = 0; trx_no < ARRAY_SIZE(m_bts.trx); ++trx_no) {
struct gprs_rlcmac_trx *trx = &m_bts.trx[trx_no];
trx->trx_no = trx_no;
trx->bts = this;
for (size_t ts_no = 0; ts_no < ARRAY_SIZE(trx->pdch); ++ts_no) {
struct gprs_rlcmac_pdch *pdch = &trx->pdch[ts_no];
pdch->init_ptcch_msg();
pdch->ts_no = ts_no;
pdch->trx = trx;
}
}
bts_init(&m_bts, this);
/* The static allocator might have already registered the counter group.
If this happens and we still called explicitly (in tests/ for example)

View File

@ -228,67 +228,6 @@ int main(int argc, char *argv[])
}
bts = bts_main_data();
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->n3101 = 10;
bts->n3103 = 4;
bts->n3105 = 8;
bts->alpha = 0; /* a = 0.0 */
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 */
bts->max_cs_ul = MAX_GPRS_CS;
bts->max_cs_dl = MAX_GPRS_CS;
bts->max_mcs_ul = MAX_EDGE_MCS;
bts->max_mcs_dl = MAX_EDGE_MCS;
/* 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->cs_downgrade_threshold = 200;
/* TODO: increase them when CRBB decoding is implemented */
bts->ws_base = 64;
bts->ws_pdch = 0;
bts->llc_codel_interval_msec = LLC_CODEL_USE_DEFAULT;
bts->llc_idle_ack_csec = 10;
/*
* By default resegmentation is supported in DL
* can also be configured through VTY
*/
bts->dl_arq_type = EGPRS_ARQ1;
bts->pcu_sock_path = talloc_strdup(tall_pcu_ctx, PCU_SOCK_DEFAULT);

View File

@ -517,6 +517,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;
ms = new GprsMs(&the_bts, tlli);

View File

@ -19,15 +19,15 @@
=== start test_ms_cs_selection ===
=== end test_ms_cs_selection ===
=== start test_ms_mcs_mode ===
1: no BTS defaults MS DL UNKNOWN/UNKNOWN, UL UNKNOWN/UNKNOWN, mode GPRS, <IDLE>
1: no BTS defaults MS DL CS-1/CS-4, UL CS-1/CS-4, mode GPRS, <IDLE>
2: with BTS defaults MS DL CS-4/CS-4, UL CS-1/CS-4, mode GPRS, <IDLE>
2: after TBF attach MS DL CS-4/CS-4, UL CS-1/CS-4, mode GPRS, <ACTIVE>
1: after mode set MS DL UNKNOWN/UNKNOWN, UL UNKNOWN/UNKNOWN, mode EGPRS, <IDLE>
2: after mode set MS DL UNKNOWN/UNKNOWN, UL UNKNOWN/UNKNOWN, mode EGPRS, <ACTIVE>
1: after MCS set MS DL MCS-7/MCS-4, UL UNKNOWN/UNKNOWN, mode EGPRS, <IDLE>
2: after MCS set MS DL MCS-8/MCS-4, UL UNKNOWN/UNKNOWN, mode EGPRS, <ACTIVE>
1: after mode set MS DL MCS-7/MCS-4, UL UNKNOWN/UNKNOWN, mode EGPRS_GMSK-only, <IDLE>
2: after mode set MS DL MCS-8/MCS-4, UL UNKNOWN/UNKNOWN, mode EGPRS_GMSK-only, <ACTIVE>
1: after mode set MS DL MCS-1/MCS-9, UL MCS-1/MCS-9, mode EGPRS, <IDLE>
2: after mode set MS DL MCS-1/MCS-9, UL MCS-1/MCS-9, mode EGPRS, <ACTIVE>
1: after MCS set MS DL MCS-7/MCS-9, UL MCS-1/MCS-9, mode EGPRS, <IDLE>
2: after MCS set MS DL MCS-8/MCS-9, UL MCS-1/MCS-9, mode EGPRS, <ACTIVE>
1: after mode set MS DL MCS-7/MCS-9, UL MCS-1/MCS-9, mode EGPRS_GMSK-only, <IDLE>
2: after mode set MS DL MCS-8/MCS-9, UL MCS-1/MCS-9, mode EGPRS_GMSK-only, <ACTIVE>
1: after mode set MS DL CS-4/CS-4, UL CS-1/CS-4, mode GPRS, <IDLE>
2: after mode set MS DL CS-4/CS-4, UL CS-1/CS-4, mode GPRS, <ACTIVE>
=== end test_ms_mcs_mode ===

View File

@ -769,7 +769,7 @@ static gprs_rlcmac_ul_tbf *puan_urbb_len_issue(BTS *the_bts,
struct msgb *msg1 = ul_tbf->create_ul_ack(*fn, ts_no);
static uint8_t exp1[] = { 0x40, 0x24, 0x01, 0x03, 0x3e, 0x24, 0x46, 0x68, 0x90, 0x87, 0xb0, 0x06,
static uint8_t exp1[] = { 0x40, 0x24, 0x01, 0x0b, 0x3e, 0x24, 0x46, 0x68, 0x90, 0x87, 0xb0, 0x06,
0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b
};
@ -796,7 +796,7 @@ static gprs_rlcmac_ul_tbf *puan_urbb_len_issue(BTS *the_bts,
msg1 = ul_tbf->create_ul_ack(*fn, ts_no);
static uint8_t exp2[] = { 0x40, 0x24, 0x01, 0x03, 0x3e, 0x24, 0x46, 0x68, 0x90, 0x88, 0xb0, 0x06, 0x8b,
static uint8_t exp2[] = { 0x40, 0x24, 0x01, 0x0b, 0x3e, 0x24, 0x46, 0x68, 0x90, 0x88, 0xb0, 0x06, 0x8b,
0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b
};

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ Allocating UL TBF: MS_CLASS=1/1
TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL EGPRS) Enabled EGPRS, mode EGPRS
TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL EGPRS) Setting Control TS 4
TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL EGPRS) Allocated: trx = 0, ul_slots = 10, dl_slots = 00
TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL EGPRS) setting EGPRS UL window size to 64, base(0) slots(1) ws_pdch(0)
TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL EGPRS) setting EGPRS UL window size to 64, base(64) slots(1) ws_pdch(0)
************** Test with empty window
************** Test with 1 lost packet
************** Test with compressed window