From 25a3ca4e59a0ea03067a04ff3fe459a9ba00efd1 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 13 Dec 2017 18:47:52 +0100 Subject: [PATCH] TBF: move EGPRS enablement into (U|D)L-TBF This is preparation patch for transition to separate UL/DL window variables instead of current shared generic window. The setting of window parameters is performed in functions specific to UL/DL TBFs but the general EGPRS flag remains the same and is set via the same function which is now marked as protected since it's only meant to be used by UL/DL subclasses. Related: OS#1759 Change-Id: I6056194b28a1eb9d69093d1dfdc65a11bc1fc579 --- src/tbf.cpp | 2 -- src/tbf.h | 19 +++++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/tbf.cpp b/src/tbf.cpp index 7b609c84..98005dc6 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -862,7 +862,6 @@ struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts, if (egprs_ms_class > 0 && bts->egprs_enabled) { tbf->enable_egprs(); - tbf->m_window.set_sns(RLC_EGPRS_SNS); setup_egprs_mode(bts, ms); LOGP(DRLCMAC, LOGL_INFO, "Enabled EGPRS for %s, mode %s\n", tbf->name(), GprsCodingScheme::modeName(ms->mode())); @@ -956,7 +955,6 @@ struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts, if (egprs_ms_class > 0 && bts->egprs_enabled) { tbf->enable_egprs(); - tbf->m_window.set_sns(RLC_EGPRS_SNS); setup_egprs_mode(bts, ms); LOGP(DRLCMAC, LOGL_INFO, "Enabled EGPRS for %s, mode %s\n", tbf->name(), GprsCodingScheme::modeName(ms->mode())); diff --git a/src/tbf.h b/src/tbf.h index 80249df1..558bd214 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -210,7 +210,6 @@ struct gprs_rlcmac_tbf { /* EGPRS */ bool is_egprs_enabled() const; - void enable_egprs(); void disable_egprs(); /* attempt to make things a bit more fair */ @@ -286,7 +285,7 @@ struct gprs_rlcmac_tbf { protected: gprs_rlcmac_bts *bts_data() const; - + void enable_egprs(); int set_tlli_from_ul(uint32_t new_tlli); void merge_and_clear_ms(GprsMs *old_ms); @@ -416,7 +415,7 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf { gprs_rlcmac_dl_tbf(BTS *bts); void cleanup(); - + void enable_egprs(); /* dispatch Unitdata.DL messages */ static int handle(struct gprs_rlcmac_bts *bts, const uint32_t tlli, const uint32_t old_tlli, @@ -513,7 +512,7 @@ struct gprs_rlcmac_ul_tbf : public gprs_rlcmac_tbf { struct msgb *create_ul_ack(uint32_t fn, uint8_t ts); bool ctrl_ack_to_toggle(); bool handle_ctrl_ack(); - + void enable_egprs(); /* blocks were acked */ int rcv_data_block_acknowledged( const struct gprs_rlc_data_info *rlc, @@ -577,6 +576,18 @@ inline enum gprs_rlcmac_tbf_direction reverse(enum gprs_rlcmac_tbf_direction dir ((int)GPRS_RLCMAC_UL_TBF - (int)dir + (int)GPRS_RLCMAC_DL_TBF); } +inline void gprs_rlcmac_ul_tbf::enable_egprs() +{ + m_window.set_sns(RLC_EGPRS_SNS); + gprs_rlcmac_tbf::enable_egprs(); +} + +inline void gprs_rlcmac_dl_tbf::enable_egprs() +{ + m_window.set_sns(RLC_EGPRS_SNS); + gprs_rlcmac_tbf::enable_egprs(); +} + inline gprs_rlcmac_ul_tbf *as_ul_tbf(gprs_rlcmac_tbf *tbf) { if (tbf && tbf->direction == GPRS_RLCMAC_UL_TBF)