[PATCH 4/8] tbf: Add another variant of the free_all now by pdch

Holger Hans Peter Freyther hfreyther at sysmocom.de
Sat Oct 19 14:26:34 UTC 2013


From: Holger Hans Peter Freyther <holger at moiji-mobile.com>

---
 src/pcu_l1_if.cpp | 12 ++----------
 src/tbf.cpp       | 14 ++++++++++++++
 src/tbf.h         |  1 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 47bf740..a31974f 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -306,20 +306,12 @@ static int pcu_rx_rach_ind(struct gsm_pcu_if_rach_ind *rach_ind)
 
 int flush_pdch(struct gprs_rlcmac_pdch *pdch, uint8_t trx, uint8_t ts)
 {
-	uint8_t tfi;
-	struct gprs_rlcmac_tbf *tbf;
 	struct gprs_rlcmac_paging *pag;
 	struct gprs_rlcmac_sba *sba, *sba2;
 
 	/* kick all TBF on slot */
-	for (tfi = 0; tfi < 32; tfi++) {
-		tbf = pdch->ul_tbf[tfi];
-		if (tbf)
-			tbf_free(tbf);
-		tbf = pdch->dl_tbf[tfi];
-		if (tbf)
-			tbf_free(tbf);
-	}
+	gprs_rlcmac_tbf::free_all(pdch);
+
 	/* flush all pending paging messages */
 	while ((pag = gprs_rlcmac_dequeue_paging(pdch)))
 		talloc_free(pag);
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 8aff463..4bb42a7 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -251,3 +251,17 @@ void gprs_rlcmac_tbf::free_all(struct gprs_rlcmac_trx *trx)
 			tbf_free(tbf);
 	}
 }
+
+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[tfi];
+		if (tbf)
+			tbf_free(tbf);
+		tbf = pdch->dl_tbf[tfi];
+		if (tbf)
+			tbf_free(tbf);
+	}
+}
diff --git a/src/tbf.h b/src/tbf.h
index b73d0b8..74df237 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -89,6 +89,7 @@ extern struct llist_head gprs_rlcmac_sbas; /* list of single block allocs */
 struct gprs_rlcmac_tbf {
 
 	static void free_all(struct gprs_rlcmac_trx *trx);
+	static void free_all(struct gprs_rlcmac_pdch *pdch);
 
 
 	struct llist_head list;
-- 
1.8.4.rc3





More information about the osmocom-net-gprs mailing list