aboutsummaryrefslogtreecommitdiffstats
path: root/src/bts.cpp
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2014-05-30 20:21:30 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-06-04 17:17:45 +0200
commit17a1d5e1623ca7c09bc312fd402cdf0075b523be (patch)
tree20da98fbbb5ca7c9b2ed90cc3d12317077ccfe80 /src/bts.cpp
parent1e0c61032fbccc6bd4b1fbd89765f125643e79c3 (diff)
gprs_rlcmac_pdch: Get rid of ul/dl_tbf
The current code keeps a reference to all tbfs in the bts and another reference in the pdch. This allows for the possibility of both lists to go out of sync. This patch removes the pdch-specific list of ul and dl tbfs and uses the lists in the bts to lookup tbfs everywhere. Performance for going through the global list is not an issue yet. We can optimize this later and in a better way. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/bts.cpp')
-rw-r--r--src/bts.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 3ca3628e..9de6dc35 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -991,16 +991,26 @@ int gprs_rlcmac_pdch::rcv_block(uint8_t *data, uint8_t len, uint32_t fn, int8_t
return rc;
}
-struct gprs_rlcmac_tbf *gprs_rlcmac_pdch::ul_tbf_by_tfi(uint8_t tfi)
+gprs_rlcmac_tbf *gprs_rlcmac_pdch::tbf_from_list_by_tfi(struct llist_head *tbf_list, uint8_t tfi)
{
- if (tfi >= ARRAY_SIZE(ul_tbf))
- return NULL;
- return ul_tbf[tfi];
+ gprs_rlcmac_tbf *tbf;
+
+ llist_for_each_entry(tbf, tbf_list, list) {
+ if (tbf->tfi() != tfi)
+ continue;
+ if (!tbf->pdch[ts_no])
+ continue;
+ return tbf;
+ }
+ return NULL;
}
-struct gprs_rlcmac_tbf *gprs_rlcmac_pdch::dl_tbf_by_tfi(uint8_t tfi)
+gprs_rlcmac_tbf *gprs_rlcmac_pdch::ul_tbf_by_tfi(uint8_t tfi)
{
- if (tfi >= ARRAY_SIZE(dl_tbf))
- return NULL;
- return dl_tbf[tfi];
+ return tbf_from_list_by_tfi(&bts_data()->ul_tbfs, tfi);
+}
+
+gprs_rlcmac_tbf *gprs_rlcmac_pdch::dl_tbf_by_tfi(uint8_t tfi)
+{
+ return tbf_from_list_by_tfi(&bts_data()->dl_tbfs, tfi);
}