From 519d071131ca1235d5ba525040dab4cbe357fa92 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 14 Jan 2021 14:30:03 +0100 Subject: [PATCH] Move ws_* fields from BTS to PCU Change-Id: I997bc52f0d924c8f2a0b1d6cf23af98828ad4258 --- src/bts.cpp | 4 ---- src/bts.h | 2 -- src/gprs_pcu.c | 3 +++ src/gprs_pcu.h | 2 ++ src/pcu_vty.c | 7 +++---- src/tbf.cpp | 2 +- src/tbf_dl.cpp | 2 +- src/tbf_ul.cpp | 2 +- tests/tbf/TbfTest.cpp | 18 ++++++++---------- 9 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/bts.cpp b/src/bts.cpp index 9f987ff3..450c04e8 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -201,10 +201,6 @@ static void bts_init(struct gprs_rlcmac_bts *bts, BTS* bts_obj) bts->n3105 = 8; bts->si13_is_set = false; - /* 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; diff --git a/src/bts.h b/src/bts.h index db5f3e86..635c3c7c 100644 --- a/src/bts.h +++ b/src/bts.h @@ -102,8 +102,6 @@ struct gprs_rlcmac_bts { uint8_t si13[GSM_MACBLOCK_LEN]; bool si13_is_set; - uint16_t ws_base; - uint16_t ws_pdch; /* increase WS by this value per PDCH */ /* State for dynamic algorithm selection */ int multislot_disabled; diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c index 209fca62..18c55686 100644 --- a/src/gprs_pcu.c +++ b/src/gprs_pcu.c @@ -91,6 +91,9 @@ struct gprs_pcu *gprs_pcu_alloc(void *ctx) pcu->vty.mcs_lqual_ranges[8].low = 23; pcu->vty.mcs_lqual_ranges[8].high = 256; pcu->vty.ns_dialect = NS2_DIALECT_IPACCESS; + /* TODO: increase them when CRBB decoding is implemented */ + pcu->vty.ws_base = 64; + pcu->vty.ws_pdch = 0; 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 87c8cdfc..b4e7c133 100644 --- a/src/gprs_pcu.h +++ b/src/gprs_pcu.h @@ -95,6 +95,8 @@ struct gprs_pcu { 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]; enum gprs_ns2_dialect ns_dialect; /* Are we talking Gb with IP-SNS (true) or classic Gb? */ + uint16_t ws_base; + uint16_t ws_pdch; /* increase WS by this value per PDCH */ } vty; struct gsmtap_inst *gsmtap; diff --git a/src/pcu_vty.c b/src/pcu_vty.c index d1075487..5e9da45d 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -195,7 +195,7 @@ static int config_write_pcu(struct vty *vty) the_pcu->vty.max_mcs_ul, VTY_NEWLINE); } - vty_out(vty, " window-size %d %d%s", bts->ws_base, bts->ws_pdch, + vty_out(vty, " window-size %d %d%s", the_pcu->vty.ws_base, the_pcu->vty.ws_pdch, VTY_NEWLINE); if (the_pcu->vty.dl_arq_type == EGPRS_ARQ2) @@ -557,13 +557,12 @@ DEFUN_USRATTR(cfg_pcu_window_size, "Base value (b)\n" "Factor for number of PDCH (f)") { - struct gprs_rlcmac_bts *bts = bts_main_data(); uint16_t b = atoi(argv[0]); - bts->ws_base = b; + the_pcu->vty.ws_base = b; if (argc > 1) { uint16_t f = atoi(argv[1]); - bts->ws_pdch = f; + the_pcu->vty.ws_pdch = f; } return CMD_SUCCESS; diff --git a/src/tbf.cpp b/src/tbf.cpp index eb043e5b..43c8cbfd 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -321,7 +321,7 @@ uint16_t egprs_window_size(const struct gprs_rlcmac_bts *bts_data, uint8_t slots uint8_t num_pdch = pcu_bitcount(slots); return OSMO_MIN((num_pdch != 1) ? (128 * num_pdch) : 192, - OSMO_MAX(64, (bts_data->ws_base + num_pdch * bts_data->ws_pdch) / 32 * 32)); + OSMO_MAX(64, (the_pcu->vty.ws_base + num_pdch * the_pcu->vty.ws_pdch) / 32 * 32)); } int gprs_rlcmac_tbf::update() diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 024a5f3e..653db14b 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -1494,7 +1494,7 @@ void gprs_rlcmac_dl_tbf::set_window_size() uint16_t ws = egprs_window_size(b, dl_slots()); LOGPTBFDL(this, LOGL_INFO, "setting EGPRS DL window size to %u, base(%u) slots(%u) ws_pdch(%u)\n", - ws, b->ws_base, pcu_bitcount(dl_slots()), b->ws_pdch); + ws, bts->pcu->vty.ws_base, pcu_bitcount(dl_slots()), bts->pcu->vty.ws_pdch); m_window.set_ws(ws); } diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index f8c860c9..1f3cb015 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -764,7 +764,7 @@ void gprs_rlcmac_ul_tbf::set_window_size() const struct gprs_rlcmac_bts *b = bts->bts_data(); uint16_t ws = egprs_window_size(b, ul_slots()); LOGPTBFUL(this, LOGL_INFO, "setting EGPRS UL window size to %u, base(%u) slots(%u) ws_pdch(%u)\n", - ws, b->ws_base, pcu_bitcount(ul_slots()), b->ws_pdch); + ws, bts->pcu->vty.ws_base, pcu_bitcount(ul_slots()), bts->pcu->vty.ws_pdch); m_window.set_ws(ws); } diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 66e344e1..1b852015 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -1749,7 +1749,6 @@ static void test_tbf_egprs_two_phase_puan(void) uint32_t tlli = 0xf1223344; const char *imsi = "0011223344"; uint8_t ms_class = 1; - gprs_rlcmac_bts *bts; uint8_t egprs_ms_class = 1; gprs_rlcmac_ul_tbf *ul_tbf; uint8_t test_data[256]; @@ -1760,9 +1759,8 @@ static void test_tbf_egprs_two_phase_puan(void) setup_bts(the_bts, ts_no, 4); the_bts->bts_data()->initial_mcs_dl = 9; - bts = the_bts->bts_data(); - bts->ws_base = 128; - bts->ws_pdch = 64; + the_pcu->vty.ws_base = 128; + the_pcu->vty.ws_pdch = 64; ul_tbf = establish_ul_tbf(the_bts, ts_no, tlli, &fn, qta, ms_class, egprs_ms_class); /* Function to generate URBB with no length */ @@ -1782,8 +1780,8 @@ static void test_tbf_egprs_two_phase_puan(void) static_cast(ul_tbf->window())->reset_state(); /* Function to generate CRBB */ - bts->ws_base = 128; - bts->ws_pdch = 64; + the_pcu->vty.ws_base = 128; + the_pcu->vty.ws_pdch = 64; ul_tbf = establish_ul_tbf_two_phase_puan_CRBB(the_bts, ts_no, tlli, &fn, qta, ms_class, egprs_ms_class); @@ -2288,8 +2286,8 @@ static void test_tbf_ws() setup_bts(the_bts, ts_no); - bts->ws_base = 128; - bts->ws_pdch = 64; + the_pcu->vty.ws_base = 128; + the_pcu->vty.ws_pdch = 64; the_pcu->alloc_algorithm = alloc_algorithm_b; bts->trx[0].pdch[2].enable(); bts->trx[0].pdch[3].enable(); @@ -2336,8 +2334,8 @@ static void test_tbf_update_ws(void) setup_bts(the_bts, ts_no); - bts->ws_base = 128; - bts->ws_pdch = 64; + the_pcu->vty.ws_base = 128; + the_pcu->vty.ws_pdch = 64; the_pcu->alloc_algorithm = alloc_algorithm_b; bts->trx[0].pdch[2].enable(); bts->trx[0].pdch[3].enable();