[osmo-pcu,2/3] bts: Separate functions for dl/ul tbf_by_tfi lookup
diff mbox

Message ID af0488922048526f4a713385b84b25ab2089c062.1404316696.git.daniel@totalueberwachung.de
State Accepted
Headers show

Commit Message

Daniel Willmann July 2, 2014, 3:58 p.m. UTC
Ticket: SYS#389
Sponsored-by: On-Waves ehf
---
 src/bts.cpp | 18 +++++++++++++++---
 src/bts.h   |  4 +++-
 2 files changed, 18 insertions(+), 4 deletions(-)

Patch
diff mbox

diff --git a/src/bts.cpp b/src/bts.cpp
index 51be2d9..52960cf 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -271,6 +271,18 @@  gprs_rlcmac_tbf *BTS::tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts)
 	return NULL;
 }
 
+/* lookup downlink TBF Entity (by TFI) */
+gprs_rlcmac_tbf *BTS::dl_tbf_by_tfi(uint8_t tfi, uint8_t trx)
+{
+	return tbf_by_tfi(tfi, trx, GPRS_RLCMAC_DL_TBF);
+}
+
+/* lookup uplink TBF Entity (by TFI) */
+gprs_rlcmac_tbf *BTS::ul_tbf_by_tfi(uint8_t tfi, uint8_t trx)
+{
+	return tbf_by_tfi(tfi, trx, GPRS_RLCMAC_UL_TBF);
+}
+
 /* lookup TBF Entity (by TFI) */
 gprs_rlcmac_tbf *BTS::tbf_by_tfi(uint8_t tfi, uint8_t trx,
 				enum gprs_rlcmac_tbf_direction dir)
@@ -690,7 +702,7 @@  int gprs_rlcmac_pdch::rcv_data_block_acknowledged(uint8_t *data, uint8_t len, in
 	}
 
 	/* find TBF inst from given TFI */
-	tbf = bts()->tbf_by_tfi(rh->tfi, trx_no(), GPRS_RLCMAC_UL_TBF);
+	tbf = bts()->ul_tbf_by_tfi(rh->tfi, trx_no());
 	if (!tbf) {
 		LOGP(DRLCMACUL, LOGL_NOTICE, "UL DATA unknown TFI=%d\n",
 			rh->tfi);
@@ -900,14 +912,14 @@  void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request,
 
 	if (request->ID.u.Global_TFI.UnionType) {
 		int8_t tfi = request->ID.u.Global_TFI.u.DOWNLINK_TFI;
-		tbf = bts()->tbf_by_tfi(tfi, trx_no(), GPRS_RLCMAC_DL_TBF);
+		tbf = bts()->dl_tbf_by_tfi(tfi, trx_no());
 		if (!tbf) {
 			LOGP(DRLCMAC, LOGL_NOTICE, "PACKET RESSOURCE REQ unknown downlink TFI=%d\n", tfi);
 			return;
 		}
 	} else {
 		int8_t tfi = request->ID.u.Global_TFI.u.UPLINK_TFI;
-		tbf = bts()->tbf_by_tfi(tfi, trx_no(), GPRS_RLCMAC_UL_TBF);
+		tbf = bts()->ul_tbf_by_tfi(tfi, trx_no());
 		if (!tbf) {
 			LOGP(DRLCMAC, LOGL_NOTICE, "PACKET RESSOURCE REQ unknown uplink TFI=%d\n", tfi);
 			return;
diff --git a/src/bts.h b/src/bts.h
index c83bb18..a67f215 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -195,7 +195,8 @@  public:
 	gprs_rlcmac_tbf *dl_tbf_by_tlli(uint32_t tlli);
 	gprs_rlcmac_tbf *ul_tbf_by_tlli(uint32_t tlli);
 	gprs_rlcmac_tbf *tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts);
-	gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi, uint8_t trx, enum gprs_rlcmac_tbf_direction dir);
+	gprs_rlcmac_tbf *dl_tbf_by_tfi(uint8_t tfi, uint8_t trx);
+	gprs_rlcmac_tbf *ul_tbf_by_tfi(uint8_t tfi, uint8_t trx);
 
 	int tfi_find_free(enum gprs_rlcmac_tbf_direction dir, uint8_t *_trx, int8_t use_trx);
 
@@ -240,6 +241,7 @@  private:
 	TimingAdvance m_ta;
 	struct rate_ctr_group *m_ratectrs;
 	gprs_rlcmac_tbf *tbf_by_tlli(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir);
+	gprs_rlcmac_tbf *tbf_by_tfi(uint8_t tfi, uint8_t trx, enum gprs_rlcmac_tbf_direction dir);
 
 private:
 	/* disable copying to avoid slicing */