Change in osmo-pcu[master]: Move tbf::free_all static methods to proper object files

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Jan 18 17:36:46 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/22296 )


Change subject: Move tbf::free_all static methods to proper object files
......................................................................

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
---
M src/bts.cpp
M src/bts.h
M src/osmobts_sock.cpp
M src/pdch.cpp
M src/pdch.h
M src/tbf.cpp
M src/tbf.h
7 files changed, 31 insertions(+), 25 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/96/22296/1

diff --git a/src/bts.cpp b/src/bts.cpp
index ec35dcd..372d45d 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 86a7a49..8497a64 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);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/22296
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ida715cbf384431d37b2b192fbd7882957c93a4d1
Gerrit-Change-Number: 22296
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210118/a689ecb0/attachment.htm>


More information about the gerrit-log mailing list