tbf: Move enable_egprs() to constructor

Whether the TBF is GPRS or EGPRS is known at allocation time since it
comes from the information known in the MS object used to create it.
Hence, no need to delay calling it to later steps such as setup().

So far it was probably left in setup() due to the constrains about
requiring the subclass to be constructed (use of window() virtual API).

Change-Id: I2e9d2a98c666a930333d52fb6c0463d7593c2615
This commit is contained in:
Pau Espin 2023-04-19 18:36:40 +02:00
parent e0e4251a5b
commit 759724ca74
5 changed files with 20 additions and 13 deletions

View File

@ -575,9 +575,6 @@ int gprs_rlcmac_tbf::setup(int8_t use_trx, bool single_slot)
{
int rc;
if (ms_mode(m_ms) != GPRS)
enable_egprs();
/* select algorithm */
rc = the_pcu->alloc_algorithm(bts, this, single_slot, use_trx);
/* if no resource */

View File

@ -254,13 +254,13 @@ struct gprs_rlcmac_tbf {
protected:
void merge_and_clear_ms(GprsMs *old_ms);
void enable_egprs(void);
gprs_llc_queue *llc_queue();
const gprs_llc_queue *llc_queue() const;
struct GprsMs *m_ms;
private:
void enable_egprs();
bool m_egprs_enabled;
struct osmo_timer_list Tarr[T_MAX];
uint8_t Narr[N_MAX];

View File

@ -183,6 +183,11 @@ gprs_rlcmac_dl_tbf::gprs_rlcmac_dl_tbf(struct gprs_rlcmac_bts *bts_, GprsMs *ms)
state_fsm.dl_tbf = this;
state_fi = osmo_fsm_inst_alloc(&tbf_dl_fsm, this, &state_fsm, LOGL_INFO, NULL);
OSMO_ASSERT(state_fi);
/* This has to be called in child constructor because enable_egprs()
* uses the window() virtual function which is dependent on subclass. */
if (ms_mode(m_ms) != GPRS)
enable_egprs();
}
/**

View File

@ -189,6 +189,11 @@ gprs_rlcmac_ul_tbf::gprs_rlcmac_ul_tbf(struct gprs_rlcmac_bts *bts_, GprsMs *ms)
OSMO_ASSERT(m_ul_egprs_ctrs);
m_ul_gprs_ctrs = rate_ctr_group_alloc(this, &tbf_ul_gprs_ctrg_desc, m_ctrs->idx);
OSMO_ASSERT(m_ul_gprs_ctrs);
/* This has to be called in child constructor because enable_egprs()
* uses the window() virtual function which is dependent on subclass. */
if (ms_mode(m_ms) != GPRS)
enable_egprs();
}
/*

View File

@ -9771,15 +9771,15 @@ UL_ASS_TBF{NONE}: Allocated
DL_ASS_TBF{NONE}: Allocated
UL_TBF{NEW}: Allocated
UL_ACK_TBF{NONE}: Allocated
TBF(UL:TFI-0-0--1:STATE-NEW:GPRS:TLLI-0xffeeddd3) Setting Control TS PDCH(bts=0,trx=0,ts=7)
MS(TLLI-0xffeeddd3:TA-7:MSCLS-11-11) Attaching UL TBF: TBF(UL:TFI-0-0--1:STATE-NEW:GPRS:TLLI-0xffeeddd3)
TBF(UL:TFI-0-0--1:STATE-NEW:EGPRS:TLLI-0xffeeddd3) Setting Control TS PDCH(bts=0,trx=0,ts=7)
MS(TLLI-0xffeeddd3:TA-7:MSCLS-11-11) Attaching UL TBF: TBF(UL:TFI-0-0--1:STATE-NEW:EGPRS:TLLI-0xffeeddd3)
MS(TLLI-0xffeeddd3:TA-7:MSCLS-11-11:UL): + tbf: now used by 2 (rcv_resource_request,tbf)
UL_TBF(UL:TFI-0-0--1:STATE-NEW:GPRS:TLLI-0xffeeddd3){NEW}: Received Event ASSIGN_ADD_PACCH
TBF(UL:TFI-0-0--1:STATE-NEW:GPRS:TLLI-0xffeeddd3) set ass. type PACCH [prev CCCH:0, PACCH:0]
UL_TBF(UL:TFI-0-0--1:STATE-NEW:GPRS:TLLI-0xffeeddd3){NEW}: state_chg to ASSIGN
TBF(UL:TFI-0-0--1:STATE-ASSIGN:GPRS:TLLI-0xffeeddd3) Starting timer X2001 [assignment (PACCH)] with 2 sec. 0 microsec
UL_ASS_TBF(UL:TFI-0-0--1:STATE-NEW:GPRS:TLLI-0xffeeddd3){NONE}: Received Event SCHED_ASS_REJ
UL_ASS_TBF(UL:TFI-0-0--1:STATE-NEW:GPRS:TLLI-0xffeeddd3){NONE}: state_chg to SEND_ASS_REJ
UL_TBF(UL:TFI-0-0--1:STATE-NEW:EGPRS:TLLI-0xffeeddd3){NEW}: Received Event ASSIGN_ADD_PACCH
TBF(UL:TFI-0-0--1:STATE-NEW:EGPRS:TLLI-0xffeeddd3) set ass. type PACCH [prev CCCH:0, PACCH:0]
UL_TBF(UL:TFI-0-0--1:STATE-NEW:EGPRS:TLLI-0xffeeddd3){NEW}: state_chg to ASSIGN
TBF(UL:TFI-0-0--1:STATE-ASSIGN:EGPRS:TLLI-0xffeeddd3) Starting timer X2001 [assignment (PACCH)] with 2 sec. 0 microsec
UL_ASS_TBF(UL:TFI-0-0--1:STATE-NEW:EGPRS:TLLI-0xffeeddd3){NONE}: Received Event SCHED_ASS_REJ
UL_ASS_TBF(UL:TFI-0-0--1:STATE-NEW:EGPRS:TLLI-0xffeeddd3){NONE}: state_chg to SEND_ASS_REJ
MS(TLLI-0xffeeddd3:TA-7:MSCLS-11-11:UL): - rcv_resource_request: now used by 1 (tbf)
PDCH(bts=0,trx=0,ts=7) Expiring FN=82 but previous FN=2654231 is still reserved!
PDCH(bts=0,trx=0,ts=7) Timeout for registered POLL (FN=2654231, reason=UL_ASS): TBF(UL:TFI-0-0-6:STATE-ASSIGN:EGPRS:TLLI-0xffeeddd2)
@ -9798,7 +9798,7 @@ TBF(UL:TFI-0-0-0:STATE-ASSIGN:EGPRS:TLLI-0xffeeddcc) Scheduled UL Assignment pol
UL_ASS_TBF(UL:TFI-0-0-0:STATE-NEW:EGPRS:TLLI-0xffeeddcc){SEND_ASS}: state_chg to WAIT_ACK
PDCH(bts=0,trx=0,ts=7) FN=2654218 Scheduling control message at RTS for TBF(UL:TFI-0-0-0:STATE-ASSIGN:EGPRS:TLLI-0xffeeddcc)
MS(TLLI-0xffeeddd3:TA-7:MSCLS-11-11:UL) Destroying MS object
MS(TLLI-0xffeeddd3:TA-7:MSCLS-11-11:UL) Detaching TBF: TBF(UL:TFI-0-0--1:STATE-ASSIGN:GPRS:TLLI-0xffeeddd3)
MS(TLLI-0xffeeddd3:TA-7:MSCLS-11-11:UL) Detaching TBF: TBF(UL:TFI-0-0--1:STATE-ASSIGN:EGPRS:TLLI-0xffeeddd3)
MS(TLLI-0xffeeddd3:TA-7:MSCLS-11-11): - tbf: now used by 0 (-)
MS(TLLI-0xffeeddd2:TA-7:MSCLS-11-11:UL) Destroying MS object
MS(TLLI-0xffeeddd2:TA-7:MSCLS-11-11:UL) Detaching TBF: TBF(UL:TFI-0-0-6:STATE-ASSIGN:EGPRS:TLLI-0xffeeddd2)