diff --git a/src/bts.cpp b/src/bts.cpp index 0e08091c..499c0334 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -70,6 +70,12 @@ extern "C" { } } +void bts_trx_free_all_tbf(struct gprs_rlcmac_trx *trx) +{ + for (uint8_t ts = 0; ts < 8; ts++) + pdch_free_all_tbf(&trx->pdch[ts]); +} + static struct osmo_tdef T_defs_bts[] = { { .T=3142, .default_val=20, .unit=OSMO_TDEF_S, .desc="timer (s)", .val=0 }, { .T=3169, .default_val=5, .unit=OSMO_TDEF_S, .desc="Reuse of USF and TFI(s) after the MS uplink TBF assignment is invalid (s)", .val=0 }, diff --git a/src/bts.h b/src/bts.h index 8d069392..37fc5dc6 100644 --- a/src/bts.h +++ b/src/bts.h @@ -65,6 +65,7 @@ extern "C" { #endif void bts_trx_reserve_slots(struct gprs_rlcmac_trx *trx, enum gprs_rlcmac_tbf_direction dir, uint8_t slots); void bts_trx_unreserve_slots(struct gprs_rlcmac_trx *trx, enum gprs_rlcmac_tbf_direction dir, uint8_t slots); +void bts_trx_free_all_tbf(struct gprs_rlcmac_trx *trx); void bts_update_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts, int8_t ta, bool is_rach); #ifdef __cplusplus diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp index d94c7e75..c68b7b9c 100644 --- a/src/osmobts_sock.cpp +++ b/src/osmobts_sock.cpp @@ -118,7 +118,7 @@ static void pcu_sock_close(int lost) bts->trx[trx].pdch[ts].disable(); /* FIXME: NOT ALL RESOURCES are freed in this case... inconsistent with the other code. Share the code with pcu_l1if.c for the reset. */ - gprs_rlcmac_tbf::free_all(&bts->trx[trx]); + bts_trx_free_all_tbf(&bts->trx[trx]); } gprs_bssgp_destroy(bts); diff --git a/src/pdch.cpp b/src/pdch.cpp index c48c63ff..15fd139d 100644 --- a/src/pdch.cpp +++ b/src/pdch.cpp @@ -152,7 +152,7 @@ void gprs_rlcmac_pdch::free_resources() return; /* kick all TBF on slot */ - gprs_rlcmac_tbf::free_all(this); + pdch_free_all_tbf(this); /* flush all pending paging messages */ while ((pag = dequeue_paging())) @@ -1017,3 +1017,17 @@ void gprs_rlcmac_pdch::update_ta(uint8_t tai, uint8_t ta) OSMO_ASSERT(tai < PTCCH_TAI_NUM); ptcch_msg[tai] = ta; } + +void pdch_free_all_tbf(struct gprs_rlcmac_pdch *pdch) +{ + for (uint8_t tfi = 0; tfi < 32; tfi++) { + struct gprs_rlcmac_tbf *tbf; + + tbf = pdch->ul_tbf_by_tfi(tfi); + if (tbf) + tbf_free(tbf); + tbf = pdch->dl_tbf_by_tfi(tfi); + if (tbf) + tbf_free(tbf); + } +} diff --git a/src/pdch.h b/src/pdch.h index 2413ef70..57e0f437 100644 --- a/src/pdch.h +++ b/src/pdch.h @@ -183,3 +183,11 @@ inline bool gprs_rlcmac_pdch::is_enabled() const } #endif /* __cplusplus */ + +#ifdef __cplusplus +extern "C" { +#endif +void pdch_free_all_tbf(struct gprs_rlcmac_pdch *pdch); +#ifdef __cplusplus +} +#endif diff --git a/src/tbf.cpp b/src/tbf.cpp index 859ebcda..37af21f4 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -1045,26 +1045,6 @@ free_ret: return NULL; } -void gprs_rlcmac_tbf::free_all(struct gprs_rlcmac_trx *trx) -{ - for (uint8_t ts = 0; ts < 8; ts++) - free_all(&trx->pdch[ts]); -} - -void gprs_rlcmac_tbf::free_all(struct gprs_rlcmac_pdch *pdch) -{ - for (uint8_t tfi = 0; tfi < 32; tfi++) { - struct gprs_rlcmac_tbf *tbf; - - tbf = pdch->ul_tbf_by_tfi(tfi); - if (tbf) - tbf_free(tbf); - tbf = pdch->dl_tbf_by_tfi(tfi); - if (tbf) - tbf_free(tbf); - } -} - int gprs_rlcmac_tbf::establish_dl_tbf_on_pacch() { struct gprs_rlcmac_dl_tbf *new_tbf = NULL; diff --git a/src/tbf.h b/src/tbf.h index 460de701..d616076d 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -215,9 +215,6 @@ struct gprs_rlcmac_tbf { gprs_rlcmac_tbf(struct gprs_rlcmac_bts *bts_, GprsMs *ms, gprs_rlcmac_tbf_direction dir); virtual ~gprs_rlcmac_tbf() {} - static void free_all(struct gprs_rlcmac_trx *trx); - static void free_all(struct gprs_rlcmac_pdch *pdch); - virtual gprs_rlc_window *window() = 0; int setup(int8_t use_trx, bool single_slot);