Move tbf::free_all static methods to proper object files

Move each method to the object on which they operate, be it a trx or a
pdch ts.

Change-Id: Ida715cbf384431d37b2b192fbd7882957c93a4d1
This commit is contained in:
Pau Espin 2021-01-18 17:53:29 +01:00
parent 8a35e640a3
commit 906aafc9e2
7 changed files with 31 additions and 25 deletions

View File

@ -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 },

View File

@ -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

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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

View File

@ -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;

View File

@ -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);