aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bts.cpp28
-rw-r--r--src/bts.h1
-rw-r--r--src/tbf.cpp22
-rw-r--r--src/tbf.h4
4 files changed, 26 insertions, 29 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 48c86b0..cbe6303 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -214,6 +214,28 @@ gprs_rlcmac_tbf *BTS::tbf_by_poll_fn(uint32_t fn, uint8_t trx, uint8_t ts)
return NULL;
}
+/* lookup TBF Entity (by TFI) */
+gprs_rlcmac_tbf *BTS::tbf_by_tfi(uint8_t tfi, uint8_t trx,
+ enum gprs_rlcmac_tbf_direction dir)
+{
+ struct gprs_rlcmac_tbf *tbf;
+
+ if (tfi >= 32 || trx >= 8)
+ return NULL;
+
+ if (dir == GPRS_RLCMAC_UL_TBF)
+ tbf = m_bts.trx[trx].ul_tbf[tfi];
+ else
+ tbf = m_bts.trx[trx].dl_tbf[tfi];
+ if (!tbf)
+ return NULL;
+
+ if (tbf->state_is_not(GPRS_RLCMAC_RELEASING))
+ return tbf;
+
+ return NULL;
+}
+
/*
* PDCH code below. TODO: move to a separate file
@@ -383,7 +405,7 @@ int gprs_rlcmac_pdch::rcv_data_block_acknowledged(uint8_t *data, uint8_t len, in
}
/* find TBF inst from given TFI */
- tbf = tbf_by_tfi(bts_data(), rh->tfi, trx_no(), GPRS_RLCMAC_UL_TBF);
+ tbf = bts()->tbf_by_tfi(rh->tfi, trx_no(), GPRS_RLCMAC_UL_TBF);
if (!tbf) {
LOGP(DRLCMACUL, LOGL_NOTICE, "UL DATA unknown TBF=%d\n",
rh->tfi);
@@ -782,14 +804,14 @@ int gprs_rlcmac_pdch::rcv_control_block(
} else {
if (ul_control_block->u.Packet_Resource_Request.ID.u.Global_TFI.UnionType) {
tfi = ul_control_block->u.Packet_Resource_Request.ID.u.Global_TFI.u.DOWNLINK_TFI;
- tbf = tbf_by_tfi(bts_data(), tfi, trx_no(), GPRS_RLCMAC_DL_TBF);
+ tbf = bts()->tbf_by_tfi(tfi, trx_no(), GPRS_RLCMAC_DL_TBF);
if (!tbf) {
LOGP(DRLCMAC, LOGL_NOTICE, "PACKET RESSOURCE REQ unknown downlink TBF=%d\n", tlli);
break;
}
} else {
tfi = ul_control_block->u.Packet_Resource_Request.ID.u.Global_TFI.u.UPLINK_TFI;
- tbf = tbf_by_tfi(bts_data(), tfi, trx_no(), GPRS_RLCMAC_UL_TBF);
+ tbf = bts()->tbf_by_tfi(tfi, trx_no(), GPRS_RLCMAC_UL_TBF);
if (!tbf) {
LOGP(DRLCMAC, LOGL_NOTICE, "PACKET RESSOURCE REQ unknown uplink TBF=%d\n", tlli);
break;
diff --git a/src/bts.h b/src/bts.h
index 7d8f422..f785899 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -164,6 +164,7 @@ public:
gprs_rlcmac_tbf *tbf_by_tlli(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir);
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);
private:
int m_cur_fn;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index d1ca676..2282aea 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -407,28 +407,6 @@ void gprs_rlcmac_tbf::stop_timer()
}
}
-/* lookup TBF Entity (by TFI) */
-struct gprs_rlcmac_tbf *tbf_by_tfi(struct gprs_rlcmac_bts *bts,
- uint8_t tfi, uint8_t trx, enum gprs_rlcmac_tbf_direction dir)
-{
- struct gprs_rlcmac_tbf *tbf;
-
- if (tfi >= 32 || trx >= 8)
- return NULL;
-
- if (dir == GPRS_RLCMAC_UL_TBF)
- tbf = bts->trx[trx].ul_tbf[tfi];
- else
- tbf = bts->trx[trx].dl_tbf[tfi];
- if (!tbf)
- return NULL;
-
- if (tbf->state_is_not(GPRS_RLCMAC_RELEASING))
- return tbf;
-
- return NULL;
-}
-
struct gprs_rlcmac_tbf *tbf_alloc(struct gprs_rlcmac_bts *bts,
struct gprs_rlcmac_tbf *old_tbf, enum gprs_rlcmac_tbf_direction dir,
uint8_t tfi, uint8_t trx,
diff --git a/src/tbf.h b/src/tbf.h
index 3e8346c..0181dff 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -227,10 +227,6 @@ struct gprs_rlcmac_tbf *tbf_alloc(struct gprs_rlcmac_bts *bts,
enum gprs_rlcmac_tbf_direction dir, uint8_t tfi, uint8_t trx,
uint8_t ms_class, uint8_t single_slot);
-struct gprs_rlcmac_tbf *tbf_by_tfi(struct gprs_rlcmac_bts *bts,
- uint8_t tfi, uint8_t trx,
- enum gprs_rlcmac_tbf_direction dir);
-
void tbf_free(struct gprs_rlcmac_tbf *tbf);
int tbf_assign_control_ts(struct gprs_rlcmac_tbf *tbf);