From 97296b299cab6ac9e66082bb4c65da7422f0db12 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 14 Jan 2021 13:08:02 +0100 Subject: [PATCH] Move dl_arq_type field from BTS to PCU Change-Id: I0b82ab59edd58d60e5581c707dc49f58de0ba203 --- src/bts.cpp | 6 ------ src/bts.h | 2 -- src/coding_scheme.h | 6 ++++-- src/gprs_pcu.c | 3 +++ src/gprs_pcu.h | 2 ++ src/pcu_vty.c | 11 ++++------- src/tbf_dl.cpp | 4 ++-- tests/tbf/TbfTest.cpp | 14 ++++---------- 8 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/bts.cpp b/src/bts.cpp index 46f00335..5eefc369 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -245,12 +245,6 @@ static void bts_init(struct gprs_rlcmac_bts *bts, BTS* bts_obj) 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->T_defs_bts = T_defs_bts; diff --git a/src/bts.h b/src/bts.h index 1394bfe2..b46621af 100644 --- a/src/bts.h +++ b/src/bts.h @@ -108,8 +108,6 @@ struct gprs_rlcmac_bts { uint8_t si13[GSM_MACBLOCK_LEN]; bool si13_is_set; - /* 0 to support resegmentation in DL, 1 for no reseg */ - uint8_t dl_arq_type; 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 */ diff --git a/src/coding_scheme.h b/src/coding_scheme.h index ea1ded1b..1b212650 100644 --- a/src/coding_scheme.h +++ b/src/coding_scheme.h @@ -38,8 +38,10 @@ enum mcs_kind { EGPRS, }; -#define EGPRS_ARQ1 0x0 -#define EGPRS_ARQ2 0x1 +enum egprs_arq_type { + EGPRS_ARQ1 = 0, + EGPRS_ARQ2 = 1 +}; extern const struct value_string mcs_names[]; const char *mcs_name(enum CodingScheme val); diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c index 3b44d363..2a84f7bc 100644 --- a/src/gprs_pcu.c +++ b/src/gprs_pcu.c @@ -52,6 +52,9 @@ struct gprs_pcu *gprs_pcu_alloc(void *ctx) pcu->vty.max_mcs_dl = MAX_EDGE_MCS; pcu->vty.alpha = 0; /* a = 0.0 */ pcu->vty.dl_tbf_preemptive_retransmission = true; + /* By default resegmentation is supported in DL can also be configured + * through VTY */ + pcu->vty.dl_arq_type = EGPRS_ARQ1; 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 2f2fdc7d..f07510bf 100644 --- a/src/gprs_pcu.h +++ b/src/gprs_pcu.h @@ -27,6 +27,7 @@ #include #include "gprs_bssgp_pcu.h" +#include "coding_scheme.h" #define LLC_CODEL_DISABLE 0 #define LLC_CODEL_USE_DEFAULT (-1) @@ -77,6 +78,7 @@ struct gprs_pcu { uint8_t force_two_phase; 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 */ } vty; struct gsmtap_inst *gsmtap; diff --git a/src/pcu_vty.c b/src/pcu_vty.c index 727712df..ef868795 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -198,9 +198,8 @@ static int config_write_pcu(struct vty *vty) vty_out(vty, " window-size %d %d%s", bts->ws_base, bts->ws_pdch, VTY_NEWLINE); - if (bts->dl_arq_type) - vty_out(vty, " egprs dl arq-type arq2%s", - VTY_NEWLINE); + if (the_pcu->vty.dl_arq_type == EGPRS_ARQ2) + vty_out(vty, " egprs dl arq-type arq2%s", VTY_NEWLINE); if (bts->force_llc_lifetime == 0xffff) vty_out(vty, " queue lifetime infinite%s", VTY_NEWLINE); @@ -574,12 +573,10 @@ DEFUN_ATTR(cfg_pcu_dl_arq_type, "enable ARQ2 support", CMD_ATTR_IMMEDIATE) { - struct gprs_rlcmac_bts *bts = bts_main_data(); - if (!strcmp(argv[0], "arq2")) - bts->dl_arq_type = 1; + the_pcu->vty.dl_arq_type = EGPRS_ARQ2; else - bts->dl_arq_type = 0; + the_pcu->vty.dl_arq_type = EGPRS_ARQ1; return CMD_SUCCESS; } diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 6f57e7d8..b6d3a9e5 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -486,7 +486,7 @@ int gprs_rlcmac_dl_tbf::take_next_bsn(uint32_t fn, /* Table 8.1.1.2 and Table 8.1.1.1 of 44.060 */ m_rlc.block(bsn)->cs_current_trans = get_retx_mcs(m_rlc.block(bsn)->cs_init, ms_current_cs_dl(ms()), - !bts->bts_data()->dl_arq_type); + bts->pcu->vty.dl_arq_type == EGPRS_ARQ1); LOGPTBFDL(this, LOGL_DEBUG, "initial_cs_dl(%s) last_mcs(%s) demanded_mcs(%s) cs_trans(%s) arq_type(%d) bsn(%d)\n", @@ -494,7 +494,7 @@ int gprs_rlcmac_dl_tbf::take_next_bsn(uint32_t fn, mcs_name(m_rlc.block(bsn)->cs_last), mcs_name(ms_current_cs_dl(ms())), mcs_name(m_rlc.block(bsn)->cs_current_trans), - bts->bts_data()->dl_arq_type, bsn); + the_pcu->vty.dl_arq_type, bsn); /* TODO: Need to remove this check when MCS-8 -> MCS-6 * transistion is handled. diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 69f07aa4..52403e19 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -2525,7 +2525,6 @@ static void test_tbf_epdan_out_of_rx_window(void) { the_pcu->bts = bts_alloc(the_pcu); BTS *the_bts = the_pcu->bts; - gprs_rlcmac_bts *bts; uint8_t ms_class = 11; uint8_t egprs_ms_class = 11; uint8_t trx_no; @@ -2546,12 +2545,10 @@ static void test_tbf_epdan_out_of_rx_window(void) fprintf(stderr, "=== start %s ===\n", __func__); - bts = the_bts->bts_data(); - setup_bts(the_bts, ts_no); OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2031, 200, OSMO_TDEF_MS) == 0); /* ARQ II */ - bts->dl_arq_type = EGPRS_ARQ2; + the_pcu->vty.dl_arq_type = EGPRS_ARQ2; /* * Simulate a message captured during over-the-air testing, @@ -3083,7 +3080,7 @@ static void test_tbf_egprs_retx_dl(void) setup_bts(the_bts, ts_no); OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2031, 200, OSMO_TDEF_MS) == 0); /* ARQ II */ - bts->dl_arq_type = EGPRS_ARQ2; + the_pcu->vty.dl_arq_type = EGPRS_ARQ2; /* First parameter is current MCS, second one is demanded_mcs */ @@ -3114,7 +3111,7 @@ static void test_tbf_egprs_spb_dl(void) OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2031, 200, OSMO_TDEF_MS) == 0); /* ARQ I resegmentation support */ - bts->dl_arq_type = EGPRS_ARQ1; + the_pcu->vty.dl_arq_type = EGPRS_ARQ1; /* * First parameter is current MCS, second one is demanded_mcs @@ -3135,18 +3132,15 @@ static void test_tbf_egprs_dl() { the_pcu->bts = bts_alloc(the_pcu); BTS *the_bts = the_pcu->bts; - gprs_rlcmac_bts *bts; uint8_t ts_no = 4; int i; fprintf(stderr, "=== start %s ===\n", __func__); - bts = the_bts->bts_data(); - setup_bts(the_bts, ts_no); OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2031, 200, OSMO_TDEF_MS) == 0); /* ARQ II */ - bts->dl_arq_type = EGPRS_ARQ2; + the_pcu->vty.dl_arq_type = EGPRS_ARQ2; for (i = 1; i <= 9; i++) establish_and_use_egprs_dl_tbf(the_bts, i);