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
diff --git a/src/bts.cpp b/src/bts.cpp
index 0e08091..499c033 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -70,6 +70,12 @@
}
}
+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 8d06939..37fc5dc 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -65,6 +65,7 @@
#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 d94c7e7..c68b7b9 100644
--- a/src/osmobts_sock.cpp
+++ b/src/osmobts_sock.cpp
@@ -118,7 +118,7 @@
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 c48c63f..15fd139 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -152,7 +152,7 @@
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 @@
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 2413ef7..57e0f43 100644
--- a/src/pdch.h
+++ b/src/pdch.h
@@ -183,3 +183,11 @@
}
#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 859ebcd..37af21f 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1045,26 +1045,6 @@
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 460de70..d616076 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -215,9 +215,6 @@
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);